[Bug] Fix V4-Pro NaN on Blackwell by converting fp8_einsum input scale to ue8m0#25733
Merged
Conversation
…e to ue8m0 deep_gemm's ue8m0 packing kernel has a bug where non-power-of-2 fp32 scale values get their mantissa bits leaked into packed exponent fields. This causes fp8_einsum to produce NaN during autoregressive decode (batch=1) for DeepSeek-V4-Pro on Blackwell GPUs. Adding ceil_to_ue8m0() on the activation scale ensures mantissa bits are zero before packing, which matches deep_gemm's expected input format and fixes the NaN.
Contributor
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
Collaborator
Author
|
/tag-and-rerun-ci |
ch-wan
approved these changes
May 19, 2026
Collaborator
|
/rerun-test test_deepseek_v4_flash_fp4_b200.py |
Contributor
|
🚀 |
Collaborator
Author
|
/rerun-test test_deepseek_v4_flash_fp4_b200.py |
Contributor
|
🚀 |
Collaborator
Author
|
/rerun-test test_deepseek_v4_flash_fp4_megamoe_b200.py |
Contributor
|
🚀 |
5 tasks
This was referenced May 21, 2026
3 tasks
Shunkangz
pushed a commit
to Shunkangz/sglang
that referenced
this pull request
May 27, 2026
alphabetc1
pushed a commit
to alphabetc1/sglang
that referenced
this pull request
Jun 4, 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.
Summary
deep_gemm'stranspose_and_pack_fp32_into_ue8m0CUDA kernel has a packing bug — it doesn't mask mantissa bits when extracting fp32 exponent, so non-power-of-2 scale values get corrupted. This causesfp8_einsumto produce NaN at batch=1 (single-token decode)ceil_to_ue8m0()on the activation scale before passing tofp8_einsum, ensuring mantissa bits are zero before packing(2, 32)), so the overhead is negligibleCI States
Latest PR Test (Base): 🚫 Run #26072487958⚠️ Not enabled -- add
Latest PR Test (Extra):
run-ci-extralabel to opt in.