Skip to content

fix(exl3): route wide activations through Torch - #3731

Merged
Qubitium merged 1 commit into
mainfrom
codex/fix-exl3-wide-input
Nov 9, 2026
Merged

Qubitium merged 1 commit into
mainfrom
codex/fix-exl3-wide-input

Conversation

@Qubitium

@Qubitium Qubitium commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

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 -q

GPU or MLX-only cases remain platform-gated on hosts without that runtime.

@Qubitium
Qubitium merged commit 86a5990 into main Nov 9, 2026
6 checks passed
@Qubitium
Qubitium deleted the codex/fix-exl3-wide-input branch November 9, 2026 17:53
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant