Repository navigation
Description
Found on main @ e75181d, RTX 4090 (sm_89), torch 2.15 + CUDA 13.2, Triton 3.9.
What is wrong
Both ParoQuant GPU kernels fault with an illegal memory access once a forward produces more than 2^31 output elements (rows x out_features). The failure is exact at the 32-bit boundary and kills the CUDA context. Every other kernel I ran on the same layer, the same M and the same Qwen2.5-0.5B checkpoints passes: GGUF Triton/Torch/CPP-CUDA, FP8, BnB4, QQQ, MACaQ, VPTQ, NF12, W4AFP8 and EXL3.
ParoLinear(PARO_CUDA, the CUDA AUTO pick):paro.py:794_forward_cuda_awq_kernelalways calls the native AWQ GEMM_awq_cuda_gemm_forward, which stores throughrow_offset * OCin 32-bitint(gptqmodel_ext/awq/quantization/gemm_cuda_gen.cu:396and:536).AwqGEMMLinearnever reaches that overflow, because it switches to dequantize + matmul above 1024 rows (gemm_awq.py:125). Paro has no such row cap, so a long prefill hits the native kernel. This is the same 32-bit store class as [BUG] AWQ GEMV (gemmv2, rows>8) and GEMV_FAST prefill CUDA kernels index the output with 32-bit int: illegal memory access once rows x out_features > 2^31 (long-context prefill) #5091 (AWQ GEMV), reached through a different entry point.ParoTritonLinear(PARO_TRITON, the ROCm AUTO pick since fix(paro): pick the native Triton kernel on ROCm AUTO and make the dense fallback graph-capturable (#4914) #5053):gptqmodel/quantization/paro/modules/triton/gemm.py:310,c_ptrs = c_ptr + N * offs_cm[:, None] + offs_cn[None, :].offs_cmis int32, so the offset wraps. This is the same pattern [BUG] Kernels: non-contiguous input wrong/crash (BitBLAS, EXL3, ParoQuant), GGUF multi-GPU crash + current-device leak + stream race, int32 overflow, Hadamard M=0 crash, per-M Triton recompiles #4042 fixed in the other Triton kernels with.to(tl.int64).
The table uses layer 0 mlp.up_proj (K=896, N=4864) of a ParoQuant 4-bit Qwen2.5-0.5B-Instruct checkpoint. Each row checks sampled output rows against the same kernel at small M.
| kernel | dtype | M = 441285 (M*N = 0.9997 x 2^31) | M = 441727 (1.0005 x 2^31) |
|---|---|---|---|
| ParoLinear (PARO_CUDA) | fp16 | OK, bitwise | CUDA error: an illegal memory access |
| ParoLinear (PARO_CUDA) | bf16 | OK | illegal memory access |
| ParoTritonLinear | fp16 | OK | Triton Error [CUDA]: an illegal memory access |
| ParoTritonLinear | bf16 | OK | illegal memory access |
Traceback, with CUDA_LAUNCH_BLOCKING=1:
paro.py:979 forward -> paro.py:794 _forward_cuda_awq_kernel -> gemm_awq.py:35 _awq_cuda_gemm_forward
-> utils/awq.py:145 awq_gemm_forward -> torch.AcceleratorError: CUDA error: an illegal memory access was encountered
paro_triton.py:218 _run_plan -> :195 _forward_triton_prefill -> paro/modules/triton/gemm.py:494 -> :432 _paro_gemm_triton
-> RuntimeError: Triton Error [CUDA]: an illegal memory access was encountered
Repro
import torch
from gptqmodel import GPTQModel, BACKEND
m = GPTQModel.load("<ParoQuant 4-bit Qwen2.5-0.5B-Instruct>", backend=BACKEND.PARO_CUDA, dtype=torch.float16, device="cuda:0")
lin = m.model.model.layers[0].mlp.up_proj # K=896, N=4864
for M in (441285, 441727): # M*N just below / just above 2**31
x = torch.randn(M, 896, device="cuda", dtype=torch.float16)
with torch.inference_mode():
y = lin(x); torch.cuda.synchronize() # second one: illegal memory accessThe same repro with BACKEND.PARO_TRITON triggers the Triton error. A real long-context prefill reaches this size too: one 128K-token sequence through an MLP projection wider than 16384 needs no batching at all.
Suggested fix
- ParoLinear: reuse
AwqGEMMLinear's dispatch, which dequantizes and calls cuBLAS above 1024 rows (also the faster choice for large M), or chunk M. Independently, make the native AWQ GEMM store offsets 64-bit (static_cast<int64_t>(row_offset) * OC). That fixes every caller ofawq_gemm_forward. - ParoTriton: compute
offs_cm.to(tl.int64) * N(and the A-side row offsets the same way) in_paro_gemm_triton.
Tests that should have caught it
There is no large-shape case for the Paro kernels. The #4042 sweep covered only the Triton kernels that existed at the time. A guarded test with rows x N just above 2^31 and small K is cheap: about 1 GB in and 4 GB out.
Severity
Medium. It is a hard crash that takes down the process's CUDA context on a supported long prefill, including on the ROCm AUTO path.
🤖 Generated with Claude Code
Activity
Qubitium commentedon Nov 18, 2026
Additional data for item 1 (
ParoLinearhas no row cap, so every long prefill uses the native split-K AWQ GEMM). Well below the 2^31 crash, the same missing dispatch already costs a lot of VRAM and time on the default CUDA AUTO Paro path. TheAwqGEMMLinear-style dispatch suggested above (rotate, dequantize, cuBLAS above 1024 rows) would fix this too.Found on
main@ 7b8f127, RTX 5090 (sm_120), torch 2.15 + CUDA 13.2. ParoQuant 4-bit Qwen2.5-0.5B-Instruct (g128), fp16. AUTO resolves toParoLinear. The "dense" column is the same module emulating the >1024-row dispatch:m._rotate_inputs(x) @ m._dequantize_weight_for_inference(xr, fp16). Its rel diff vs the native output is 2e-5 to 5e-5. Times are CUDA-event medians on a GPU that other jobs were also using; the peaks are exact.ParoLinearms / peak extra MiBParoTritonLinearms / peakAt M=32000, gate_proj peaks at 2727 MiB for a 297 MiB output. That matches the fp32 split-K partial buffer:
_PARO_AWQ_SPLIT_K = 4x 32000 x 4864 x 4 B = 2.37 GiB. The call is also 3.6x slower than dequantize + cuBLAS.Whole-model prefill (
model(input_ids, use_cache=False, logits_to_keep=1)), same checkpoint:ParoLinear) ms / peak MiBPARO_TRITONms / peak MiBSo the default CUDA Paro kernel needs 2.2x the prefill VRAM of the Triton kernel, and it is slower at every length. A real 16k-32k prompt reaches this through
generate(). The 32k peak goes from 1.8 GiB withPARO_TRITONto 3.5 GiB with AUTO, as a separate 16k/32k long-context comparison also showed. Logits agree between the two backends (prefill rel 2.4e-3, top1 0.996).Repro (module level):
🤖 Generated with Claude Code
ZX-ModelCloud commentedon Nov 18, 2026
Agent claim:
agent-81fd1440b5e3is working on this issue now.Started 2026-11-18T06:11:56Z. The claim expires 4.0h after this comment was last edited (heartbeat). Other agents: do not start this issue while the claim is live.
Reproducing the ParoQuant 32-bit output-offset crash above 2^31 elements, then fixing the AWQ GEMM store and Triton offsets
fix(paro): address wide-prefill offsets and dispatch long prefills to…
fix(paro): address wide-prefill offsets and dispatch long prefills to…