[Bugfix][KV Connector] Mooncake: heterogeneous-TP support for hybrid GDN/Mamba models - #53078
Open
lucifer1004 wants to merge 1 commit into
Open
[Bugfix][KV Connector] Mooncake: heterogeneous-TP support for hybrid GDN/Mamba models#53078lucifer1004 wants to merge 1 commit into
lucifer1004 wants to merge 1 commit into
Conversation
lucifer1004
requested review from
ApostaC,
NickLucche,
ivanium,
orozery and
xuechendi
as code owners
August 20, 2026 08:52
…GDN/Mamba models - Register every mamba state (conv, ssm) as its own region with its real unpadded byte length so TP-ratio slicing stays head-aligned. - Split the GDN conv state into per-sub-projection (Q/K/V) regions under the DS layout, reusing derive_mamba_conv_split; a single conv region let the het-TP byte split cut across projection boundaries and silently scrambled the conv state on consumer ranks (GSM8K -10pp with occasional empty generations on Qwen3.5-397B PP2TP2->TP4). - Copy KV regions whole when the consumer TP group is wider than the KV-head count (consumer ranks replicate head groups, not slice them). - Tolerate peer-PP-stage layers absent from the local spec table. - Group-aware per-region asymmetric length validation. Validated on 2-node Qwen3.5-397B-A17B-NVFP4 PP2TP2->TP4 Mooncake/RDMA: GSM8K strict-match 0.9409 (aggregate TP4 baseline 0.9363). Signed-off-by: Zihua Wu <13583761+lucifer1004@users.noreply.github.com>
lucifer1004
force-pushed
the
mooncake-het-hybrid-gdn
branch
from
August 20, 2026 08:54
6a2e400 to
447ccbc
Compare
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.
What
Fix
MooncakeConnectorfor heterogeneous-TP disaggregated prefill/decode (e.g. PP2TP2 prefill → TP4 decode) on hybrid GDN/Mamba + full-attention models (Qwen3.5 / Qwen3-Next family).Without these changes, het-TP transfer on hybrid models either fails region validation or silently corrupts the mamba/GDN state on the consumer side.
Changes
Register every mamba state with its real, unpadded byte length (
register_kv_caches). The block page packs conv + ssm states contiguously before padding; registering the padded page length lets the TP-ratio slice cut across padding and misalign states. Each state now registers as its own region with its true payload size.Split the GDN conv state into per-sub-projection regions (Q/K/V), reusing
derive_mamba_conv_splitfrom the NIXL path. Under the DS (dim, state_len) layout each sub-projection is contiguous and shards across TP independently; treating the conv page as one region lets the het-TP byte-split cut across the Q/K/V boundary and scrambles the state (consumer ranks receive Q-segment bytes in K position, etc.). Because the conv state only influences the firstkernel-1decoded tokens, the corruption shows up as a moderate accuracy drop with occasional empty generations rather than a hard failure. Falls back to a single conv region under the SD layout (homogeneous-TP whole-region copies are unaffected by layout).Whole-region copy when the consumer TP exceeds the KV-head count (
consumer_kv_replicated). With 2 KV heads and consumer TP4, each consumer rank replicates its head group's region rather than slicing the producer's region; the generic ratio slicing would otherwise deliver only half the heads to each consumer rank.Tolerate peer-PP-stage layers in
_get_transfer_regions: remote layers from another PP stage are absent from the local spec table, so use.get()(their split flag is unused — region alignment only matches locally registered layers).Group-aware per-region length validation in
_validate_asymmetric_region_lengths: attention regions follow the replicated-consumer rule while mamba/GDN regions keep the TP-ratio rule.Tests
test_register_kv_caches_splits_gdn_conv_sub_projections: DS layout registers Q/K/V/ssm as separate regions with correct offsets and real byte lengths.test_gdn_conv_sub_projection_regions_align_across_het_tp: P TP2 → D TP4 per-region transfer plan keeps every slice inside its sub-projection.Notes
VLLM_SSM_CONV_STATE_LAYOUT=DS, the same requirement as the NIXL connector.