Repository navigation
fix(paro): make the dense/split-K prefill crossover shape-aware (#5210) - #5250
Merged
Merged
Conversation
Qubitium
marked this pull request as ready for review
November 18, 2026 14:22
This was referenced Nov 18, 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.
Fixes #5210.
Root cause
#5164 replaced the native split-K AWQ GEMM with dequantize + cuBLAS above one
global row constant (
640) tuned only on Qwen2.5-0.5B shapes, so every641-2000-row prefill on 7-8B projections paid a full-weight dequantize that
does not amortize until ~1500-2500 rows.
Fix
ParoLinearnow resolves a shape-aware crossover once per layer:The 2048-row floor keeps the whole 641-2000 band on the native kernel. The
4096-row ceiling keeps #5096's wide-prefill escape for every shape. The
decision is host-side and deterministic; no device probe or timing at runtime.
flowchart LR subgraph before["#5164 (current)"] A1{"rows > 640?"} A1 -- "yes" --> B1["dequantize + cuBLAS"] A1 -- "no" --> C1["native split-K AWQ GEMM"] end subgraph after["#5210 fix"] A2{"rows >= paro_awq_dense_min_rows(K, N)?"} A2 -- "yes" --> B2["dequantize + cuBLAS"] A2 -- "no" --> C2["native split-K AWQ GEMM"] end classDef dense fill:#e8f4ff,stroke:#36c,color:#111 class B1,B2 denseBefore / after (per layer, FP16, sm_120)
Synthetic
ParoLinear(bits 4, g128, bias), interleaved round-robin, min ofsix blocks of ten calls, one process.
current= #5164>640;new= this change. Ratio is against the pre-#5164 always-native route.BF16 is within 2% of FP16 on every shape and M. The
down_projpeakregression is gone in the band: 14336/4096 at 641 rows is 50 MiB on old and
new, against 154 MiB for
current.End-to-end equivalent (16-layer Llama-3.2-1B-shaped Paro stack, FP16)
Hidden 2048, intermediate 8192, GQA 32/8 x 64, real
ParoLinearlayers,identity rotation (constant across modes), one prefill, modes interleaved.
Tests
tests/kernels/test_paro.py: 62 passed, 1 skipped (full file).test_paro_prewarm_rotation_extension_skips_unsupported_configsisorder-polluted when the whole family shares one process (the extension is
already cached) and passes alone.
test_paro_dense_crossover_is_shape_aware(pure logic) andtest_paro_cuda_dense_dispatch_uses_the_shape_aware_crossover(4096x4096:641/2048 native, 2400 dense).
uvx [email protected] check gptqmodel docs/eora tests setup.py: clean.Not verified
assigned. The fit is conservative against the issue's sm_89 crossovers
(delays the dense win, never selects it before the crossover).
e2e check uses a same-shape 16-layer Paro stack.