You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] EXL3 had_r_128 launches a zero-row grid on M=0 inputs (always taken on ROCm); M=0 fix in cbf5994 incomplete #4550
Problem:cbf5994 added zero-batch early returns to the gptqmodel_ext/hadamard bindings and to NF12. In the same commit it hardened EXL3's had_r_128/had_r_128_dual (contiguity checks, 64-bit row offsets) but did not add the zero-row return. With rows == 0, had_r_128 launches gridDim(0, cols/128). The runtime rejects that launch configuration, and cuda_check(cudaPeekAtLastError()) raises.
ExllamaV3Linear.forward(x with 0 rows) -> LinearEXL3.forward
--torch_mode (always on ROCm; params['reconstruct'] on CUDA)--> ext.had_r_128(x[0, K], ...)
-> gridDim(rows=0, blocks) launch -> invalid configuration -> cuda_check raises
Trigger / repro: An EXL3 layer forward with an empty activation on ROCm, where LinearEXL3.forward always sets torch_mode = True when torch.version.hip is set. On CUDA it is reached only when reconstruct is forced; the default bc_linear_exl3_run path handles size_m=0. Neither ExllamaV3Linear.forward nor LinearEXL3.forward checks numel() == 0.
Expected: An empty (0, out_features) result, the contract cbf5994 set for the other Hadamard paths.
Actual (from code reading): The kernel launch fails and an exception is raised. tests/test_hadamard_empty_input.py covers only the gptqmodel_ext/hadamard ops, not EXL3's had_r_128.
Impact: ROCm EXL3 inference raises on zero-row inputs instead of returning an empty tensor. Whether real callers send zero-row activations (for example MoE expert loops that do not skip empty experts) is an assumption and was not reproduced.
Fix:
In had_r_128 and had_r_128_dual, return right after the shape checks when input.size(0) == 0.
Optionally, return the empty y early in LinearEXL3.forward when x.shape[0] == 0.
Extend tests/test_hadamard_empty_input.py with an EXL3 had_r_128 / ROCm torch_mode zero-row case.
Validation status: not validated. Static analysis only. Validation needs ROCm hardware (or CUDA with reconstruct forced) and a built exllamav3 extension, and neither was available.
Activity
Qubitium commentedon Nov 17, 2026
Claimed. This issue is now owned by a dedicated worker; a fix PR referencing it will follow.
fix(exl3): skip zero-row hadamard launches (#4550) (#4587)