Skip to content

fix: stage pre_quantize layers on the filtered quantization device (#4233) - #4252

Merged
Qubitium merged 2 commits into
mainfrom
pr/4233
Nov 16, 2026
Merged

Qubitium merged 2 commits into
mainfrom
pr/4233

Conversation

@Qubitium

Copy link
Copy Markdown
Collaborator

Summary

pre_quantize() staged every decoder layer on the index-less DEVICE.CUDA, which resolves to cuda:0, ignoring device=("cuda:1",). If GPU 0 was busy the quantization OOMed even though the user excluded it.

What Changed

  • gptqmodel/models/base.py: pre_quantize() now resolves the device through the run's compute_device_filter (falling back to the configured device), so META materialization and move_to use the filtered/primary quantization device.
  • Added tests/test_pre_quantize_staging_device.py (filtered device + explicit cuda:N index).

Tests

pytest tests/test_pre_quantize_staging_device.py tests/test_staged_gsq_blas_pin.py -q
# passed
ruff check gptqmodel/models/base.py tests/test_pre_quantize_staging_device.py   # clean

The 2-GPU OOM repro from the issue was not run (shared box); the fix is asserted at the device-selection boundary.

Fixes #4233

Model Support / Module Plan

N/A — no new model types or registry entries.

Verification environment

No compiled GPTQModel extensions are built in this environment (Machete/Marlin/QQQ-CUDA unavailable), so hardware-specific paths are called out explicitly above. The 19 fix branches from this sprint merge cleanly into one integration branch; the combined run was 195 passed, 2 skipped, ruff check clean.

@Qubitium
Qubitium merged commit 5149b1a into main Nov 16, 2026
8 of 9 checks passed
@Qubitium
Qubitium deleted the pr/4233 branch November 16, 2026 06:17
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.

[BUG][multi-GPU] Closed #3826 partly reproduces: pre_quantize stages every layer on device 0 when only cuda:1 is allowed, and OOMs if GPU 0 is full

1 participant