Skip to content

fix: prevent false decode retraction with SWA - #739

Merged
shiyu7 merged 1 commit into
ep_mainfrom
codex/fix-dspark-swa-eviction
Aug 25, 2026
Merged

shiyu7 merged 1 commit into
ep_mainfrom
codex/fix-dspark-swa-eviction

Conversation

@shiyu7

@shiyu7 shiyu7 commented Aug 25, 2026 •

Copy link
Copy Markdown
Collaborator

Motivation

In the DSPARK/DFLASH spec-v2 decode path, the common SWA maintenance call and decode_batch_idx tick 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 raised NotImplementedError and 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

  • Move speculative decode SWA/clock bookkeeping into spec_prepare_for_decode(), so EAGLE, DFLASH, and DSPARK share one owner.
  • Force an SWA reclamation pass in check_decode_mem() before decode retraction.
  • If CPU backup is unsupported, abort only the affected retracted request instead of terminating the scheduler.
  • Skip the unusable CPU backup when the final request is aborted for OOM.
  • Add CPU unit tests for speculative bookkeeping ownership, forced SWA reclamation, and retraction fail-safes.

Accuracy Tests

Validated on a 2-node DSV4 DSPARK disaggregated-decode setup based on bytedance-iaas/sglang:ep_main:

python -m sglang.test.run_eval \  --port 8080 \  --eval-name gpqa \  --num-examples 192 \  --max-tokens 64000 \  --repeat 3 \  --top-p 0.95 \  --temperature 1.0 \  --thinking-mode deepseek-v3
  • Completed all 3 × 192 examples without scheduler exit or retraction.
  • Scores: 0.870, 0.885, 0.880; mean 0.878.
  • Output throughput: 317.624 token/s.

Unit/static validation:

  • test_decode_bookkeeping_ownership.py: 2 passed
  • test_spec_prepare_for_decode.py: 2 passed
  • test_schedule_batch_swa_retraction.py: 5 passed
  • black --check, isort --check-only, py_compile, and git diff --check passed

Speed Tests and Profiling

No isolated speed comparison; the change only adds forced SWA maintenance after the normal memory check has already failed.

Checklist

  • Format code according to the contribution guide.
  • Add unit tests for the changed scheduler/speculative paths.
  • Provide end-to-end GPQA accuracy and throughput results.
  • Follow the SGLang code style guidance.
  • Documentation update (not applicable; no user-facing API change).

CI States

Latest PR Test (Base): ❌ Run #32817721599
Latest PR Test (Extra): ❌ Run #32817721495

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.
@shiyu7
shiyu7 merged commit d101149 into ep_main Aug 25, 2026
77 of 87 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants