[HiCache][DSV4] Complete SWA pressure and host-pool fixes - #659
Merged
HanHan009527 merged 7 commits intoJul 23, 2026
Merged
Conversation
Backport upstream sgl-project#26615 so SWA prefix matches and inserts refresh only the active sliding-window ancestry instead of keeping the full walked prefix hot. Upstream-Commit: 6965fe0
Adapt the scheduler-side SWA pressure handling merged with upstream sgl-project#31681. Charge host hits separately, preserve the sliding-window reservation, and shrink chunked prefill to a page-aligned SWA capacity instead of rejecting the request indefinitely. Upstream-Commit: 02236fa
Adapt upstream sgl-project#30658 to the legacy host-pool layout used by deepseek_v4. Defer free-list concatenation until allocation needs released slots for the base, Mamba, V4 logical-anchor, and V4 paged pools. Upstream-Commit: 44e3dd2
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
This reverts commit 8c86698.
luoroger37
marked this pull request as ready for review
July 23, 2026 06:33
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
HanHan009527
approved these changes
Jul 23, 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.
Summary
This draft carries the complete P0 merge train for the current DSV4 deployment matrix:
6965fe0eec) — window-aware SWA LRU refresh.02236fa38c) — reusable scheduler semantics for shrinking chunked prefill under SWA pressure.44e3dd2713) — lazy host-pool free-list release, adapted to this fork's legacy/custom host pools.3c1f9eafa5,a375e9f3da) — eagerly release out-of-window SWA slots using the final page-aware/tombstone-safe upstream boundary.The full sgl-project#31681 commit also contains unrelated model code, so this PR carries its complete reusable scheduler hunk rather than importing unrelated files.
P1 items such as sgl-project#29310 and the sgl-project#27091/sgl-project#29460 metadata migration are intentionally excluded. The unmerged Decode retraction snapshot candidate is also excluded from the final diff.
Motivation
The existing DSV4 HiCache correctness backports made L2 recovery safer, but several P0 performance gaps remained:
Changes
Prefill SWA/HiCache pressure path
free_swa_out_of_window_slots()between scheduler decode eviction and UnifiedRadixCache unfinished-request insertion.max(sliding_window_size, page_size)so the last leaf cannot become all-tombstone;swa_evict_floorremains a hard lower bound.cache_protected_lenas the scheduler eviction floor;release_cache_protected_prefixthrough its existingswa_evict_release_prefix=Truepolicy because it has no SWA radix-tree state and reloads SWA from host storage.Correctness invariants
Validation
Passed locally:
git diff --check origin/bytedance/deepseek_v4...HEADpython3 -m compileall -qfor every modified runtime and test modulee177e5681497d92f3db21f46c09856ee204d4816cache_protected_lenas the floor;cache_protected_len.Not run locally because the isolated host Python has neither
torchnorpytest:test_prefill_adder.pytest_memory_pool_host_release.pytest_swa_eviction_boundary.pytest_unified_radix_cache_unittest.pyBefore marking ready, run repository CI and production-shaped validation:
Prefill
write_through,direct + page_first_directswa_full_tokens_ratio=0.1SGLANG_OPT_UNIFIED_CACHE_FREE_OUT_OF_WINDOW_SLOTS=1EIC compatibility
cache_protected_lenCI States
Latest PR Test: Not run yet⚠️ Not enabled — add
Latest PR Test (Extra):
run-ci-extralabel to opt in.