Repository navigation
Conversation
Under decode context parallelism the draft KV cache is replicated over the widened logical slots, while the target's HiCache host rows hold only this rank's shard. Back the EAGLE/NEXTN draft up in its own sidecar host pool (as DSpark already does) instead of packing it into the target host pool, and allow EAGLE/NEXTN with topk 1 in the HiCache + DCP guard. For DSA models (GLM-5.2), the index-K cache stays replicated under DCP, so size its host pool over the anchor's widened logical slots, and size the replicated draft indexer sidecar from the stored index-K row. Lift the DSA DCP HiCache rejection (HiSparse and L3 storage stay rejected), and count the widened target slots when auto-sizing a DCP draft sidecar. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
fy1214
added a commit
to fy1214/sglang
that referenced
this pull request
Nov 24, 2026
…40434) onto glm5.3-flash Surgical overlay validated on 355461: allow EAGLE/MTP with DCP+HiCache, role-aware dcp_size through hybrid/TBO, and flashmla_kv DCP gates.
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.
[by Claude Code]
Motivation
AgentX-style long-context agentic workloads on GLM-5.2 / DSA models benefit from decode context parallelism (DCP) and HiCache at the same time. On 8xB200, TP8+DCP8 gives about 6x the logical KV capacity of TP8. HiCache would keep long multi-turn prefixes in host DRAM. These deployments run the checkpoint's own MTP head through EAGLE. Today the combination is rejected twice:
resolve_hicache_dcp_compatibilityraisesNotImplementedErrorfor--dcp-size > 1+ HiCache unless the speculative algorithm is DSPARK._dsa_dcp_overridesrejects HiCache for any DSA model under DCP.So DCP + EAGLE/MTP has to run with GPU-resident KV only.
Root cause
Under DCP, the target MLA KV is striped by position. The HiCache host pool keeps widened logical slots and translates them to this rank's physical rows at the transfer boundary (#33112). The draft KV, including the NextN/MTP layer, is replicated: every rank stores the full draft context over the widened virtual slots, untranslated.
_build_hicache_draft_planpacks the draft pool into the target host pool as extra layers. The draft rows would then go through the per-rank translation and be sized like the per-rank shard. That is wrong for a replicated pool. DSpark ([HiCache] Support DCP with DSpark #35221) works because its draft goes through the separate sidecar host pool, sized over the anchor'slogical_sizewith no translation.DSAIndexerPoolHostcopied its size from the anchor's per-rank shard, so logical host indices abovesizehad no host page.dcp_sizekernel pages.make_dsa_indexer_pool_declsized a host page fromindex_page_size, so it either failed its divisibility assert (dcp_size=8) or copied1/dcp_sizeof each row.Change
speculative/base_spec_worker.py: with DCP + HiCache, back the draft up as a sidecar instead of packing it. The sidecar is the same host pool that DCP + DSpark already uses. Multi-runner (multi-layer EAGLE) andtopk > 1raise a clearNotImplementedError.arg_groups/hicache_hook.py: allowEAGLE/NEXTNwith--speculative-eagle-topk 1alongside DSPARK. Other algorithms andtopk > 1are still rejected. The L3 storage backend, LMCache, HiSparse and non-MLA guards are unchanged.arg_groups/model_overrides/deepseek_v2.py: DSA + DCP now allows HiCache. HiSparse is still rejected.mem_cache/pool_host/dsa.py:logical_size. This is unchanged without DCP.page_size // index_kpool, which is the same as before for non-replicated pools.mem_cache/hicache_auto_size.py: the draft sidecar estimate counts widened target slots under DCP. It used to undercount the draft host pool bydcp_size.docs/advanced_features/dcp.mdx: document the new scope.No kernel changes.
Related PRs
[DCP] HiCache L2 for DSA models with MTP under decode context parallelism #44122 (@kpham-sgl) takes the same sidecar plus logical-sized index-K approach for DSA MTP. It does not change
make_dsa_indexer_pool_decl, so its replicated draft indexer sidecar keeps theindex_page_size-based page size:--dcp-size 8(the GLM-5.2 TP8+DCP8 deployment), building the draft sidecar hitsAssertionError: index page of 8448 bytes does not split over page_size=512 tokens.1/dcp_sizeof each draft index-K row. Outputs stay correct because the target verifies, but MTP acceptance after load-back degrades.[DCP] HiCache L2 for DSA models with MTP under decode context parallelism #44122 also drops the speculative-algorithm guard entirely. This PR keeps an explicit EAGLE/NEXTN topk-1, single-runner and DSPARK allowlist. Happy to fold the decl fix into [DCP] HiCache L2 for DSA models with MTP under decode context parallelism #44122 instead if maintainers prefer.
[Feat] [AMD] hicache: Enable HiCache for DSA DCP with a packed MTP draft #45205 (ROCm) enables DSA DCP HiCache with a DCP-sharded packed MTP draft on top of [Feat] [AMD] dsa: Enable DCP on the triton sparse-MLA backend #44322. [Feat] kimi_k3: Run the EAGLE3 MLA draft under DCP with a physical draft KV pool #43599 handles the Kimi-K3 EAGLE3 MLA draft.
Limitations
--speculative-eagle-topk 1and a single draft model runner, so multi-layer EAGLE is rejected. EAGLE3/STANDALONE stay rejected with DCP + HiCache because they are untested.Test evidence
Unit tests (CPU), in
lmsysorg/sglang:nightly-dev-20261021-c1c287a4on this exact commit: 472 passed. The only failure isTestDcpCommBackendDefault::test_a5_npu_supports_dcp, which also fails on unmodifiedmainon that GB300 host because of thefi_a2aplatform resolution, so it is unrelated. The run coveredtest_hicache_dcp_host_pool,test_hicache_mtp_state,test_hicache_auto_size,test_hybrid_pool_assembler,test_mem_pool_host,test_mla_host_dedup_primitives,test_hicache_nixl_storage,test_linker_pool_assembler,test_dsa_pool_host_unit,test_decode_retraction_backup,test_server_argsandhicache/test_dsa_host_release.New cases, each checked to fail on the pre-fix source:
IndexError: index 67 is out of bounds ... size 10dcp_size=8)AssertionError: index page of 8448 bytes does not split over page_size=512handle_hicacheadmits EAGLE/NEXTN topk 1 and DSPARK, rejects EAGLE topk 2, EAGLE3 and STANDALONEonly supports DSPARK4608 != 6144Pre-commit:
pre-commit run --all-filespasses on this commit.GPU (GLM-5.2-FP8, 1x GB300 node with 4 GPUs, TP4 + DCP4). This used SM103 GB300 rather than 8xB200; both run the same DSA DCP
trtllmpath. All runs used--kv-cache-dtype fp8_e4m3(DSA prefill/decode resolved totrtllm, DCP commfi_a2a) and--speculative-algorithm EAGLE --speculative-num-steps 3 --speculative-eagle-topk 1 --speculative-num-draft-tokens 4, withSGLANG_ENABLE_RANK_CONSENSUS_CHECKER=1.Capacity: device KV is 1,276,224 physical tokens/rank, so
max_total_num_tokens=5,104,896logical. Under the default auto-sizing, the host pools per rank were:That is 139.9 GiB, matching the auto-size estimate.
Load-back probe: a 46K-token fact-list document is prefilled. Eight retrieval questions are asked on the original device KV and repeated once. Then 122 distinct 46K-token fillers (5.6M tokens) evict the document, and the eight questions are asked again. The first of those loads 45,824 prefix tokens from host (
cached_tokens_details: {"device": 0, "host": 45824}).write_through,page_first,kernelwrite_back,page_first_direct,directThe only retrieval miss is item 1234, which the model also misses on device-resident KV. Greedy continuations past the answer word are not run-to-run deterministic in this configuration, even without HiCache: a plain device-hit repeat matches its own earlier text in only 1-3 of 8 cases. The fair checks are therefore answers and acceptance length, and both match. A wrong latent shard or index-K page would break long-range retrieval. A corrupted draft KV would collapse the MTP acceptance length. The rank-consensus checker never fired.
🤖 Generated with Claude Code
CI States
Latest PR Test (Base): ❌ Run #39539988880
Latest PR Test (Extra): ❌ Run #39539988828
Latest PR Test (AMD ROCm 10): ❌ Run #39539988915