Skip to content

[Unified Cache][5/N]: Integrate external linker mode end to end - #37381

Merged
hzh0425 merged 7 commits into
sgl-project:mainfrom
hzh0425:external-linker-mooncake-e2e
Sep 3, 2026
Merged

hzh0425 merged 7 commits into
sgl-project:mainfrom
hzh0425:external-linker-mooncake-e2e

Conversation

@hzh0425

@hzh0425 hzh0425 commented Sep 1, 2026 •

Copy link
Copy Markdown
Collaborator

Motivation

Motivation
Unified Radix Cache manages heterogeneous model states, including full-attention KV, SWA KV, and model-specific sidecars.

On GB platforms, deployments may need to aggregate larger memory regions into a shared Global Memory pool. This requires an efficient way for Unified Radix Cache to access remote memory directly without overhead on the inference critical path.

This PR adds an optional external-cache linker mode. It allows the tree to access a Global Memory pool through backends such as Mooncake or UMBP .. while retaining ownership of allocation, insertion, component consistency, and cache-node lifetime.

The existing hierarchical cache path remains unchanged. The linker is an opt-in alternative for deployments that need a larger shared memory pool while preserving inference performance.

This is the fifth PR split from #35687. It completes the Mooncake external-linker path.

Previous splits: #37091, #37098, #37151, and #37205.

Modifications

  • Wire external-linker arguments, registry, scheduler lifecycle, and cache-pool configuration.
  • Add GLM-5.2 and DeepSeek-V4 Mooncake direct load-back KL E2E tests.

Tests

  • GLM-5.2-FP8: 5 tests passed with 2 skipped; max average KL 0.006497 under 0.03.
  • DeepSeek-V4-Flash-FP8: 5 tests passed with 2 skipped; max average KL 0.003479 under 0.01.

Uploading image.png…


CI States

Latest PR Test (Base): 🚫 Run #33710527281
Latest PR Test (Extra): ✅ Run #33777698559
Latest PR Test (AMD ROCm 7.2): ⏳ Run #33710527160

@github-actions github-actions Bot added hicache Hierarchical Caching for SGLang unified-radix-cache labels Sep 1, 2026
@hzh0425 hzh0425 changed the title [Unified Cache][5/N]: Integrate Mooncake external linker end to end [Unified Cache][5/N]: Integrate external linker mode end to end Sep 1, 2026
@hzh0425 hzh0425 added run-ci CI: run the baseline test suite on this PR run-ci-extra CI: also run the extra suite (requires run-ci) labels Sep 1, 2026
@hzh0425

hzh0425 commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator Author

/rerun-test test/registered/radix_cache/unified_radix_tree/linker/test_unified_cache_linker_kl_dsv4.py

@github-actions

github-actions Bot commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

Results for /rerun-test test/registered/radix_cache/unified_radix_tree/linker/test_unified_cache_linker_kl_dsv4.py:

🚀 4-gpu-h100 (1 test): ✅ View workflow run

cd test/ && python3 registered/radix_cache/unified_radix_tree/linker/test_unified_cache_linker_kl_dsv4.py

@hzh0425

hzh0425 commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator Author

/rerun-test test/registered/radix_cache/unified_radix_tree/linker/test_unified_cache_linker_kl_glm52.py

@hzh0425

hzh0425 commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator Author

/rerun-group radix_cache/unified_radix_tree

@github-actions

github-actions Bot commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

Results for /rerun-test test/registered/radix_cache/unified_radix_tree/linker/test_unified_cache_linker_kl_glm52.py:

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

cd test/ && python3 registered/radix_cache/unified_radix_tree/linker/test_unified_cache_linker_kl_glm52.py

@github-actions

github-actions Bot commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

Results for /rerun-group radix_cache/unified_radix_tree:

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

cd test/ && python3 registered/radix_cache/unified_radix_tree/linker/test_unified_cache_linker_kl_dsv4.py
cd test/ && python3 registered/radix_cache/unified_radix_tree/test_unified_radix_cache_hicache_pp_kl.py
cd test/ && python3 registered/radix_cache/unified_radix_tree/test_unified_radix_cache_kl_cp.py
cd test/ && python3 registered/radix_cache/unified_radix_tree/test_unified_radix_cache_kl_dsv4.py
cd test/ && python3 registered/radix_cache/unified_radix_tree/test_unified_radix_cache_kl_mamba.py

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

cd test/ && python3 registered/radix_cache/unified_radix_tree/linker/test_unified_cache_linker_kl_glm52.py
cd test/ && python3 registered/radix_cache/unified_radix_tree/test_unified_radix_cache_kl_dsv4_pp.py
cd test/ && python3 registered/radix_cache/unified_radix_tree/test_unified_radix_cache_kl_glm52.py
cd test/ && python3 registered/radix_cache/unified_radix_tree/test_unified_radix_cache_kl_mimo.py

🚀 4-gpu-b200 (1 test): ✅ View workflow run

cd test/ && python3 registered/radix_cache/unified_radix_tree/test_unified_radix_cache_kl_dcp.py

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

