Repository navigation
[Perf] diffusion: Hold a Qwen-Image-2.1 Q/K norm + RoPE row with a half-warp - #47465
Merged
Merged
Conversation
…lf-warp The fused Q/K RMSNorm + complex RoPE + K/V packing kernel gave each 128-wide row a full warp with 8-byte accesses and 64-bit work indices. A half-warp per row with 16-byte accesses, 32-bit indices and 128-thread blocks runs the production [1, 4096, 32, 128] launch in 37.1 us instead of 65.5 us on B300. Each lane now owns two of the reference's 4-element groups, so its shuffle tree is the same one at half the lane offsets plus one in-thread add: the output stays bit-identical to the eager chain. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.
Tip: disable this comment in your organization's Code Review settings.
mickqian
requested review from
BBuf,
HydraQYH,
celve and
yuan-luo
as code owners
October 30, 2026 11:23
This was referenced Oct 30, 2026
Collaborator
Author
|
/tag-and-rerun-ci |
Yuxingwang-intel
pushed a commit
to Yuxingwang-intel/sglang
that referenced
this pull request
Nov 6, 2026
…lf-warp (sgl-project#47465) Co-authored-by: Mick Qian <mickqian@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.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.
Motivation
On B300 the fused Q/K RMSNorm + complex RoPE + K/V packing kernel of Qwen-Image-2.1 took 89 us per launch inside a 1024x1024 request (1280 launches, ~114 ms of GPU time per request): one warp per 128-wide row, 8-byte accesses and 64-bit work indices kept it near 1.5 TB/s.
Modifications
Accuracy
Bit-identical.
torch.equalagainst main's kernel on the production pack shape ([1, 4096, 32, 128], 27-token prefix), the kept-buffer edit shape, copy-V, odd heads and the single-tensor entry point; the existing eager-reference tests pass (test_complex_rope.py+test_qwen_image21_cuda.py: 70 passed on B300). End to end, the decoded PNG pixels of every request match main (md5 of the RGBA array, T2I and edit, 6+ requests each).Benchmark (B300 SXM6, 1100 W, 1 GPU,
b200-1gpu-resident-faprofile)Kernel alone, [1, 4096, 32, 128] + 27-token prefix (CUDA events, 200 launches):
In a serving request (nsys): 89.4 -> 52.1 us per launch.
diffusion-bench-framework harness (
devbox_run_cases.sh, fresh server per arm, two rounds in reversed order, vLLM-Omni 0da1d831 on the same box):Combined with #47465, #47466 and #47467 (B300 harness, two rounds in reversed order)
final= main 15ef675 + the three PRs; vLLM-Omni 0da1d831 (blackwell-cudnn-static) on the same box; sglangb200-1gpu-resident-fa.--async-output-saveDecoded PNG pixels of every request match main (md5 of the RGBA array).
🤖 Generated with Claude Code
CI States
Latest PR Test (Base): ✅ Run #41068062426
Latest PR Test (Extra): ❌ Run #41068062357
Latest PR Test (AMD ROCm 10): ⏳ Run #41068062323