Repository navigation
fix(exl3): accept noncontiguous BF16 and FP32 activations - #3740
Merged
Merged
Conversation
Qubitium
force-pushed
the
codex/fix-exl3-wide-noncontiguous
branch
from
November 9, 2026 19:31
5599e36 to
b9b2003
Compare
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.
Summary
Merged #3731 already sends BF16/FP32 inputs from
ExllamaV3Linear.forwardto the bounded Torch FP32 reconstruction path. Both native GEMM branches require FP16 inputs. This follow-up fixes the remaining failure for noncontiguous wide activations:_forward_eagerusedviewto flatten leading dimensions, so transposed batches raised before inference.reshapefor the wide-input flattening; contiguous inputs still use a view.Dispatch flow
flowchart TD A["ExllamaV3Linear.forward(x)"] --> B{"x.dtype is float16?"} B -->|yes| C["_ensure_inner"] C --> D["LinearEXL3.forward"] D --> E{"rows greater than 32?"} E -->|no| F["bc.run: FP16 native GEMM"] E -->|yes| G["ext.hgemm: FP16 native GEMM"] B -->|no| H["_ensure_torch_inner"] H --> I["ExllamaV3TorchLinear._forward_eager"] I --> J["reshape rows; convert to FP32"] J --> K["_forward_chunked: packed trellis decode and FP32 matmul"] K --> L["add bias; cast to input dtype"] P["Direct native call with BF16 or FP32"] --> X["TORCH_CHECK_DTYPE rejects input"] classDef failure fill:#fdd,stroke:#b00,color:#700 class X failuregptqmodel/nn_modules/exllamav3_torch.py:548usedview, which fails for transposed leading dimensionsreshapepreserves logical row ordergptqmodel/nn_modules/exllamav3.py:294-306already sends BF16/FP32 to Torchgptqmodel_ext/exllamav3/quant/exl3_gemm.cu:52andgptqmodel_ext/exllamav3/hgemm.cu:32require FP16Validation
tests/test_exl3_wide_input.py tests/test_exllamav3_cpu.py tests/test_exllamav3_torch_padding.py: 146 passed, 56 skipped on CPU; this includes strict checkpoint reload and noncontiguous wide-input oracles./root/venv/bin/python -m pytest tests/test_exl3_wide_input.py tests/test_exllamav3_cpu.py -q --disable-warnings --log-cli-level=ERROR: 69 passed, 4 skipped in 22.01 s./root/venv/bin/python -m ruff check gptqmodel/nn_modules/exllamav3_torch.py tests/test_exl3_wide_input.py tests/test_exllamav3_cpu.py: passed.git diff HEAD^ HEAD --check: passed.Environment and scope
NVIDIA CUDA is unavailable on this runner, so the four CUDA oracle cases skipped; actual native extension execution was not measured. The CPU dispatch tests exercise the 32/33-row native branch logic with mocked extension calls. The old noncontiguous path raised, so there is no comparable pre-fix inference latency. No public compatibility layer or
hf_API was changed. No backward compatibility is retained except forhf_APIs.