cd test/ && python3 registered/radix_cache/unified_radix_tree/test_unified_radix_cache_kl_full.py
cd test/ && python3 registered/radix_cache/unified_radix_tree/test_unified_radix_cache_kl_swa.py

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

cd test/ && python3 registered/radix_cache/unified_radix_tree/test_unified_radix_cache_kl_hybrid_bitexact.py

Comment thread python/sglang/srt/managers/scheduler.py Resolved
Leoyzen added a commit to Leoyzen/sglang that referenced this pull request Sep 2, 2026
Wires the Mooncake direct external linker (PR sgl-project#37205 backend, sgl-project#37307
translator passthrough) into the serving stack as an opt-in direct-L3
mode for UnifiedRadixCache, with no host cache tier:

- server_args: --enable-unified-cache-external-linker (default FALSE,
  runtime stays off unless explicitly enabled) +
  --unified-cache-external-linker-backend {mooncake}.
- arg_groups/hicache_hook: mutual-exclusion guard against
  --enable-hierarchical-cache and --hicache-storage-backend; linker mode
  skips hicache normalization entirely.
- registry: route to _create_unified_radix_cache under the flag and
  attach MooncakeDirectLinker via init_cache_linker, registering its
  layer-done counter with the kv cache and tp worker.
- scheduler: consolidate aborted-request cache-state release into
  _release_aborted_request (fires for hicache storage or the external
  linker); poll linker events, and gate NO_TOKEN / hicache-consumer
  batch behavior under the linker flag.
- kv_cache_builder: forward attn_cp_rank / attn_cp_size into
  CacheInitParams (consumed by the storage config suffix).
- kv_cache_configurator: keep the DSA indexer-K cache under the linker.
- full_component: honor the PREPARE phase of
  ExternalLinkerLoadPhase (return the transfer unmodified; assert
  COMMIT after it).
- tests: MooncakeTestServices lifecycle helper, DSV4-Flash and GLM-5.2
  direct-linker KL E2E suites (registered as extra-b CUDA CI), plus the
  unit-test fixtures for the new scheduler/registry fields.

Applied cleanly over the local branch (no textual conflicts; scheduler
abort consolidation coexists with the local chunked-prefill abort
re-dispatch and fail-soft changes).  Default-off runtime behavior is
preserved per the port-but-don't-switch decision.

