[Kernel] SM120: stop routing misaligned-M blockwise FP8 GEMMs to the small-M swapAB config - #52775
Merged
ZJY0516 merged 1 commit intoAug 19, 2026
Conversation
…small-M swapAB config The SM120 blockwise FP8 GEMM dispatch routed every M%4!=0 call to the swapAB TILE_N=32 config, which vllm-project#38325 added as a small-M/decode optimization. V1 chunked prefill produces misaligned M at prefill scale whenever a mixed batch carries a decode count that is not a multiple of 4, so most prefill-scale GEMM time (82% of instances in a C32 8K/1K capture) ran on a config that is 1.3x-2.0x slower from M~128 up. Force-routed measurements over an M x N x alignment matrix on an NVIDIA RTX PRO 6000 Blackwell Server Edition show swapAB only wins at M<=~80, and both paths produce bit-identical outputs at every measured misaligned point, so the M%4 clause has no correctness role on SM120. Restrict swapAB to M<=64. M=8193 N=34816 K=5120 microbenchmark: 7.89 ms -> 4.12 ms; C32 8K/1K serving: 424.6 -> 499.8 tok/s (+17.7%). Signed-off-by: Zihua Wu <13583761+lucifer1004@users.noreply.github.com>
ZJY0516
approved these changes
Aug 18, 2026
|
✅ @lucifer1004, CI is now available for this PR.
|
Member
|
/ci run |
|
✅ Triggered Buildkite CI #84406 for commit |
ZJY0516
approved these changes
Aug 19, 2026
zyp2014
pushed a commit
to zyp2014/vllm
that referenced
this pull request
Aug 21, 2026
…small-M swapAB config (vllm-project#52775) Signed-off-by: Zihua Wu <13583761+lucifer1004@users.noreply.github.com>
wyettzeng
pushed a commit
to wyettzeng/vllm
that referenced
this pull request
Aug 21, 2026
…small-M swapAB config (vllm-project#52775) Signed-off-by: Zihua Wu <13583761+lucifer1004@users.noreply.github.com> Signed-off-by: Wyett <wyettzeng@gmail.com>
zufangzhu
pushed a commit
to zufangzhu/vllm
that referenced
this pull request
Aug 24, 2026
…small-M swapAB config (vllm-project#52775) Signed-off-by: Zihua Wu <13583761+lucifer1004@users.noreply.github.com> Signed-off-by: Zhu, Zufang <zufang.zhu@intel.com>
khushali9
pushed a commit
to khushali9/vllm
that referenced
this pull request
Aug 29, 2026
…small-M swapAB config (vllm-project#52775) Signed-off-by: Zihua Wu <13583761+lucifer1004@users.noreply.github.com> Signed-off-by: khushali9 <khushali.desai9@gmail.com>
am-cohere
pushed a commit
to am-cohere/vllm
that referenced
this pull request
Sep 1, 2026
…small-M swapAB config (vllm-project#52775) Signed-off-by: Zihua Wu <13583761+lucifer1004@users.noreply.github.com>
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.
Purpose
The SM120 blockwise FP8 GEMM dispatch routes every call with
M % 4 != 0to theswapAB config (TILE_N=32), which was added in #38325 as a small-M/decode optimization:
Under V1 chunked prefill, mixed prefill+decode batches routinely make M misaligned at
prefill scale (M ~ 8k). In an Nsight Systems capture of Qwen3.8-27B-FP8 (a dense 27B
hybrid linear-attention model: 64 layers, 3:1 gated-delta-net to full attention, FP8
e4m3 blockwise) serving 8192/1024-token requests at concurrency 32 on an NVIDIA RTX PRO
6000 Blackwell Server Edition (SM120), 82% of prefill-scale blockwise GEMM
instances (14400/17523) went through the swapAB path, where they averaged 4.84 ms vs
3.10 ms on the default 128x128x128 config. The misroute roughly doubled prefill GEMM
time end-to-end.
Force-routing both paths over a dense M x N x alignment matrix (M = 48..8192 including
M%4 in {0,1,2}, N in {5120, 15360, 34816}, K = 5120) shows:
misaligned point, so the
M % 4 != 0clause has no correctness role on SM120.The fix restricts swapAB to its design regime:
Note:
scaled_mm_blockwise_sm90_fp8_dispatch.cuh((a.size(0) % 4) != 0) andscaled_mm_blockwise_sm100_fp8_dispatch.cuh((m < 16) || (m % 4 != 0)) carry the samemisaligned-M clause. They are untouched here because the measurements above are
SM120-only; the same recheck may be worthwhile on those targets.
Test Plan
torch.ops._C.cutlass_scaled_mmacross an M x N x alignmentmatrix with both kernel paths force-routed (temporary env-var instrumentation, not
included in this PR), comparing per-path latency and bitwise outputs.
concurrency 32, NVIDIA RTX PRO 6000 Blackwell Server Edition, Qwen3.8-27B-FP8.
Test Result
Microbenchmark (N=34816, K=5120):
Outputs at M=8193/8225 are bit-identical before and after.
End-to-end (concurrency 32, 8K/1K):
The patched build reaches parity with an SGLang baseline of the same model, shapes, and
hardware (501.2 tok/s), closing what was previously an ~18% gap that traced back to this
misroute.