Skip to content

[V32/GLM5] Change default setting of V32 nvfp4 on TP4#20086

Merged
Fridge003 merged 1 commit intomainfrom
baizhou/nsa_b200_tp
Mar 7, 2026
Merged

[V32/GLM5] Change default setting of V32 nvfp4 on TP4#20086
Fridge003 merged 1 commit intomainfrom
baizhou/nsa_b200_tp

Conversation

@Fridge003
Copy link
Copy Markdown
Collaborator

@Fridge003 Fridge003 commented Mar 7, 2026

Motivation

After the flashmla is rebased to latest version, DeepSeekV32 fp4+tp4 will break on flashmla decode kernel, since the latest code doesn't support q_head=32
error log: https://github.com/sgl-project/sglang/actions/runs/22779139862/job/66096508676?pr=18902

To unblock the upgrade of flashmla, we change the default setting of DeepSeekV32 fp4+tp4 to bf16 kv_cache_dtype, flashmla sparse prefill kernel, and trtllm decode kernel. For DP4, fp8 kv cache + flashmla decode kernel can still be used.

Modifications

Accuracy Tests

Before this PR, V32 FP4 will break on TP4 with default setting.
With this PR, it can be correctly launched.
Result of gsm8k 20 shots:

Accuracy: 0.955
Invalid: 0.000
Latency: 90.622 s
Output throughput: 1403.429 token/s

On send_one benchmark, it's even faster than the prior one, which was ~90 tok/s.

+-------------+--------+------------+-----------------+
| Latency (s) | Tokens | Acc Length | Speed (token/s) |
+-------------+--------+------------+-----------------+
|    5.033    |  512   |   1.000    |     101.73      |
+-------------+--------+------------+-----------------+

Benchmarking and Profiling

Checklist

Review Process

  1. Ping Merge Oncalls to start the PR flow. See the PR Merge Process.
  2. Get approvals from CODEOWNERS and other reviewers.
  3. Trigger CI tests with comments or contact authorized users to do so.
    • /tag-run-ci-label, /rerun-failed-ci, /tag-and-rerun-ci
  4. After green CI and required approvals, ask Merge Oncalls to merge.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves a critical compatibility issue arising from a recent FlashMLA rebase that broke DeepSeekV32 fp4+tp4 configurations. It achieves this by intelligently adjusting the default KV cache data type and switching the prefill and decode backends for specific hardware setups, particularly on Blackwell devices without data parallel attention. This ensures the DeepSeekV32 models remain functional and stable while allowing for future FlashMLA upgrades.

Highlights

  • KV Cache Data Type Adjustment: The default KV cache data type for DeepSeek DSA on SM10+ devices was updated to "bfloat16" when dp_size is 1, otherwise it remains "fp8_e4m3".
  • Backend Switching for Blackwell Devices: For Blackwell devices (SM10+) with "fp8_e4m3" KV cache and dp_size of 1, the prefill and decode backends were switched from FlashMLA to "trtllm" due to FlashMLA compatibility issues.
  • Compatibility Fix: These changes address a breaking issue with DeepSeekV32 fp4+tp4 configurations after a FlashMLA rebase, ensuring continued functionality.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • python/sglang/srt/server_args.py
    • Modified the logic for automatically setting the KV cache data type for DeepSeek DSA, introducing a condition to use "bfloat16" on SM10+ devices when dp_size is 1.
    • Implemented a conditional switch for NSA prefill and decode backends to "trtllm" for "fp8_e4m3" KV cache on Blackwell devices (major >= 10) when dp_size is 1, providing a warning about potential accuracy trade-offs.
Activity
  • No human activity has been recorded on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@Fridge003
Copy link
Copy Markdown
Collaborator Author

/tag-and-rerun-ci

@github-actions github-actions Bot added the run-ci label Mar 7, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request modifies the default server arguments for DeepSeek V3.2 models on newer GPUs (Blackwell, SM >= 10) to address an incompatibility with the flashmla decode kernel when data parallelism is not used. Specifically, when dp_size is 1, the default kv_cache_dtype is now set to bfloat16, and the attention backends are adjusted accordingly. The changes also include a fallback mechanism that switches to trtllm backends and warns the user if fp8_e4m3 KV cache is manually configured in this unsupported scenario. The logic appears correct and effectively resolves the described issue.

Note: Security Review did not run due to the size of the PR.

@Fridge003 Fridge003 merged commit d28f352 into main Mar 7, 2026
203 of 221 checks passed
@Fridge003 Fridge003 deleted the baizhou/nsa_b200_tp branch March 7, 2026 23:13
Wangzheee pushed a commit to Wangzheee/sglang that referenced this pull request Mar 21, 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant