Repository navigation
test(exl3): route the #4793 inner-handle burst back through the native stub (#4895) - #4924
Merged
Merged
Conversation
…e stub (#4895) tests/test_exllamav3_inner_handle_4793.py built its trellis on CPU. Since #4835 (fa91047), forward() sends every non-CUDA trellis to _ensure_torch_inner(), so the burst never reached _ensure_inner() and the stubbed native handle was never built. It failed on the fake 2x2x16 trellis with "storage differs from logical dimensions or 128-channel padding" instead of guarding the #4793 handle race. Build the trellis on CUDA, where _needs_torch_fallback() is false, and skip the file without CUDA so a CPU-only host does not silently test the portable path. Assert that the stubbed LinearEXL3 served every forward and that no torch inner was built, so a future routing change fails loudly instead of quietly losing the #4793 regression guard. Red on origin/main: 2 failed. Green: 2 passed.
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.
Summary
tests/test_exllamav3_inner_handle_4793.py, the #4793 regression test from #4803, has been red onmainsince #4835 (fa91047ef). The test built its trellis on CPU;ExllamaV3Linear._needs_torch_fallback()(added by #4835) routes any non-CUDA trellis to_ensure_torch_inner(), so the burst never reached_ensure_inner(), built a realExllamaV3TorchLinearfrom the fake 2x2x16 trellis, and died inexllamav3_torch.py:That was worse than a plain red test: the #4793 handle-publication race lost its guard, because the stubbed native handle was never exercised. This PR restores the original coverage with the smallest change and makes a future routing drift fail loudly.
What Changed
_needs_torch_fallback()isFalse, soforward()goes through_ensure_inner()again.pytest.mark.skipiffor hosts without CUDA, naming the portable fallback in the reason, so a CPU-only host skips instead of silently testing another path.LinearEXL3.forwardand assert that every forward was served by the native stub (THREADSper burst) and thatmodule._torch_inner is Nonein both tests. A future routing change now fails on the assertion instead of quietly losing the [BUG][GIL=0] ExllamaV3Linear: concurrent first forward races in unlocked _ensure_inner(): another thread's _drop_inner() nulls the handle -> AttributeError 'NoneType' object has no attribute 'forward' (111/4480 cold calls) #4793 guard.monkeypatch.Tests
The 19 sweep failures all reproduce on
origin/mainwithout this change and are unrelated to it:14 in
tests/kernels/test_exllamav3_kernel.py:AttributeError: 'object' object has no attribute 'wait_stream'atexl3_lib/quantize.py:1460, caused by pre-existing test pollution.tests/test_exl3_workspace.pyreplacesimplementation.get_quant_streamat module import and caches a stubobject()stream in the module's_quant_streams; any later quantization in the same process picks it up.test_exl3_workspace.pyfollowed by the kernel file is15 failed, 13 passedon a cleanorigin/main(5a13ec2) worktree without this PR. The kernel file alone is21 passed, 1 failed(the one failure is the 8 GiB allocation below).1
tests/kernels/test_exllamav3_kernel.py::test_exllamav3_hadamard_addresses_rows_past_two_to_the_32_elements: 8 GiB allocation with ~2.7 GiB free on the shared GPU.2
tests/test_exl3_auto_nf12_recovery.py: subprocess import failure in this venv (kernels.CUDAProperties/flash_attn_2_cudasymbol mismatch), environment-only.1
tests/test_exl3_projection_resume.py:_Capturetest stub lacks_release_deferred_hessian_sources, added to production code by perf(exl3): tile Hessian symmetrization and release the capture partial (#4818) #4837; stale test double.1
tests/test_exl3_workspace.py::test_concurrent_quantize_shares_one_stream_and_scratch_per_device: CUDA OOM; the assigned GPU was ~92% held by another process on this shared host.Unit tests have been executed and passed, or the reason they are not applicable is documented.
I added a new simple/fast unit test for this change, or documented why that is not applicable.
Lint:
ruff check tests/test_exllamav3_inner_handle_4793.py-> All checks passed.Model Support / Module Plan
Not applicable: test-only change; no
MODEL_MAP, alias, definition, fusion or AWQ grouping change.Logic Flow Documentation
Not applicable: no control flow, resolution order or tensor lifecycle change. The test now pins the existing
forward() -> _ensure_inner()branch (gptqmodel/nn_modules/exllamav3.py:420-430) instead of drifting into_ensure_torch_inner().Review Requirements
I or an AI agent (such as Codex or Claude) have:
Kernel Accuracy Requirements
LinearEXL3constructor remains stubbed; only the test's routing assertion is new.Notes
The test keeps the #4793 semantics: a cold-start burst publishes exactly one handle, and repeated
clear_weight_cache()then burst never returnsNone. A real-kernel variant on a 1B EXL3 checkpoint is intentionally out of scope here (the issue notes ~20 s per burst); this stubbed-native guard is the fast regression test for the Python handle publication.