(cherry picked from commit d2ade53,
PR sgl-project#37381)
@Leoyzen

Leoyzen commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Ran this in production for a couple hours (DeepSeek-V4-Flash, TP4, Mooncake L3, ~21M keys / 1.4TB master memory) and hit a crash worth sorting out before merge.

What happened

11:32:27  master memory crossed the 90% watermark (memory_ratio=0.900573)
11:32:32  BatchEvict removed 21,189 keys in one pass
11:37:55  DP2 layer-wise load, batch of 32 keys:
            batch_get_session_start -> 2 keys returned -702 (INVALID_REPLICA)
          RuntimeError: Mooncake get session start failed
          RuntimeError: Mooncake layer-wise KV load failed.
          -> scheduler crash, whole engine restarted

batch_get_session_start only accepts complete memory replicas (SelectCompleteMemoryReplica in real_client.cpp:5450). Once the master evicts the mem replica, the key is unreadable on this path even if an SSD copy still exists — #2004 fixed replica selection for the whole-object batch_get_into_multi_buffers path, but the ranged session protocol is still mem-only. So under memory pressure this repeats: every watermark crossing opens a race window against in-flight loads.

Suggestion

Don't treat a partial batch failure as fatal. Keys that fail session start could be dropped from the load and re-prefilled — same idea as the vLLM mooncake connector (#50984, #48216): failed get -> load error -> scheduler recomputes. Right now two bad keys out of 32 take down the engine.

We're testing a patch along these lines on our side and can send it here if that's the direction you want.

@hzh0425

hzh0425 commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator Author

Don't treat a partial batch failure as fatal. Keys that fail session start could be dropped from the load and re-prefilled — same idea as the vLLM mooncake connect

thanks you! how about provide anothor pr after this pr merged?

@hzh0425

hzh0425 commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator Author

/rerun-group radix_cache/unified_radix_tree

@github-actions

github-actions Bot commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Results for /rerun-group radix_cache/unified_radix_tree:

🚀 4-gpu-h100 (5 tests): ❌ View workflow run

cd test/ && python3 registered/radix_cache/unified_radix_tree/linker/test_unified_cache_linker_kl_dsv4.py
cd test/ && python3 registered/radix_cache/unified_radix_tree/test_unified_radix_cache_hicache_pp_kl.py
cd test/ && python3 registered/radix_cache/unified_radix_tree/test_unified_radix_cache_kl_cp.py
cd test/ && python3 registered/radix_cache/unified_radix_tree/test_unified_radix_cache_kl_dsv4.py
cd test/ && python3 registered/radix_cache/unified_radix_tree/test_unified_radix_cache_kl_mamba.py

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

cd test/ && python3 registered/radix_cache/unified_radix_tree/linker/test_unified_cache_linker_kl_glm52.py
cd test/ && python3 registered/radix_cache/unified_radix_tree/test_unified_radix_cache_kl_dsv4_pp.py
cd test/ && python3 registered/radix_cache/unified_radix_tree/test_unified_radix_cache_kl_glm52.py
cd test/ && python3 registered/radix_cache/unified_radix_tree/test_unified_radix_cache_kl_mimo.py

🚀 4-gpu-b200 (1 test): ✅ View workflow run

cd test/ && python3 registered/radix_cache/unified_radix_tree/test_unified_radix_cache_kl_dcp.py

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

cd test/ && python3 registered/radix_cache/unified_radix_tree/test_unified_radix_cache_kl_full.py
cd test/ && python3 registered/radix_cache/unified_radix_tree/test_unified_radix_cache_kl_swa.py

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

cd test/ && python3 registered/radix_cache/unified_radix_tree/test_unified_radix_cache_kl_hybrid_bitexact.py

@hzh0425

hzh0425 commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator Author

/rerun-group hicache

@github-actions

github-actions Bot commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Results for /rerun-group hicache:

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

cd test/ && python3 registered/hicache/test_hicache_spec_file_storage.py
cd test/ && python3 registered/hicache/test_hicache_variants.py

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

cd test/ && python3 registered/hicache/test_hicache_spec_mooncake_storage.py
cd test/ && python3 registered/hicache/test_hicache_storage_3fs_backend.py
cd test/ && python3 registered/hicache/test_hicache_storage_file_backend.py
cd test/ && python3 registered/hicache/test_hicache_storage_mooncake_backend.py
cd test/ && python3 registered/hicache/test_hicache_storage_runtime_attach_detach.py

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

cd test/ && python3 registered/hicache/test_hicache_storage.py

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

cd test/ && python3 registered/hicache/test_pp_with_hicache.py
cd test/ && python3 registered/hicache/test_qwen35_hicache.py

⛔ registered/hicache/test_hicache_storage_umbp_backend.py: test/registered/hicache/test_hicache_storage_umbp_backend.py is registered for AMD (suite nightly-amd-8-gpu-mi35x-deepseek-v4-flash), not for CUDA or CPU; rerun-test.yml has no AMD job. Rerun it with /rerun-failed-ci, or dispatch the AMD workflow manually.

@hzh0425

hzh0425 commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator Author

/rerun-test registered/radix_cache/unified_radix_tree/linker/test_unified_cache_linker_kl_dsv4.py registered/radix_cache/unified_radix_tree/test_unified_radix_cache_hicache_pp_kl.py registered/radix_cache/unified_radix_tree/test_unified_radix_cache_kl_cp.py

@github-actions

github-actions Bot commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Results for /rerun-test registered/radix_cache/unified_radix_tree/linker/test_unified_cache_linker_kl_dsv4.py registered/radix_cache/unified_radix_tree/test_unified_radix_cache_hicache_pp_kl.py registered/radix_cache/unified_radix_tree/test_unified_radix_cache_kl_cp.py:

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

cd test/ && python3 registered/radix_cache/unified_radix_tree/linker/test_unified_cache_linker_kl_dsv4.py
cd test/ && python3 registered/radix_cache/unified_radix_tree/test_unified_radix_cache_hicache_pp_kl.py
cd test/ && python3 registered/radix_cache/unified_radix_tree/test_unified_radix_cache_kl_cp.py

@hzh0425

hzh0425 commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator Author

/rerun-test registered/radix_cache/unified_radix_tree/test_unified_radix_cache_kl_mamba.py registered/radix_cache/unified_radix_tree/test_unified_radix_cache_kl_dsv4.py

@github-actions

github-actions Bot commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Results for /rerun-test registered/radix_cache/unified_radix_tree/test_unified_radix_cache_kl_mamba.py registered/radix_cache/unified_radix_tree/test_unified_radix_cache_kl_dsv4.py:

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

cd test/ && python3 registered/radix_cache/unified_radix_tree/test_unified_radix_cache_kl_mamba.py
cd test/ && python3 registered/radix_cache/unified_radix_tree/test_unified_radix_cache_kl_dsv4.py

@hzh0425 hzh0425 added the release-highlight Candidate PR for release note highlight label Sep 3, 2026
@hzh0425

hzh0425 commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator Author

The CI runs for both unified cache and hicache have completed; test-c-b300 is unstable,and that is unrelated to this PR.

@hzh0425

hzh0425 commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator Author

/rerun-test test_disaggregation_decode_radix_cache.py test_mimo_v2.py

@github-actions

github-actions Bot commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Results for /rerun-test test_disaggregation_decode_radix_cache.py test_mimo_v2.py:

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

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

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

cd test/ && python3 registered/models_e2e/test_mimo_v2.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hicache Hierarchical Caching for SGLang release-highlight Candidate PR for release note highlight run-ci CI: run the baseline test suite on this PR run-ci-extra CI: also run the extra suite (requires run-ci) unified-radix-cache

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants