Make the pipelining knobs config-file settable (server: section)

CPU_WORKERS / GPU_CONCURRENCY were env-only. Add a `server:` config
section (server.cpu_workers, server.gpu_concurrency) so a lane's
concurrency lives in its yaml alongside device/precision, matching how
model.device already works. Precedence mirrors BGFILTER_DEVICE: config is
the default, the env var overrides per box.

The pool + admission semaphore now build in lifespan (after the config
loads) instead of at import, and PipelineManager reads gpu_concurrency
from the settings. configs/gpu.yaml ships 8 / 2 (its target is the 32 GB
GPU boxes) with an inline VRAM caveat: gpu_concurrency>1 must fit
weights + N × forward, so keep it 1 on ≤16 GB cards.

Verified on a 4080 SUPER: startup logs cpu_workers=8 gpu_concurrency=2
from gpu.yaml with no env set, request returns a valid RGBA.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-14 12:58:15 +00:00
parent c748fc22a4
commit 07ba02fdde
7 changed files with 56 additions and 15 deletions
+12
View File
@@ -73,3 +73,15 @@ foreground:
despill:
enabled: false
server:
# Request concurrency (HTTP service only). cpu_workers = thread-pool size: >1 runs
# several requests at once, overlapping their CPU stages while the GPU forwards
# stay serialized -- keeps the GPU fed. gpu_concurrency = how many forwards may
# co-schedule on the SMs at once: 2 lifts GPU-bound throughput (batch-1 underfills
# the SMs) but roughly DOUBLES GPU activation memory.
# * On a >=24 GB card (e.g. 4080 SUPER 32 GB): gpu_concurrency: 2 peaks ~19 GB.
# * On a <=16 GB card: keep gpu_concurrency: 1 or it will OOM at 2048 cross-check.
# Env vars BGFILTER_CPU_WORKERS / BGFILTER_GPU_CONCURRENCY override these per box.
cpu_workers: 8
gpu_concurrency: 2