Repository navigation
Description
Found on main @ 4b65923, AMD Radeon AI PRO R9700 (gfx1201, ROCm 10.1, torch 2.16.0.dev+rocm10.1).
What is wrong
Calibrated FP8 GSQ (FP8Config(gsq=GSQConfig(enabled=True), gsq_calibration=True)) aborts in layer 0 on ROCm:
File "gptqmodel/looper/fp8_gsq_processor.py", line 111, in process
result = task.quantize()
File "gptqmodel/quantization/gsq_fp8_task.py", line 59, in quantize
result = refine_fp8_weight(...)
File "gptqmodel/quantization/gsq_fp8.py", line 126, in refine_fp8_weight
raise ValueError('FP8 GSQ Hessian must be symmetric')
Two pieces of code interact:
GSQInputGram.add(gptqmodel/quantization/gsq_calibration.py:56) builds the Gram as a general GEMM,values.T @ values.refine_fp8_weight(gsq_fp8.py:125) then requirestorch.allclose(H, H.T, rtol=1e-5, atol=1e-7).
A GEMM does not guarantee that C[i,j] and C[j,i] are reduced in the same order. On gfx1201, rocBLAS (the backend this method is pinned to, see _DETERMINISTIC_BLAS_PROCESSOR_STEPS) and hipBLASLt both return a Gram that is not bitwise symmetric. The leftover asymmetry is normal fp32 rounding, about 1e-7 relative to max|G|. But atol=1e-7 is absolute, and the off-diagonal entries are near zero next to diagonals of 1e4-1e6, so the check fails for most modules. In the run below, only q/k/v of layer 0 passed (they share an 896-wide input). o_proj failed and the whole quantization aborted.
docs/rocm-default-environment.md lists "FP8 GSQ | fp32 input Gram" among the ROCm-supported Hessian methods. In practice it cannot complete on ROCm. The only test (tests/test_gsq_method_adapters.py, fp8_calibrated) runs on CPU, where the GEMM happens to be symmetric.
Repro
The BLAS behaviour alone:
import torch
torch.manual_seed(0)
for lib in ("hipblas", "hipblaslt"):
torch.backends.cuda.preferred_blas_library(lib)
for n, c in ((906, 896), (62767, 896), (8192, 4864)):
x = torch.randn(n, c, device="cuda") * 3
g = x.T @ x
print(lib, n, c, torch.equal(g, g.T), torch.allclose(g, g.T, rtol=1e-5, atol=1e-7),
"%.2e" % (g - g.T).abs().max().item(), "%.2e" % g.abs().max().item())hipblas 906 896 False False 1.83e-03 9.43e+03
hipblas 62767 896 False False 5.42e-02 5.78e+05
hipblas 8192 4864 False False 2.37e-02 7.78e+04
hipblaslt 906 896 False False 1.83e-03 9.39e+03
hipblaslt 62767 896 False False 7.03e-02 5.77e+05
hipblaslt 8192 4864 False False 2.22e-02 7.78e+04
End to end (Qwen2.5-0.5B-Instruct, fp16, 128 C4 rows):
from gptqmodel import GPTQModel
from gptqmodel.quantization import config as C
cfg = C.FP8Config(gsq=C.GSQConfig(enabled=True, steps=20), gsq_calibration=True)
m = GPTQModel.load("Qwen/Qwen2.5-0.5B-Instruct", cfg, dtype=torch.float16)
m.quantize(calib)-> ValueError: FP8 GSQ Hessian must be symmetric. It fails the same way in two separate processes, every time.
The same run with GSQInputGram.take() monkeypatched to return (G + G.T) / 2 gets past the check and keeps quantizing (layer 11 of 24 within the same wall time, no error).
Suggested fix
Symmetrize the Gram where it is built or consumed: self._gram = 0.5 * (updated + updated.T) in take(), or hessian = 0.5 * (hessian + hessian.T) before use. Keep the validation only as a sanity check with a scale-aware tolerance, for example (H - H.T).abs().max() <= 1e-5 * H.abs().max(). A cleaner option is to accumulate with torch.addmm/syrk-style code that fills one triangle and mirrors it. Element-wise allclose with an absolute 1e-7 is not a valid symmetry test for an fp32 Gram summed over 10^4-10^5 tokens.
Test that should have caught it
test_gsq_method_adapters.py::...[fp8_calibrated] runs only on CPU. A GPU variant, or a unit test that feeds refine_fp8_weight a Gram with realistic rounding asymmetry, would have caught it.
Severity
High for the feature: calibrated FP8 GSQ never completes on ROCm. The input is valid, the rejection is spurious, and the run aborts after calibration has started.
🤖 Generated with Claude Code
Activity
Qubitium commentedon Nov 17, 2026
Claimed. This issue is now owned by a dedicated worker; a fix PR referencing it will follow.
fix(gsq): keep staged AWQ weights consistent across inference mode an…