CUTLASS FP8 Blockwise GEMM improvement of SM120#20887
Merged
Conversation
Contributor
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
49 tasks
Collaborator
Author
|
I further attached some reports using NCU: Before (Cooperative Mainloop / 2-Stage) After (Pingpong Mainloop / 3-Stage) It can also be seen that the memory bandwidth increased by around 80%, for M = 16. Anyway, there is still a lot to improve in it's performance, but it should be an okay first step. |
BBuf
approved these changes
Mar 20, 2026
Collaborator
|
/tag-and-rerun-ci again |
OrangeRedeng
pushed a commit
to OrangeRedeng/sglang
that referenced
this pull request
Mar 22, 2026
5 tasks
0-693
pushed a commit
to 0-693/sglang
that referenced
this pull request
Mar 25, 2026
dutsc
pushed a commit
to dutsc/sglang
that referenced
this pull request
Mar 30, 2026
JustinTong0323
pushed a commit
to JustinTong0323/sglang
that referenced
this pull request
Apr 7, 2026
yhyang201
pushed a commit
to yhyang201/sglang
that referenced
this pull request
Apr 22, 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.
Motivation
The SM120 fp8 blockwise GEMM kernel was using
KernelScheduleAutoas the schedule, which on SM120 happens to select the cooperative kernel only. The single-kernel approach misses a performance opportunity, the pingpong schedule is about 2x faster than cooperative for small M. I adapted the example from the CUTLASS repo.Modifications
sgl-kernel/csrc/gemm/fp8_blockwise_gemm_kernel.cu:KernelScheduleAutowithKernelScheduleSm120Blockwisefor the cooperative path, when M > 64, to avoidthe specific CUTLASS issue (the refcheck output will explode in relative error, I'm not sure of the cause exactly, but it appears to be potentially a CUTLASS library issue)
KernelTmaWarpSpecializedBlockwisePingpongSm120with a 64x128x128 tile shape for M ≤ 64.m <= 64runtime check to pick between the two paths.Accuracy and UT
RTX 5090 (SM120) against Flashinfer across Qwen/Qwen3.5-27B-FP8 shapes at M from 1 to 512:
Performance (RTX 5090, N=1536, K=5120)
Profiles:
E2E Accuracy:
Before:
{'score:std': np.float64(0.07053367989832945), 'scores': ['0.995', '0.975', '0.980', '0.990', '0.995'], 'mean_score': np.float64(0.9870000000000001)}After:
{'score:std': np.float64(0.12155245781143219), 'scores': ['0.990', '0.985', '0.995', '0.995', '0.985'], 'mean_score': np.float64(0.99)}BS = 1 speed:
Before:

(It will use the cooperative schedule)
After:

(I only zoom in really far, to show the ping-pong schedule name)
I think we can change the default GEMM backend on SM120 later.
Checklist