Skip to content

Measure --use-gpu on real hardware; cap the quality-pool oversubscription - #28

Merged
hd152 merged 1 commit into
mainfrom
gpu-quality-pool-cap
Sep 22, 2026
Merged

hd152 merged 1 commit into
mainfrom
gpu-quality-pool-cap

Conversation

@hd152

@hd152 hd152 commented Sep 22, 2026

Copy link
Copy Markdown
Owner

Summary

Pushed into GPU coverage as requested — but measured before adding anything, since this is real hardware this time (GTX 1650 Ti, 4GB), not a hypothesis.

  • Real head-to-head on the same real 15-frame session, same machine: --use-gpu is currently a net loss — 54.4s vs ~37s CPU-only.
  • Root cause is mostly architectural: Phase 1's GPU-mode worker count is capped by VRAM (~7 workers on this card vs 16 CPU-mode workers), while most of Phase 1's actual work (lacosmic, debayer interpolation, star detection) stays CPU-native regardless of --use-gpu — only calibration/hot-pixel/white-balance dispatch to GPU at all, so the lost worker-count parallelism isn't compensated.
  • Found and fixed a smaller, real, secondary contributor: the GPU-mode quality-metrics thread pool ran uncapped (os.cpu_count() threads) concurrently with the GPU worker threads, and neither pool is rayon/BLAS-pinned the way CPU mode's process-pool workers are. Capped it (_gpu_quality_pool_size) — recovered ~0.7s of the ~17s gap. Real, but confirms the worker-count architecture is the dominant cause, not thread pinning.
  • Widening GPU coverage further (warp/drizzle) was considered and set aside: it would add more per-worker VRAM demand, shrinking the already-constraining worker count further rather than fixing it. The actual fix is architectural and carries real OOM risk on other users' cards if done wrong — documented in CLAUDE.md rather than attempted blind.

Test plan

  • Full suite passes (1656 tests)
  • ruff check . clean
  • New unit test for the extracted sizing helper
  • Measured on real GPU hardware, both before and after the fix

🤖 Generated with Claude Code

…tion

Pushed into GPU coverage as requested, but measured before adding
anything: real head-to-head on a GTX 1650 Ti (4GB), same real 15-frame
session, same machine. --use-gpu is currently a net loss --
54.4s vs ~37s CPU-only.

Root cause is mostly architectural: Phase 1's GPU-mode worker count is
capped by VRAM (max_gpu_workers, ~7 workers on this card vs 16
CPU-mode workers), while most of Phase 1's actual work (lacosmic,
debayer interpolation, star detection) stays CPU-native regardless of
--use-gpu -- only calibration/hot-pixel/white-balance dispatch to GPU
at all, so the lost worker-count parallelism isn't compensated.

Found and fixed a smaller, real, secondary contributor:
execute_frame_processing's GPU-mode quality-metrics thread pool ran
uncapped (os.cpu_count() threads) concurrently with the GPU worker
threads in the same process, and neither pool is rayon/BLAS-pinned the
way CPU mode's ProcessPoolExecutor workers are (that pinning is
subprocess-initializer-only). Extracted the sizing into
_gpu_quality_pool_size so the two pools' thread counts stay near the
physical core budget together instead of stacking. Recovered ~0.7s of
the ~17s gap -- real, but confirms the worker-count architecture is
the dominant cause, not thread pinning.

Widening GPU coverage further (warp/drizzle) was considered and set
aside: more per-worker VRAM demand would shrink the already-
constraining worker count further, compounding the problem rather than
fixing it. The actual fix is architectural (decouple Phase 1 worker
count from VRAM when the GPU-dispatched fraction of work is small, or
reduce GPU_PHASE1_WORKER_MB's footprint) and wasn't attempted here --
real OOM risk on other users' cards if the budget is cut wrong, and no
evidence yet on whether it pays off on a larger card. Documented in
CLAUDE.md for whoever picks this back up.

New unit test for the sizing helper; full suite (1656 tests) passes.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@hd152
hd152 merged commit d935d20 into main Sep 22, 2026
7 checks passed
@hd152
hd152 deleted the gpu-quality-pool-cap branch September 22, 2026 21:58
@hd152 hd152 mentioned this pull request Sep 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant