Skip to content

[mem_cache] Replace is_chunk_cache / is_tree_cache with supports_prefix_sharing - #42362

Merged
hnyls2002 merged 1 commit into
mainfrom
lsyin/supports-prefix-sharing
Oct 3, 2026
Merged

hnyls2002 merged 1 commit into
mainfrom
lsyin/supports-prefix-sharing

Conversation

@hnyls2002

@hnyls2002 hnyls2002 commented Oct 3, 2026 •

Copy link
Copy Markdown
Collaborator
  • Replace BasePrefixCache.is_chunk_cache() / is_tree_cache() with one capability, supports_prefix_sharing(): whether a request's prefix stays in the cache for other requests to share, including after the request finishes. UnifiedRadixCache returns not self.disable, so a disabled unified tree no longer reads as "not a tree cache".
  • Every call site asks this question (skip eviction when nothing is retained, free SWA up to the window edge when nothing is inserted, no tree root / sanity check / mamba states / elastic namespace), so the name now says it.
  • free_swa_out_of_window_slots(is_chunk_cache=False) becomes supports_prefix_sharing=True.
  • Pure rename with negation; no behavior change. RadixCache with disable=True and the remaining tree_cache.disable readers are left as is.

CI States

Latest PR Test (Base): 🚫 Run #37107458338
Latest PR Test (Extra): ❌ Run #37107458300
Latest PR Test (AMD ROCm 10): ❌ Run #37107458384

@hnyls2002

Copy link
Copy Markdown
Collaborator Author

/rerun-test test_gemma4_unified_swa_virtual_ids.py test_swa_radix_cache_kl.py test_streaming_session_swa.py test_mamba2_extra_buffer_kl.py

@github-actions

github-actions Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Results for /rerun-test test_gemma4_unified_swa_virtual_ids.py test_swa_radix_cache_kl.py test_streaming_session_swa.py test_mamba2_extra_buffer_kl.py:

🚀 1-gpu-h100 (4 tests): ✅ View workflow run

cd test/ && python3 registered/attention/test_gemma4_unified_swa_virtual_ids.py
cd test/ && python3 registered/radix_cache/test_swa_radix_cache_kl.py
cd test/ && python3 registered/sessions/test_streaming_session_swa.py
cd test/ && python3 registered/radix_cache/test_mamba2_extra_buffer_kl.py

@hnyls2002

Copy link
Copy Markdown
Collaborator Author

/tag-and-rerun-ci

@github-actions github-actions Bot added the run-ci CI: run the baseline test suite on this PR label Oct 3, 2026
@hnyls2002
hnyls2002 merged commit 122b591 into main Oct 3, 2026
201 of 253 checks passed
@hnyls2002
hnyls2002 deleted the lsyin/supports-prefix-sharing branch October 3, 2026 09:07
@metamergebot metamergebot mentioned this pull request Oct 3, 2026
4 of 5 tasks
nvpohanh added a commit to peilii/sglang that referenced this pull request Oct 5, 2026
Resolve conflicts with main:
- schedule_policy.py: fold main's new max_prefix_len cap into
  _req_radix_key, and gate the refresh on supports_prefix_sharing()
  since main removed is_chunk_cache() (sgl-project#42362).
- unified_radix_cache.py: keep refresh_device_prefix next to main's
  supports_prefix_sharing().
- streaming_session.py: take main's version. StreamingSession is no
  longer a BasePrefixCache wrapper (sgl-project#42295), so the
  refresh_device_prefix forwarder and its wrapper test are dropped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
wangwenmingaa pushed a commit to wangwenmingaa/sglang that referenced this pull request Oct 8, 2026
Keep the eviction-headroom reserve from this PR while adopting
upstream sgl-project#39479, which switched the unified hybrid-SWA call site from
evict_for_alloc() to evict() so cumulative reclaim quotas are fully
honored. Update the unit-test assertion accordingly and refresh the
mocked tree-cache guard renamed by sgl-project#42362 (is_chunk_cache ->
supports_prefix_sharing).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hicache Hierarchical Caching for SGLang 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.

2 participants