Skip to content

[BUG] GPTQ Hessian-inverse CPU fallback only triggers on errors whose text contains "out of memory"; HIPSOLVER/CUSOLVER_STATUS_ALLOC_FAILED aborts the whole run #4350

Closed

Description

@Qubitium

Severity: low–medium. Status: one crash observed on a Radeon AI PRO R9700; the gap itself is from reading the code and could not be triggered on demand.

Where

gptqmodel/quantization/gptq.py:2430-2432 re-raises any RuntimeError unless "out of memory" in str(exc). The similar handlers at :2351 and :2387 use the same text match.

What happened

  • Run: Llama-3.2-1B-Instruct GPTQ, 512 samples, PYTHON_GIL=0, 2 GPUs, with other GPU work on the host.
  • Error: RuntimeError: hipsolver error: HIPSOLVER_STATUS_ALLOC_FAILED, when calling hipsolverDnSpotrs(...).
  • Call chain: hessian_inverse → inverse_factor (gptq.py:1865, torch.cholesky_inverse(out=)) → _compute_shared_inverse (:2419).
  • Effect: the message does not contain "out of memory", so the existing CPU fallback was skipped and quantization died. The identical run passed on retry.

Expected

Treat solver allocation failures (HIPSOLVER_STATUS_ALLOC_FAILED, CUSOLVER_STATUS_ALLOC_FAILED, and torch.OutOfMemoryError subclasses) like OOM, and fall back to CPU.


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.

Activity

  1. added
    bug
    on Nov 16, 2026
  2. Qubitium commented on Nov 16, 2026

    @Qubitium
    CollaboratorAuthor

    Claimed. This issue is now owned by a dedicated worker; a fix PR referencing it will follow. Please avoid duplicating work on it in the meantime.

  3. Qubitium commented on Nov 16, 2026

    @Qubitium
    CollaboratorAuthor

    Round-12 follow-up at def6e61 (Radeon AI PRO R9700): def6e61 covers only the GPTQ Hessian inverse. Two other call sites still abort the run on allocation failure. Both happened in real runs on a memory-loaded GPU, but neither can be triggered on demand.

    1. VPTQ: quantization/vptq.py:655-670. _inverse_hessian_cholesky has no allocation-failure handling.
      • torch.cholesky_inverse (:669) raised RuntimeError: hipsolver error: HIPSOLVER_STATUS_ALLOC_FAILED ... hipsolverDnDpotrs, and the Qwen3-0.6B VPTQ run died.
      • :662-667 re-raises any RuntimeError from linalg.cholesky, including OOM and allocation failures, as "Hessian is not positive definite". That message misleads the user.
    2. GPTQ GAR: quantization/gptq.py:2810 → gar.py:174. invert_perm(final_perm) runs on the GPU outside any OOM guard.
      • In a 1-layer Qwen3-30B-A3B MoE run, four expert Hessian inverses had already fallen back to CPU cleanly.
      • Then torch.AcceleratorError: CUDA error: out of memory (hipErrorOutOfMemory) at invert_perm killed the run.
      • _is_memory_allocation_failure would match this error, but the call site is never wrapped.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions