Repository navigation
fix: prevent false decode retraction with SWA - #739
Merged
Merged
Conversation
Move speculative decode bookkeeping into the common dispatcher so DFLASH and DSPARK perform the same SWA maintenance as EAGLE. Force an SWA reclamation pass before decode retraction and abort only the affected request when the active KV pool cannot create a CPU backup.
luoroger37
approved these changes
Aug 25, 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.
Motivation
In the DSPARK/DFLASH spec-v2 decode path, the common SWA maintenance call and
decode_batch_idxtick were missing. As a result, out-of-window SWA pages accumulated until the generic decode OOM path retracted a request. The active DSV4 SWA KV pool does not implement CPU-copy backup, so retraction raisedNotImplementedErrorand terminated the scheduler.This complements sgl-project#36185: host-pool-backed resumable retraction remains useful when available, while this change reclaims SWA before retraction and keeps unsupported backup from crashing the whole decode worker.
Modifications
spec_prepare_for_decode(), so EAGLE, DFLASH, and DSPARK share one owner.check_decode_mem()before decode retraction.Accuracy Tests
Validated on a 2-node DSV4 DSPARK disaggregated-decode setup based on
bytedance-iaas/sglang:ep_main:0.870,0.885,0.880; mean0.878.317.624 token/s.Unit/static validation:
test_decode_bookkeeping_ownership.py: 2 passedtest_spec_prepare_for_decode.py: 2 passedtest_schedule_batch_swa_retraction.py: 5 passedblack --check,isort --check-only,py_compile, andgit diff --checkpassedSpeed Tests and Profiling
No isolated speed comparison; the change only adds forced SWA maintenance after the normal memory check has already failed.
Checklist
CI States
Latest PR Test (Base): ❌ Run #32817721599
Latest PR Test (Extra): ❌ Run #32817721495