Skip to content

[Perf] deepseek-v4.1: Default PD to MegaAttention, with the KV layout in the PD handshake - #45075

Merged
hnyls2002 merged 1 commit into
mainfrom
lsyin/dsv41-pd-mega-default
Oct 19, 2026
Merged

hnyls2002 merged 1 commit into
mainfrom
lsyin/dsv41-pd-mega-default

Conversation

@hnyls2002

@hnyls2002 hnyls2002 commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator
  • _default_dsv4_attention_backend no longer falls back to FlashMLA under PD, so both roles pick MegaAttention (flashmla_mega) on SM100/SM103, as a single server does.
  • MegaAttention and FlashMLA store KV in different layouts (packed V4.1 vs V4 by default), and the PD handshake compared only kv_cache_dtype, so a mismatched pair would transfer KV that the decode misreads. The prefill now registers its KV layout (DeepSeekV4TokenToKVPool.pd_kv_layout: the main layout plus each compression ratio's), the Python and Rust bootstrap servers relay it, and the decode raises KV layout mismatch next to the dtype check. Other pools report no layout and skip the check.
  • The trtllm PD rejection no longer says the handshake lacks a layout; trtllm under PD stays rejected as untested ([Feature] DeepSeek-V4 trtllm attention backend: support PD disaggregation (uniform-FP8 KV layout in the PD handshake) #37838).
  • The DeepSeek-V4.1 cookbook's PD section states the default and that both roles must match.

Verified on two GB300 nodes (DEP2 prefill + DEP2 decode, DSpark, Mooncake) with no --dsv4-attn-backend: both roles resolve flashmla_mega, and GSM8K (1,319, greedy) scores 96.66%, the same as with flashmla on both roles. With only the decode on flashmla, its first request fails with KV layout mismatch: prefill server has kv_layout=v41,c1:v41_fp4,c2:v41_fp4, but decode server has kv_layout=v4,c1:v4,c2:v4.

Behavior change: DeepSeek-V4.1 PD on SM100/SM103 runs MegaAttention on both roles by default. A prefill on SM100/SM103 paired with a decode on another GPU now needs --dsv4-attn-backend flashmla on the prefill. An older decode cannot parse the new kv_layout field, so upgrade both roles together.


CI States

Latest PR Test (Base): 🚫 Run #39193587005
Latest PR Test (Extra): ❌ Run #39193586944
Latest PR Test (AMD ROCm 10): 🚫 Run #39193586911

@mintlify

mintlify Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
sglang-doc 🟢 Ready View Preview Oct 19, 2026, 3:17 AM

💡 Tip: Enable Automations to automatically generate PRs for you.

@github-actions github-actions Bot added documentation Improvements or additions to documentation deepseek memory-pool labels Oct 19, 2026
@hnyls2002

Copy link
Copy Markdown
Collaborator Author

/rerun-test test_register_to_bootstrap.py test_disaggregation_wire.py test_dsv4_compressed_pools.py test_model_overrides.py test_prefill_complete_integration.py test_decode_queue_cleanup.py registered/unit/server_args/test_server_args.py test_pool_configurator.py test_deepseek_v41_pd_cp_dspark.py test_disaggregation_dsv4.py test_disaggregation_rust_server.py registered/disaggregation/test_disaggregation_basic.py test_disaggregation_hisparse.py test_disaggregation_dp_attention.py

@hnyls2002

Copy link
Copy Markdown
Collaborator Author

/tag-and-rerun-ci

@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

🚀 ubuntu-latest (8 tests): ✅ View workflow run

cd test/ && python3 registered/unit/disaggregation/test_register_to_bootstrap.py
cd test/ && python3 registered/unit/disaggregation/test_disaggregation_wire.py
cd test/ && python3 registered/unit/mem_cache/test_dsv4_compressed_pools.py
cd test/ && python3 registered/unit/test_model_overrides.py
cd test/ && python3 registered/unit/disaggregation/test_prefill_complete_integration.py
cd test/ && python3 registered/unit/disaggregation/test_decode_queue_cleanup.py
cd test/ && python3 registered/unit/server_args/test_server_args.py
cd test/ && python3 registered/unit/model_executor/test_pool_configurator.py

🚀 8-gpu-b300 (1 test): ✅ View workflow run

cd test/ && python3 registered/e2e/models/test_deepseek_v41_pd_cp_dspark.py

🚀 8-gpu-h200 (2 tests): ✅ View workflow run

cd test/ && python3 registered/disaggregation/test_disaggregation_dsv4.py
cd test/ && python3 registered/disaggregation/test_disaggregation_hisparse.py

🚀 2-gpu-h100 (2 tests): ✅ View workflow run

cd test/ && python3 registered/disaggregation/test_disaggregation_rust_server.py
cd test/ && python3 registered/disaggregation/test_disaggregation_basic.py

🚀 8-gpu-h20 (1 test): ✅ View workflow run

cd test/ && python3 registered/disaggregation/test_disaggregation_dp_attention.py

@github-actions github-actions Bot added the run-ci CI: run the baseline test suite on this PR label Oct 19, 2026
@hnyls2002
hnyls2002 merged commit 82c9a8b into main Oct 19, 2026
247 of 307 checks passed
@hnyls2002
hnyls2002 deleted the lsyin/dsv41-pd-mega-default branch October 19, 2026 04:16
akhilg-nv added a commit to akhilg-nv/sglang that referenced this pull request Oct 22, 2026
The startup assert rejected --dsv4-attn-backend trtllm with any
--disaggregation-mode because a trtllm prefill could pair with a FlashMLA
decode and transfer 512-byte uniform-FP8 rows into 584-byte packed pages.
The bootstrap handshake now carries the pool's KV layout (sgl-project#45075 reports
uniform_fp8 for trtllm pools) and rejects such a pair, and every
transferred buffer is described from the real pool geometry, so a matched
trtllm prefill/decode pair needs no transfer changes.

Closes sgl-project#37838.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

This branch was successfully deployed

1 active deployment
staging - docs — 1ba1be7f Deployed Oct 19, 2026 by mintlify[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

deepseek documentation Improvements or additions to documentation memory-pool run-ci CI: run the baseline test suite on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant