Skip to content

Support speculative decoding with unified SWA memory - #36403

Merged
merrymercy merged 4 commits into
sgl-project:mainfrom
ZYHowell:yonghao/unified-memory-spec-decoding
Sep 3, 2026
Merged

merrymercy merged 4 commits into
sgl-project:mainfrom
ZYHowell:yonghao/unified-memory-spec-decoding

Conversation

@ZYHowell

@ZYHowell ZYHowell commented Aug 26, 2026 •

Copy link
Copy Markdown
Collaborator

Motivation

Unified-memory hybrid-SWA targets need speculative draft pools to address the target allocator's full virtual-ID range even when the SWA pool has a smaller physical capacity. Without this, draft KV allocation and locked-node SWA recovery can use inconsistent mappings or under-size the shared pool.

Modifications

  • Separate virtual-page capacity from physical-page capacity for non-owner unified allocators.
  • Size speculative draft pools from the shared virtual-ID span and register identity mappings when draft SWA layers consume those IDs directly.
  • Preserve SWA page bindings while recovering locked full-attention entries.
  • Account for target and draft allocations together when sizing unified hybrid-SWA pools.

Accuracy Tests

Not applicable; this changes KV-pool allocation and mapping rather than model numerics.

Speed Tests and Profiling

Not run; no kernel or model-forward changes.

Test Plan

  • pytest -q test/registered/unit/model_executor/test_pool_configurator.py test/registered/unit/mem_cache/test_multi_ended_allocator.py test/registered/unit/mem_cache/test_unified_radix_cache_unittest.py — 1233 passed, 1115 skipped, 52 subtests passed.
  • pre-commit run --files <six changed files> — passed.
  • python3 -m py_compile <six changed files> — passed.

Original commits

  • f70b8ee89

Checklist

  • Format your code according to the formatting guide.
  • Add unit tests according to the unit-test guide.
  • Documentation is not required for this internal allocator behavior change.
  • Accuracy and speed benchmarks are not applicable because model computation is unchanged.
  • Follow the SGLang code style guidance.

CI States

Latest PR Test (Base): ❌ Run #33701038576
Latest PR Test (Extra): ❌ Run #33701038383
Latest PR Test (AMD ROCm 7.2): ❌ Run #33701038531

@ZYHowell

Copy link
Copy Markdown
Collaborator Author

/tag-and-rerun-ci

@github-actions github-actions Bot added unified-radix-cache memory-pool run-ci CI: run the baseline test suite on this PR labels Aug 26, 2026
@ZYHowell

Copy link
Copy Markdown
Collaborator Author

/rerun-failed-ci

12 similar comments
@ZYHowell

Copy link
Copy Markdown
Collaborator Author

/rerun-failed-ci

@ZYHowell

Copy link
Copy Markdown
Collaborator Author

/rerun-failed-ci

@ZYHowell

Copy link
Copy Markdown
Collaborator Author

/rerun-failed-ci

@ZYHowell

Copy link
Copy Markdown
Collaborator Author

/rerun-failed-ci

@ZYHowell

Copy link
Copy Markdown
Collaborator Author

/rerun-failed-ci

@ZYHowell

Copy link
Copy Markdown
Collaborator Author

/rerun-failed-ci

@ZYHowell

Copy link
Copy Markdown
Collaborator Author

/rerun-failed-ci

@ZYHowell

Copy link
Copy Markdown
Collaborator Author

/rerun-failed-ci

@ZYHowell

Copy link
Copy Markdown
Collaborator Author

/rerun-failed-ci

@ZYHowell

Copy link
Copy Markdown
Collaborator Author

/rerun-failed-ci

@ZYHowell

Copy link
Copy Markdown
Collaborator Author

/rerun-failed-ci

@ZYHowell

Copy link
Copy Markdown
Collaborator Author

/rerun-failed-ci

@ZYHowell

Copy link
Copy Markdown
Collaborator Author

/rerun-failed-ci

1 similar comment
@ZYHowell

Copy link
Copy Markdown
Collaborator Author

/rerun-failed-ci

yhzhuang and others added 2 commits September 1, 2026 15:04
@ZYHowell
ZYHowell force-pushed the yonghao/unified-memory-spec-decoding branch from 8aa7f2f to e887a18 Compare September 1, 2026 22:04
Comment thread python/sglang/srt/mem_cache/kv_cache_configurator.py Outdated
@ZYHowell
ZYHowell requested a review from merrymercy September 2, 2026 20:50
@merrymercy
merrymercy merged commit 23ab10a into sgl-project:main Sep 3, 2026
667 of 829 checks passed
StevenChenSE pushed a commit to StevenChenSE/sglang that referenced this pull request Sep 6, 2026
Co-authored-by: yhzhuang <yhzhuang@fb.com>
Co-authored-by: Lianmin Zheng <lianminzheng@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bypass-fastfail memory-pool run-ci CI: run the baseline test suite on this PR unified-radix-cache

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants