Repository navigation
[Feat] kimi-k3.1: PD disaggregation under decode context parallelism - #48741
Merged
Merged
Conversation
41 of 42 tasks
kpham-sgl
marked this pull request as ready for review
November 5, 2026 22:43
kpham-sgl
requested review from
Fridge003,
Ying1123,
ch-wan,
fzyzcjy,
hanming-lu,
hnyls2002,
huangtingwei9988,
ispobock,
merrymercy,
stmatengss and
xiezhq-hermann
as code owners
November 5, 2026 22:43
kpham-sgl
requested review from
1am9trash,
BBuf,
HaiShaw,
Qiaolin-Yu,
YAMY1234,
alphabetc1,
hebiao064,
hubertlu-tw,
hzh0425,
kkHuang-amd,
rainj-me and
yizhang2077
as code owners
November 5, 2026 22:43
# Conflicts: # python/sglang/srt/arg_groups/model_overrides/kimi_k3.py
- setup_state_kv_args read the index-K bytes through storage.view() of the DSA state entry, which static storage registers without a view, so every DSA model in PD raised KeyError at bootstrap. It now reads the owner pool, and takes the key/scale split from the pool instead of assuming FP8 keys, which mis-split the FP4 indexer's pages. - The index-K relayout checks that a page is exactly page_size x (key + scale) bytes. - Kimi-K3.1 DCP rejects speculative decoding under PD until the draft pool transfer is ported. - Drop the per-pack set_device: Mooncake transfer workers are already bound to their GPU (run_on_device), and it broke CPU pack tests. - KVArgs declares dsa_index_k_token_bytes; drop the getattr reads. - Tests: fix the two CPU tests broken by the above, cover the sharded branch of dsa_index_k_page_tokens, and add a static DSA pool case for the index-K token bytes (FP8, FP4, kpool).
Collaborator
Author
|
/rerun-test test_nixl_backend_basic.py test_dcp_pack.py test_mooncake_transfer_batching.py test_ascend_page_dcp.py test_receiver_connection_pool.py test_disaggregation_wire.py |
Contributor
|
🚀 |
Main already moves the draft KV in the DCP1 -> DCP-N relayout (sgl-project#37709), into the draft layout main's pool keeps.
…sgl-project#48414 Copy the Day-0 hunks that let a decode whose MLA draft pool keeps DCP owner rows (rows_are_dcp_collapsed) say so at registration, so the DCP1 -> DCP-N relayout sends the draft along the target's row mapping instead of raw widened rows. The KV ring and index-K lines of the same hunks are left out. Co-authored-by: Yuhao Yang <[email protected]>
- AscendKVManager overrides prepare_dcp_token_item_lens and send_kvcache_dcp with the old signatures, so a DCP relayout on Ascend raised TypeError on draft_rows_collapsed and dsa_index_k. Accept them and forward them on the non-page-interleaved path. - NPUMLATokenToKVPool reports rows_are_dcp_collapsed = False: NPU drafts index allocator-global slots, and only the DSA builder marks a widened pool dcp_replicated, so the MLA property would call an NPU draft collapsed.
kpham-sgl
requested review from
iforgetmyname,
ping1jing2 and
whybeyoung
as code owners
November 8, 2026 01:22
Collaborator
Author
|
Accuracy at 7221465: Kimi-K3.1 PD under DCP with DFLASH, on GB300.
Reference: unified TP8 / DCP8 without speculative decoding on main scored 99.0% with the same eval settings (an earlier main commit and nightly image, so not a strict A/B). Setup:
|
Contributor
|
🚀 |
Contributor
|
🚀 |
4 of 5 tasks
11 of 13 tasks
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.
Original authors: @yhyang201, @kpham-sgl, @alphabetc1
HiCache under DCP moved to its own PR, #48877.
Port of #48414
Kimi-K3.1 shards the DSA index-K cache by token under DCP (#48721), so PD disaggregation has to move index-K the way it already moves the sharded MLA KV. Its DFLASH MLA draft keeps DCP owner rows like the target, so the draft KV has to follow the target's rows too. This PR ports both from the Kimi-K3.1 Day-0 branch (#48414) and lifts #48721's DCP rejection of PD over Mooncake.
dsa_index_k_dcp_entries,_dsa_index_k_dcp_params, plus room in the DCP pack buffer).dsa_index_k_page_tokenson decode.rows_are_dcp_collapsed) says so at registration (draft_rows_dcp_collapsed, on Mooncake and NIXL), and the relayout then sends the draft along the target's row mapping instead of raw widened rows.Against the raw ports (the first commit of each):
index_key_bytes_per_token), so the FP4 indexer's layout is split correctly, and a page must be exactlypage_size x (key + scale)bytes.torch.cuda.set_deviceis dropped: main binds the Mooncake transfer workers to their GPU already.prepare_dcp_token_item_lens/send_kvcache_dcpoverrides take and forwarddraft_rows_collapsedanddsa_index_k, andNPUMLATokenToKVPoolreports its rows as not collapsed (NPU drafts index allocator-global slots)._await_transfer_futures.Left for later ports: the DFLASH draft KV ring's PD state, and sliding-window MLA drafts on
trtllm_mla/cutedsl_mla(#49110).Modifications
disaggregation/mooncake/conn.py,disaggregation/common/dcp_pack.py,disaggregation/utils.py,disaggregation/base/conn.py: index-K relayout under PD DCP.disaggregation/{common,mooncake,nixl}/conn.py,disaggregation/common/utils.py,disaggregation/decode.py,mem_cache/memory_pool.py: the DCP-collapsed draft transfer.disaggregation/ascend/conn.py,hardware_backend/npu/memory_pool_npu.py: the Ascend signatures and the NPU draft flag.disaggregation/decode.py,layers/dcp/layout.py:dsa_index_k_page_tokensfor the decode's index-K page list.arg_groups/model_overrides/kimi_k3.py: Kimi-K3.1 DCP allows PD over Mooncake.Tests
TestDcpDsaIndexKTransfer(test_mooncake_transfer_batching.py),TestDsaIndexKPageTokens(test_dcp_layout_unit.py),TestDsaIndexKTokenBytes(test_disaggregation_wire.py), and the ported collapsed-draft cases intest_dcp_pack.py,test_disaggregation_wire.pyandtest_receiver_connection_pool.py.CI States
Latest PR Test (Base): ❌ Run #42461024434
Latest PR Test (Extra): ❌ Run #42461024425
Latest PR Test (AMD ROCm 10): ✅ Run #42461024477
Tip
Base CI only covers the core cases, and its workload may not exercise your change. Use
/rerun-testto run the tests your change touches, or copy this prompt for an agent: