Repository navigation
[Unified Cache][9/N] add opt-in MLA load deduplication for Mooncake Linker - #39565
Merged
Merged
Conversation
huangtingwei9988
force-pushed
the
linker_mla_dedup
branch
from
September 15, 2026 07:41
0aed5f9 to
cc4431b
Compare
huangtingwei9988
requested review from
Ying1123,
alphabetc1,
hanming-lu,
hnyls2002,
hzh0425,
ispobock,
merrymercy,
xiezhq-hermann and
yizhang2077
as code owners
September 15, 2026 08:08
hzh0425
approved these changes
Sep 17, 2026
Leoyzen
added a commit
to Leoyzen/sglang
that referenced
this pull request
Sep 17, 2026
[Unified Cache][9/N] add opt-in MLA load deduplication for Mooncake Linker. Squashes 5 upstream commits (cc4431b, 455f5bb, 310b76e, 8acfd72, d52e749 — three of them merge-main commits whose only net effect on this PR's files is what lands below). New opt-in flag --enable-linker-mla-dedup: with the Mooncake external linker, rank 0 loads replicated MLA KV from L3 and broadcasts each layer to the other TP ranks instead of every rank reading the same objects. Files: - python/sglang/srt/arg_groups/fields/memory.py: add enable_linker_mla_dedup. - python/sglang/srt/arg_groups/hicache_hook.py: require the Mooncake linker. - python/sglang/srt/mem_cache/unified_cache/linker_mla_dedup.py (new): LinkerMLADedupBroadcaster, adapting hybrid device-pool geometry to the existing MLAHostDedupBroadcaster primitive. - python/sglang/srt/mem_cache/storage/mooncake_store/mooncake_direct_linker.py: LayerWiseLoadCounter on_layer_ready hook; broadcaster construction; per-batch logical-plan all_gather gate; rank-0-only load queueing; forward-stream broadcasts; broadcast-completion event tracking in num_completed_loads; reset/close teardown. - test/registered/unit/server_args/test_server_args.py: flag validation test. Manual merge notes: - Our fork's mooncake_direct_linker.py carries fork-local behavior (fail-soft revalidate_load, retrying session start, SGLANG_LINKER_DEBUG_KEY probes, idx-checksum probe, rank-key handling). All of it is preserved untouched; the upstream hunks apply around it (imports, LayerWiseLoadCounter, __init__ broadcaster wiring, num_completed_loads, start_layer_wise_loading, load_thread_func, reset/close). - The upstream branch was based on main before sgl-project#39835/sgl-project#39115/sgl-project#37474; those are unrelated to this PR's files (verified by diffing the PR range against the merge base), so the squash is a faithful net port. - Depends on MLAHostDedupBroadcaster and attn_tp_cache_group/tp_cache_group in CacheInitParams, both already present in our base (upstream parent == ours).
Leoyzen
added a commit
to Leoyzen/sglang
that referenced
this pull request
Sep 17, 2026
[Unified Cache][9/N] add opt-in MLA load deduplication for Mooncake Linker. Squashes 5 upstream commits (cc4431b, 455f5bb, 310b76e, 8acfd72, d52e749 — three of them merge-main commits whose only net effect on this PR's files is what lands below). New opt-in flag --enable-linker-mla-dedup: with the Mooncake external linker, rank 0 loads replicated MLA KV from L3 and broadcasts each layer to the other TP ranks instead of every rank reading the same objects. Files: - python/sglang/srt/arg_groups/fields/memory.py: add enable_linker_mla_dedup. - python/sglang/srt/arg_groups/hicache_hook.py: require the Mooncake linker. - python/sglang/srt/mem_cache/unified_cache/linker_mla_dedup.py (new): LinkerMLADedupBroadcaster, adapting hybrid device-pool geometry to the existing MLAHostDedupBroadcaster primitive. - python/sglang/srt/mem_cache/storage/mooncake_store/mooncake_direct_linker.py: LayerWiseLoadCounter on_layer_ready hook; broadcaster construction; per-batch logical-plan all_gather gate; rank-0-only load queueing; forward-stream broadcasts; broadcast-completion event tracking in num_completed_loads; reset/close teardown. - test/registered/unit/server_args/test_server_args.py: flag validation test. Manual merge notes: - Our fork's mooncake_direct_linker.py carries fork-local behavior (fail-soft revalidate_load, retrying session start, SGLANG_LINKER_DEBUG_KEY probes, idx-checksum probe, rank-key handling). All of it is preserved untouched; the upstream hunks apply around it (imports, LayerWiseLoadCounter, __init__ broadcaster wiring, num_completed_loads, start_layer_wise_loading, load_thread_func, reset/close). - The upstream branch was based on main before sgl-project#39835/sgl-project#39115/sgl-project#37474; those are unrelated to this PR's files (verified by diffing the PR range against the merge base), so the squash is a faithful net port. - Depends on MLAHostDedupBroadcaster and attn_tp_cache_group/tp_cache_group in CacheInitParams, both already present in our base (upstream parent == ours).
Leoyzen
added a commit
to Leoyzen/sglang
that referenced
this pull request
Sep 18, 2026
[Unified Cache][9/N] add opt-in MLA load deduplication for Mooncake Linker. Squashes 5 upstream commits (cc4431b, 455f5bb, 310b76e, 8acfd72, d52e749 — three of them merge-main commits whose only net effect on this PR's files is what lands below). New opt-in flag --enable-linker-mla-dedup: with the Mooncake external linker, rank 0 loads replicated MLA KV from L3 and broadcasts each layer to the other TP ranks instead of every rank reading the same objects. Files: - python/sglang/srt/arg_groups/fields/memory.py: add enable_linker_mla_dedup. - python/sglang/srt/arg_groups/hicache_hook.py: require the Mooncake linker. - python/sglang/srt/mem_cache/unified_cache/linker_mla_dedup.py (new): LinkerMLADedupBroadcaster, adapting hybrid device-pool geometry to the existing MLAHostDedupBroadcaster primitive. - python/sglang/srt/mem_cache/storage/mooncake_store/mooncake_direct_linker.py: LayerWiseLoadCounter on_layer_ready hook; broadcaster construction; per-batch logical-plan all_gather gate; rank-0-only load queueing; forward-stream broadcasts; broadcast-completion event tracking in num_completed_loads; reset/close teardown. - test/registered/unit/server_args/test_server_args.py: flag validation test. Manual merge notes: - Our fork's mooncake_direct_linker.py carries fork-local behavior (fail-soft revalidate_load, retrying session start, SGLANG_LINKER_DEBUG_KEY probes, idx-checksum probe, rank-key handling). All of it is preserved untouched; the upstream hunks apply around it (imports, LayerWiseLoadCounter, __init__ broadcaster wiring, num_completed_loads, start_layer_wise_loading, load_thread_func, reset/close). - The upstream branch was based on main before sgl-project#39835/sgl-project#39115/sgl-project#37474; those are unrelated to this PR's files (verified by diffing the PR range against the merge base), so the squash is a faithful net port. - Depends on MLAHostDedupBroadcaster and attn_tp_cache_group/tp_cache_group in CacheInitParams, both already present in our base (upstream parent == ours).
stmatengss
approved these changes
Sep 19, 2026
This was referenced Oct 1, 2026
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.
Summary
Add
--enable-linker-mla-dedupto load replicated MLA KV caches from Mooncake on TP rank 0, then broadcast the loaded data layer by layer to the other TP ranks.The feature is opt-in and reuses
MLAHostDedupBroadcaster.Performance
GLM-5.2 W4AFP8 on 8 × H20 96GB, TP8 / PP1, concurrency 1.
CUDA graphs enabled, chunked prefill size 8192, FP8 KV cache.
Accuracy Tests
Speed Tests and Profiling
Checklist
Review and Merge Process
/tag-and-rerun-ci,/tag-run-ci-label,/rerun-failed-ciCI States
Latest PR Test (Base): ✅ Run #35460066451
Latest PR Test (Extra): ❌ Run #35460066360
Latest PR Test (AMD ROCm 10): ⏳ Run #35460066435