Repository navigation
Description
Found on main @ 7b8f127, RTX 4090 (torch 2.15.0+cu132) and AMD R9700 (ROCm, torch 2.16.0.dev rocm10.1).
What is wrong
#5070 (caa5bb13e, "make quantized CPU kernels torch-compilable") raised the class-wide SUPPORTS_COMPILE_LEVEL to INDUCTOR for TorchFusedLinear, TorchAtenLinear, TorchFusedAwqLinear, TorchAtenAwqLinear and GGUFTorchLinear. The other kernels in the same PR use SUPPORTS_COMPILE_LEVEL_BY_DEVICE = {"cpu": INDUCTOR}. Neither claim holds as declared:
- GGUFTorchLinear (
gptqmodel/nn_modules/qlinear/gguf.py:1222-1243). The comment right above the declaration still says that on CUDA "dynamo breaks ontensor.is_inference()intensor_cache_key, so only EAGER is reachable". The class nevertheless declares baseINDUCTOR, so the CUDA level now over-claims. CPU really does reachINDUCTOR, so the CPU-only override is the right shape. - int4pack kernels (GPTQ and AWQ, TorchFused and TorchAten).
INDUCTORis reached only for an fp16, bias-free layer. A bf16 activation, or any biased layer, goes through the@torch.compiler.disabled_cpu_int4pack_mm_cast(torch_fused.py:167) and graph-breaks on every linear. bf16 is the CPU AUTO dtype for these kernels (utils/model.py:2251-2253, "Auto dtype (CPU + Torch Fused): bfloat16"), so the default configuration never reaches the declared level.docs/kernel-compile-matrix.mdpublishesINDUCTOR / INDUCTORfor all of them.
Measured with the repo's own tests/kernels/compile_probe.probe on CPU (512x256, g128, 4 rows):
| kernel | fp16 no bias | bf16 no bias | fp16 bias | bf16 bias |
|---|---|---|---|---|
| TorchFusedLinear (GPTQ) | inductor | 1 break | 1 break | 1 break |
| TorchAtenLinear (GPTQ) | inductor | 1 break | 1 break | 1 break |
| TorchFusedAwqLinear | inductor | 1 break | 1 break | 1 break |
| TorchAtenAwqLinear | inductor | 1 break (fp32 also inductor) | 1 break | 1 break |
| GGUFTorchLinear (CPU) | inductor | inductor | inductor | inductor |
The break reason is always Skip calling `torch.compiler.disable()`d function _cpu_int4pack_mm_cast.
Consequence: three tests red on every GPU host since #5070
Bisected with the HEAD tests over 3867c82af..7b8f12785. The first bad commit is caa5bb13e (#5070) for all three. All three fail deterministically on CUDA and on ROCm (CPU-only runs skip them, see below):
FAILED tests/kernels/test_kernel_compile_levels_awq.py::test_awq_kernel_reaches_declared_compile_level[TorchFusedAwqLinear]
declared INDUCTOR but probe reported eager=True graph_breaks=1 ... max=EAGER errors={'dynamo': 'Unsupported: Skip calling `torch.compiler.disable()`d function ... _cpu_int4pack_mm_cast'
FAILED tests/kernels/test_kernel_compile_levels_awq.py::test_awq_kernel_reaches_declared_compile_level[TorchAtenAwqLinear] (same)
FAILED tests/kernels/test_kernel_compile_levels_quant.py::test_kernel_reaches_declared_compile_level[GGUFTorchLinear]
declared INDUCTOR but probe reported eager=True graph_breaks=2 ... errors={'dynamo': 'Unsupported: Encountered tensor.is_inference() during tracing ...'
Why CI did not catch it (coverage gap)
tests/kernels/compile_probe.py:251-274(skip_without_measurable_device) skips any kernel that declares>= INDUCTORwhen CUDA is unavailable. The AWQ case builds the module on CPU (_checkpoint(..., device="cpu")), so it needs no GPU at all. Yet raising the declaration toINDUCTORturned it into a skip on CPU-only CI, and it only runs, and fails, on a GPU host.- The new
tests/kernels/test_kernel_compile_levels_cpu.pyprobesTorchFusedLinear/TorchAtenLinearand the two AWQ int4pack kernels only in the single passing configuration: fp16 withbias=False(lines 285-298,DTYPE = torch.float16). It never probes bf16, the CPU AUTO dtype. So it confirms a level that the default load cannot reach.
Minimal repro (CPU only)
import torch
from tests.kernels.compile_probe import probe
from tests.kernels import test_kernel_compile_levels_cpu as C
from gptqmodel.nn_modules.qlinear.torch_fused import TorchFusedLinear
for bias in (False, True):
for dt in (torch.float16, torch.bfloat16):
torch._dynamo.reset()
m = C._pack_gptq(TorchFusedLinear, bias=bias).to(dt)
r = probe(m, (torch.randn(4, C.IN_FEATURES, dtype=dt),), check_cuda_graph=False)
print(bias, dt, r.graph_breaks, r.levels["inductor"])
# False torch.float16 0 True
# False torch.bfloat16 1 False
# True torch.float16 1 False
# True torch.bfloat16 1 FalseSuggested fix
GGUFTorchLinear: restore baseEAGER(as its own comment documents for CUDA) and declareSUPPORTS_COMPILE_LEVEL_BY_DEVICE = {"cpu": COMPILE_LEVEL.INDUCTOR}.- int4pack kernels: either make the cast path traceable (materialize the cast outside the extern op, or cast once at
post_initsoscales_and_zerosalready carries fp32 for bf16/biased layers), or declare the level that bf16 and biased layers actually reach (EAGER/DYNAMO) and document fp16 bias-free as the exception, not the rule. Then regeneratedocs/kernel-compile-matrix.md. - Tests: let
skip_without_measurable_deviceskip only cases that actually need CUDA, so CPU-built cases run on CPU CI. Also parametrizetest_kernel_compile_levels_cpuover bf16 and bias.
Severity: low/medium. There is no wrong output: the compiled path still runs, with a graph break per quantized linear. But the published capability matrix is wrong for the CPU default dtype, and three compile-level tests have been red on every GPU host since #5070.
🤖 Generated with Claude Code
Activity
Qubitium commentedon Nov 18, 2026
Agent claim:
agent-23b36fc8bb79is working on this issue now.Started 2026-11-18T05:25:25Z. The claim expires 4.0h after this comment was last edited (heartbeat). Other agents: do not start this issue while the claim is live.
Auditing the compile-level declarations and probe coverage on GB10 (sm_121, aarch64); will post a fix PR.
Qubitium commentedon Nov 18, 2026
Fix PR opened: #5139.
The declaration was wrong for two different reasons, and both are addressed:
gptqmodel::int4pack_mm_cast) with a FakeTensor impl instead of atorch.compiler.disabled Python helper. Eager math is unchanged (cast operands, call_weight_int4pack_mm_for_cpu, cast result), the casts live inside the op so [BUG] Follow-up on #4060/#4062: model.optimize() TypeError on all CPU AUTO kernels, torch.compile int4pack LoweringException for fp16+bias (regression) and bf16, max_memory still ignored with device="cuda:0" #4068 no longer forces a break, and all four kernels now trace with 0 graph breaks for fp16/bf16 x biased/bias-free with byte-identical output.EAGERwithSUPPORTS_COMPILE_LEVEL_BY_DEVICE = {"cpu": INDUCTOR}.Also fixed the coverage gap:
skip_without_measurable_deviceno longer skips a CPU-builtINDUCTORcase on a CPU-only runner, the AWQ case passes its build device, and the CPU level test now parametrizes the full int4pack dtype/bias matrix.docs/kernel-compile-matrix.mdregenerated.Measured on GB10 (sm_121, aarch64, torch 2.11.0+cu130): the three tests named in the issue pass;
test_kernel_compile_levels_cpu.py -k int4pack16 passed; protocol test 63 passed.fix(compile): make the int4pack cast path a traceable custom op (#5110)…
fix(paro): trace the biased CPU int4pack path after an eager warmup (#…