Repository navigation
[Disagg] Validate state strides before Mooncake transfers - #41607
Merged
ShangmingCai merged 1 commit intoOct 1, 2026
Merged
Conversation
aurickq
requested review from
ByronHsu,
Duyi-Wang,
HaiShaw,
ShangmingCai,
hnyls2002 and
sogalin
as code owners
September 29, 2026 01:06
Contributor
Author
|
/tag-and-rerun-ci |
aurickq
force-pushed
the
codex/pd-state-stride-validation
branch
from
September 30, 2026 22:38
ca8703e to
a63ef02
Compare
aurickq
force-pushed
the
codex/pd-state-stride-validation
branch
from
September 30, 2026 22:43
a63ef02 to
ca8703e
Compare
aurickq
force-pushed
the
codex/pd-state-stride-validation
branch
3 times, most recently
from
September 30, 2026 23:18
1098ba7 to
28e790d
Compare
aurickq
force-pushed
the
codex/pd-state-stride-validation
branch
from
September 30, 2026 23:35
28e790d to
bf4ed94
Compare
ShangmingCai
approved these changes
Oct 1, 2026
ShangmingCai
left a comment
Collaborator
There was a problem hiding this comment.
Looks good. We could merge this one first, I will try to make a following PR to see whether we could turn this from per-request level check to per-PD-pair level check.
This was referenced Oct 2, 2026
LinyuanLi0046
added a commit
to LinyuanLi0046/sglang
that referenced
this pull request
Oct 19, 2026
Port existing community lifecycle code onto b85c644. Fixed upstream source: 0dc6de2. Keep generation-tagged ABORT/ACK state across sender cleanup, count dequeued and in-flight transfers, drain running transfer futures, poison uncertain native failures, and retain decode KV plus metadata until ACK or the community device-destination timeout. Resolve held releases before decode scheduling gates and account for them in scheduler idle checks. Complete the existing cached-prefix event handoff through the worker. Use shared terminal-status helpers and socket locks for failure fanout and to prevent Success after cancellation. Migrated upstream implementations and provenance: - 97dedd1 (sgl-project#35049): device deferred release, ACK tracking, future draining and worker drain integration. - adca19c (sgl-project#35360): common ACK helpers, unique prefill rank and dequeue-before-status accounting. - 8ef6d31 (sgl-project#40645): preserve pending drain ACK targets across sender cleanup. - cd11037 (sgl-project#41023): default-on setting and explicit backend capability gate. - 14ab74e (sgl-project#41402): ACK endpoint fanout. - 2a1c477 (sgl-project#41404): defer all eligible failure paths and force-arm partial metadata publication. - 8293f9a (sgl-project#37077): shared ABORT/ACK types, generation filtering and common target/poison state. - 4195980 (sgl-project#43719): suppress drained ACK after uncertain native KV/state/aux failure. - f9df334 (sgl-project#44386): pending decode releases keep the scheduler non-idle. - c683190 (sgl-project#41395): cached-prefix ready-event forwarding and worker-side synchronization. - 2a46cf2 (sgl-project#36612): terminal/cleared room handling, first failure cause and shared failure/status fanout. - abddb1c (sgl-project#32541): state-send return propagation and per-cached-socket send locking. - 05c7ebf (sgl-project#30545): staging_counted and outstanding accounting across worker requeue/completion. - 8ad7641 (sgl-project#36160): common wait_event job field used by the early-send handoff. - 5b5d721 (sgl-project#40703): worker cleanup precedes outstanding-entry removal. - 348689d (sgl-project#38959): sender poll wrapper holds Success while counted transfers remain. - 1a0250c (sgl-project#41607): check Failed after state transfer before continuing to aux. - 8bf780d (sgl-project#41128): retain deferred release start_time/deadline tuple shape without its new metrics API. - 4dc9cda (sgl-project#37454): decode-side backend capability check before deferring a failed request. Baseline compatibility adaptations: - Insert selected snippets into existing server_args/configuration and worker/listener layout; retain local request timing and transfer batching. - Omit absent deferred-allocation/bootstrap ownership, role-switch teardown, host-receive and PP-consensus branches; import no placeholder subsystems. - Keep baseline 30-second socket timeout, optional sender-table guards and three-frame Mooncake status wire format; serialize existing manager sends with the imported endpoint locks. - Use release_kv_cache(req, tree_cache, is_insert=False), the old failed request release API, and the existing scheduler invariant-check entrypoint. - Omit unavailable new deferred-release metrics without importing the full metrics refactor; retain existing local metrics and diagnostics. No WELM/NPU layerwise additions are included. Device timeout behavior and backend capability defaults match the pinned community source. Validation: 48 external CPU protocol/worker/decode cases; source AST comparison for unadapted helpers; Python syntax, isort and configured Ruff checks; git diff --check. CPU fixtures remain outside this repository. No NPU/RDMA hardware execution was available for this commit.
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.
Why is this change needed?
Mooncake receives destination entry sizes during registration, but its generic state-transfer path uses the prefill entry size for both destination addressing and copy length without checking the decode stride. A mismatch can therefore submit a successful transfer to the wrong slot. For example, with a 32-byte prefill entry and a 64-byte decode entry, destination slot 5 is addressed at offset 160 instead of 320, and only 32 bytes are copied.
Forward the existing destination-size metadata and validate mapped strides before submitting the state transfer. Reuse the existing layer-ID and pipeline-stage mapping, including grouped C4 state. Compatible layouts retain their existing transfer plan; the wire format is unchanged.
On a stride mismatch, log the precise cause and mark only the affected request
KVPoll.Failedthroughconclude_failure. Stop its remaining state and auxiliary writes, then run the existing worker cleanup. The session is not blacklisted for this validation failure; actual transport failures retain their existing handling.Related: #25036 describes speculative/non-speculative compressor-ring layouts differing between prefill and decode.
Test Plan
CI States
Latest PR Test (Base): ✅ Run #36791844810⚠️ Not enabled -- add
Latest PR Test (Extra):
run-ci-extralabel to opt in.Latest PR Test (AMD ROCm 10): ❌ Run #36791844758