Repository navigation
Conversation
mmangkad
requested review from
AniZpZ,
BBuf,
DarkSharpness,
Edwardf0t1,
FlamingoPg,
HaiShaw,
HydraQYH,
b8zhong,
celve,
ch-wan and
yuan-luo
as code owners
June 10, 2026 15:21
Collaborator
|
#26766 (the author is rebasing when the JIT path is merged) |
Contributor
Author
Collaborator
|
@mmangkad I'll add you as a co-autho r |
5 tasks
This was referenced Jun 16, 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 DSV4 FP8
wo_apath inDeepSeek-V4needs per-token-group scales in the layout consumed bydeep_gemm.fp8_einsum("bhr,hdr->bhd", ...). This PR adds a DSV4-specific fused JIT quantization path that produces the FP8 activation tensor and writes the final UE8M0-rounded scale tensor directly in thefp8_einsumlayout while preserving the existing FP8 activation quantization behavior.This fuses the scale rounding and DSV4 scale-layout write into the quantization kernel, avoiding a separate post-quant scale conversion/layout step. This PR only changes the DSV4 FP8
wo_apath and is based on the JIT v2 per-token-group quantization infrastructure from #27449.Modifications
PerTokenGroupQuantFp8Dsv4Kernelto the JIT v2 per-token-group quantization kernel. It reuses the JIT v2 FP8 quantization math and FP8 conversion path, and fuses UE8M0 scale rounding plus DSV4 scale-layout writes into the same kernel.per_token_group_quant_fp8_dsv4.sglang_per_token_group_quant_fp8_dsv4_ue8m0.DeepSeek-V4DSV4 FP8wo_apath through the new helper.Accuracy Tests
GSM8K
Command:
Result:
Kernel Exactness Test
The unit test compares the new DSV4 path against the previous tensor behavior (
sglang_per_token_group_quant_fp8+deep_gemm.ceil_to_ue8m0+ DSV4 layout transpose). It checks exact FP8 bytes, UE8M0 scale values, and scale tensor layout for BF16/FP16 inputs, including empty inputs.Speed Tests and Profiling
Benchmarks were run on one GPU from a single GB300 node with
deepseek-ai/DeepSeek-V4-Flash.Bench One Batch, 1k/1k
Command:
CUDA_VISIBLE_DEVICES=0 SGLANG_JIT_DEEPGEMM_FAST_WARMUP=1 python -m sglang.bench_one_batch \ --model-path deepseek-ai/DeepSeek-V4-Flash \ --trust-remote-code \ --moe-runner-backend flashinfer_mxfp4 \ --disable-flashinfer-autotune \ --model-loader-extra-config '{"enable_multithread_load": true, "num_threads": 46}' \ --batch-size 1 8 \ --input-len 1024 \ --output-len 1024Prefill latency:
Decode latency:
Overall throughput:
Bench Serving, 1k/1k
Server:
CUDA_VISIBLE_DEVICES=0 SGLANG_JIT_DEEPGEMM_FAST_WARMUP=1 sglang serve \ --trust-remote-code \ --model-path deepseek-ai/DeepSeek-V4-Flash \ --moe-runner-backend flashinfer_mxfp4 \ --disable-flashinfer-autotune \ --model-loader-extra-config '{"enable_multithread_load": true, "num_threads": 46}'Benchmark:
Output throughput:
TTFT:
TPOT:
CI States
Latest PR Test (Base): ❌ Run #27456441998
Latest PR Test (Extra): ❌ Run #27456441910