Conversation
On follower TP ranks with backup_skip=True, sidecar_ok was set to bool(backup_transfers) which is False when no rank-sharded sidecar pools exist (e.g. DSV4 where all pools are MLA-replicated). This caused completed_tokens=0, signaling backup failure and preventing restore from ever triggering on follower ranks — ultimately causing NaN crashes on DSpark speculative hits (issue sgl-project#33656). Change sidecar_ok default to True: when backup_transfers is empty (nothing to write), the backup is vacuously successful because TP0 already persisted all replicated pools. The validation loop still runs and can set sidecar_ok=False if any rank-sharded sidecar write fails.
Leoyzen
requested review from
Ying1123,
alphabetc1,
hanming-lu,
hnyls2002,
hzh0425,
ispobock,
merrymercy,
xiezhq-hermann and
yizhang2077
as code owners
August 7, 2026 15:40
Leoyzen
force-pushed
the
fix/hicache-sidecar-ok-pure-mla
branch
from
August 7, 2026 15:42
3b8cf77 to
7612376
Compare
Contributor
|
completed_tokens tracks local backup work. Followers with no sidecars correctly report 0 but still ACK; restore uses a separate prefetch operation. So this cannot block restore or cause NaNs. But in the merged #30393, dsv4 mtp and dsv4 dspark should be in the packed path. Only dsv4+eagle3 uses the DRAFT sidecar, and its backup_skip is also fixed by should_backup() . Can you retest it ? Maybe you need also flush mooncake, because of the packed 3 dspark layers. @Leoyzen |
Leoyzen
added a commit
to Leoyzen/sglang
that referenced
this pull request
Aug 8, 2026
…project#32035 sgl-project#33656 sgl-project#32183 sgl-project#33145) Applied PRs (latest from GitHub): sgl-project#33288 Indexer logits OOM fix sgl-project#30393 HiCache packed/sidecar draft caches sgl-project#31170 DPA prefix_affinity load balancing sgl-project#33795 DSpark compact ragged-verify CUDA graph JIT race sgl-project#32467 C128 plan-kernel warp barrier sgl-project#33865 DSpark x prefill CP unblock sgl-project#30371 SWA state pool sizing (storage page) sgl-project#33358 FlashMLA norm-rope K-tokens-per-block ILP sgl-project#33872 num_draft_tokens clamp + extend_len==0 skip (supersede sgl-project#32183) sgl-project#34002 Sidecar backup vacuously-successful fix (replaces sgl-project#33656, with tests) sgl-project#33862 Reclaim redundant host mirrors after storage backup sgl-project#31315 Avoid repeated Mooncake gets after stale hits sgl-project#32327 Q8KV8 sparse MLA prefill backend (flashmla_sparse_q8) sgl-project#31668 Fix sidecar pool life-time (use-after-free on prefetch abort) sgl-project#31195 TP0 verify-token-budget broadcast (adapted to get_schedule() API) Dropped (per user request or superseded): sgl-project#32771 IndexCache C4 top-k reuse — has bug sgl-project#32035 DSpark C128 online compressor — has bug sgl-project#33656 Superseded by sgl-project#34002 (same fix + unit tests) sgl-project#32183 Superseded by sgl-project#33872 (included in supersede PR) sgl-project#33145 Base f01f706 already has superior reasoning-effort profile system Conflicts resolved: sgl-project#31195: adapted to base get_schedule().disable_overlap_schedule API sgl-project#32327: path remapped jit_kernel/ -> kernels/jit/ and kernels/ops/attention/ sgl-project#31668: applied cleanly on top of sgl-project#30393+sgl-project#34002+sgl-project#33862 modifications
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.
Motivation
When a pure-MLA model (e.g. DeepSeek-V4) runs with TP>1, follower TP ranks have no rank-sharded sidecars to back up — all pools are replicated and TP0 handles the writes. The
elsebranch of_page_backupsetsidecar_ok = bool(backup_transfers), which evaluated toFalsewhenbackup_transferswas empty, yieldingcompleted_tokens=0. This prevented L3 restore from ever triggering on follower ranks, causing NaN on DSpark speculative hits (issue #33656).Modifications
python/sglang/srt/mem_cache/hybrid_cache/hybrid_cache_controller.py—_page_backup()method,elsebranch (backup_skip=True, i.e. follower TP ranks):Changed
sidecar_ok = bool(backup_transfers)tosidecar_ok = True. When there are no rank-sharded sidecars, the follower rank's backup is vacuously successful — TP0 already persisted all replicated pools. The validation loop still runs for non-emptybackup_transfersand can setsidecar_ok=Falseon real failures.test/registered/unit/mem_cache/test_hybrid_cache_controller_page_backup.py— 3 new unit tests:test_pure_mla_follower_reports_success_with_no_sidecars— Bug regression: follower rank with emptybackup_transfers→completed_tokens > 0(fails pre-fix, passes post-fix)test_follower_sidecar_write_failure_reports_zero— Negative: non-emptybackup_transferswith failed writes →completed_tokens = 0test_follower_sidecar_write_success_reports_full— Positive: non-emptybackup_transferswith successful writes →completed_tokens = fullRegistered as
base-a-test-cpu(est_time=3s). All tests pass locally on CPU.Accuracy Tests
N/A — this change does not affect model outputs. It fixes the HiCache L3 backup/restore coordination path for pure-MLA models (DSV4 etc.) under TP>1.
Speed Tests and Profiling
N/A — no inference speed impact. The fix eliminates spurious backup-failure reporting on follower ranks when all pools are already replicated.
Checklist
Review and Merge Process
/tag-and-rerun-ci,/tag-run-ci-label,/rerun-failed-ciRelated #33656
CI States
Latest PR Test (Base): ❌ Run #31193950878
Latest PR Test (Extra): ❌ Run #31193947131