You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] A GPU excluded via device= still gets a CUDA context and linalg warmup allocations from the global DeviceThreadPool (follow-up to #4233) #4320
Severity: low. Status: confirmed on 2× RTX 4090. Kind: incomplete fix of #4233 (5149b1a).
Where
gptqmodel/__init__.py:420-438: _build_device_thread_pool creates cuda:per workers that run run_torch_linalg_warmup on every visible device. The compute_device_filter from the #4233 fix is not applied to this pool.
nvidia-smi shows about 524 MiB used by this process on GPU 0.
PyTorch's peak allocation on cuda:0 is 6 MiB, with 22 MiB reserved.
The allocation traces all point to utils/linalg_warmup.py (_run_qr 49 MB, _run_cholesky_and_eigh, _run_svd), reached through threadx._run_warmup.
Expected: no context or allocation on a GPU the user excluded.
What is fixed: the original OOM. With GPU 0 capped (set_per_process_memory_fraction(1e-9, 0)) the run now completes, so the pre_quantize staging itself is correct.
Found during an AI-assisted review (Claude Code, round 11) of 842d666; repros were run at that commit on RTX 4090/5090 (CUDA 13) and/or Radeon AI PRO R9700 (ROCm) unless marked static/suspected.
Taking this. I'll investigate against current main, add a targeted regression test, and open a PR. Will report back here if the claim turns out to be invalid or already fixed.
Another round-12 check at def6e61 (2× RTX 4090, CUDA_VISIBLE_DEVICES=0,1), using GPTQModel.load("Qwen/Qwen2.5-0.5B-Instruct", QuantizeConfig(bits=4, group_size=128), device=("cuda:1",)) followed by quantize(calib):
After load, only GPU1 is in use. That part is fixed.
After quantize, the process still holds 386 MiB on GPU0, down from 524 MiB before the fix. The context is created during layer-0 calibration.
I have not pinned down the call that creates it. It is not torch.cuda.memory_stats(0); I tested that, and it does not create a context.
With device="cuda:1" passed as a plain string (see the previous comment), every device is still warmed up, which puts about 1.07 GiB on GPU0.
Activity
Qubitium commentedon Nov 16, 2026
Taking this. I'll investigate against current
main, add a targeted regression test, and open a PR. Will report back here if the claim turns out to be invalid or already fixed.fix(threadx): skip warmup for devices excluded from quantization (Mod…
Qubitium commentedon Nov 16, 2026
Round-12 follow-up at
def6e61(from code reading; not run on 2 GPUs): 8b139ab skips warmup only whendevice=is a tuple or list.models/auto.py:777-789calls_explicit_requested_devices, which returns None for anything else (loader.py:467).device="cuda:1"(a string) still warms up, and creates a context on, every visible GPU. A user-setquantize_config.compute_device_filterdoes too.Qubitium commentedon Nov 16, 2026
Another round-12 check at
def6e61(2× RTX 4090,CUDA_VISIBLE_DEVICES=0,1), usingGPTQModel.load("Qwen/Qwen2.5-0.5B-Instruct", QuantizeConfig(bits=4, group_size=128), device=("cuda:1",))followed byquantize(calib):load, only GPU1 is in use. That part is fixed.quantize, the process still holds 386 MiB on GPU0, down from 524 MiB before the fix. The context is created during layer-0 calibration.torch.cuda.memory_stats(0); I tested that, and it does not create a context.device="cuda:1"passed as a plain string (see the previous comment), every device is still warmed up, which puts about 1.07 GiB on GPU0.fix(looper): stop claiming GPUs a quantization run excluded (#4653) (#…
fix(load): read the checkpoint with the int device ordinal so cuda:0 …
test(gpu): move the excluded-device gate onto CalibrationConfig (#4868)…