Skip to content

fix(gptaq,foem): CPU fallback around the accelerator Hessian inverse (#4604) - #4618

Merged
Qubitium merged 1 commit into
mainfrom
fix/gptaq-foem-oom-fallback-4604
Nov 17, 2026
Merged

Qubitium merged 1 commit into
mainfrom
fix/gptaq-foem-oom-fallback-4604

Conversation

@Qubitium

Copy link
Copy Markdown
Collaborator

Summary

Fixes #4604 (#4350/#4400 incomplete). GPTAQ and FOEM re-implement the block pass but called hessian_inverse (and GPTAQ's native-delta product) without GPTQ's allocation guard, so a cuSOLVER/hipSOLVER workspace OOM aborted a run GPTQ would have finished on CPU.

  • Extracted GPTQ's retry into _run_with_accelerator_oom_cpu_fallback(compute, source_device, stage, prepare_cpu).
  • GPTAQ/FOEM now use it: on a CUDA allocation failure, prepare_cpu moves the Hessian, weight, native delta, act-order permutations, global_perm/final_perm, static-group quantizers and scale/zero to the host, the inverse (and GPTAQ delta product) reruns entirely on CPU, and the final Q is moved back to the module device.
  • Handles desc_act, act_group_aware and static_groups combinations, including the ungrouped desc_act measurement rebuild.

Validation

  • New tests/test_gptaq_foem_oom_fallback_4604.py → 20 passed (forced OOM → CPU retry completes; Q/g_idx bitwise equal to a host reference; results back on device; both GPTAQ and FOEM, all ordering modes)
  • ruff check gptqmodel docs/eora tests setup.py clean

Residual: the fallback is exercised with a forced OOM; no real solver-workspace exhaustion was reproduced.

Resolves #4604.

…4604)

GPTAQ and FOEM re-implemented the block pass but called hessian_inverse
without GPTQ's allocation guard, so a cuSOLVER/hipSOLVER workspace OOM
aborted the run. Share GPTQ's retry helper: move the Hessian, weight,
native delta, act-order permutations and static-group quantizers to the
host, rerun the inverse (and GPTAQ's native-delta product), then move the
result back to the module device.
@Qubitium
Qubitium merged commit ce1329b into main Nov 17, 2026
9 checks passed
@Qubitium
Qubitium deleted the fix/gptaq-foem-oom-fallback-4604 branch November 17, 2026 02:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant