Repository navigation
Conversation
JoeLee314
requested review from
AniZpZ,
BBuf,
Edwardf0t1,
FlamingoPg,
HaiShaw,
b8zhong,
ch-wan,
ispobock,
merrymercy and
yizhang2077
as code owners
May 28, 2026 13:08
Contributor
There was a problem hiding this comment.
Code Review
This pull request adds support for row-major FP8 quantization with UE8M0 scaling in the per_token_group_quant_8bit_v2 CUDA kernel and integrates it into DeepSeek-V4, replacing the two-step quantization and ceiling process with an integrated kernel-level approach. Feedback on the changes suggests adding an explicit assertion in fp8_kernel.py to ensure that scale_tma_aligned is true when column_major_scales is enabled under the scale_ue8m0 path, preventing silent fallbacks to row-major layouts.
JoeLee314
force-pushed
the
fuse_UE8M0_scale_rounding
branch
from
May 28, 2026 13:33
575a218 to
812eae4
Compare
Collaborator
|
/tag-and-rerun-ci |
b8zhong
force-pushed
the
fuse_UE8M0_scale_rounding
branch
from
May 29, 2026 14:41
cf86f57 to
46512c7
Compare
This was referenced May 30, 2026
JoeLee314
pushed a commit
to JoeLee314/sglang
that referenced
this pull request
May 30, 2026
…bit_v2 Add support for row-major FP8 quantization with UE8M0 scaling in the per_token_group_quant_8bit_v2 CUDA kernel. When SCALE_UE8M0 is enabled with row-major layout, the kernel now directly rounds scales to power-of-two format, eliminating the need for a separate deep_gemm.ceil_to_ue8m0 call. Split from sgl-project#26582 for wheel release purposes.
Contributor
Author
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.
[DeepSeek-V4] Fuse UE8M0 scale rounding into FP8 group quantization
Motivation
This PR optimizes the DeepSeek-V4
wo_aFP8 path by removing the separatedeep_gemm.ceil_to_ue8m0call after activation quantization.The original path launches quantization first, then rounds the generated FP8 scales to UE8M0/power-of-two format:
The optimized path emits the rounded power-of-two scale directly from the per-token group quantization kernel:
Performance Test
DeepSeek-V4-Flash, TP=4, 32K input / 1K output, 128 requests, max concurrency 4.
Output token throughput increased by 7.8%.

The configuration of server is from cookbook but without MTP: https://docs.sglang.io/cookbook/autoregressive/DeepSeek/DeepSeek-V4
Accuracy Tests
GSM8K score: 0.928
Modifications
sgl-kernel/csrc/gemm/per_token_group_quant_8bit_v2.cuscale_ue8m0=Trueoutput.python/sglang/srt/models/deepseek_v4.pysglang_per_token_group_quant_fp8(..., scale_ue8m0=True)in the DeepSeek-V4wo_aFP8 path.deep_gemm.ceil_to_ue8m0call from this path.Checklist
bench_servingperformance improvement on DeepSeek-V4-Flash.CI States
Latest PR Test (Base): ❌ Run #26643741620
Latest PR Test (Extra): ❌ Run #26643741155