Repository navigation
fix(exl3): route wide activations through Torch - #3731
Merged
Merged
Conversation
This was referenced Nov 9, 2026
Qubitium
added a commit
that referenced
this pull request
Nov 11, 2026
… path (#3764) Two pre-existing failures on `f68935b61` were stale test contracts, not regressions from the CPU fusion work. QQQ oracle double-rounded the bias. `test_qqq_cpu.oracle` narrowed `accum * scale * channels` to the activation dtype and then added the bias, while the kernel (qqq.py:722, per #3753) keeps the INT8 reduction and its scales in FP32, adds the bias there, and rounds once. On `test_qqq_bias_noncontiguous_and_empty` the double round disagreed on 446/1792 elements by one visible step (<= 0.0039). Bias is now added in FP32 before the single narrowing cast, which makes the oracle match the module bitwise for both float16 and bfloat16. EXL3 audit test pinned a path deleted by #3731. #3717 asserted wide inputs reached the native kernel with FP32 input/output; #3731 (`86a59903e`) routed non-FP16 activations through `ExllamaV3TorchLinear`, whose inner takes only `x` and upcasts to FP32 internally. The stale stub therefore raised `TypeError: forward() missing 1 required positional argument`. The test now pins the live dispatch: wide inputs reach the Torch inner with the caller dtype and never touch `_ensure_inner`, FP16 keeps the native FP16 kernel with an explicit `out_dtype`, and each half asserts the other path is not taken. Added an end-to-end case where 1e10/1e-10 straddle the FP16 range so an FP16-first path would yield inf/0; the module stays finite and within 2e-3 relative L2 of the FP64 oracle. Verified on f68935b (AVX512-BF16 host, torch 2.15.0+cu132): - test_kernel_audit_regressions + test_qqq_cpu: 67 passed - the four exl3/qqq suites: 143 passed, 5 skipped - tests/module_tree fusion/fusable/module_plan: 728 passed, 633 skipped - test_torch_cpu_avx512(+_awq): 87 passed - 12-layout fusion sweep: all exact, err=0.0e+00
This was referenced Nov 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
BF16 and FP32 EXL3 activations reached native kernels that require FP16.
Fix
Route wide activations through the existing bounded Torch reconstruction path while keeping FP16 on the native kernel.
Validation
python -m pytest tests/test_exl3_wide_input.py -qGPU or MLX-only cases remain platform-gated on hosts without that runtime.