Skip to content

[mem_cache] Move mamba state and retraction_backup into ReqKvInfo - #37164

Merged
hnyls2002 merged 6 commits into
mainfrom
lsyin/kv-ownership-pr5b
Aug 31, 2026
Merged

hnyls2002 merged 6 commits into
mainfrom
lsyin/kv-ownership-pr5b

Conversation

@hnyls2002

@hnyls2002 hnyls2002 commented Aug 30, 2026 •

Copy link
Copy Markdown
Collaborator

Move the mamba fields (mamba_pool_idx, the ping-pong track fields, mamba_cow_src_index, mamba_needs_clear) and retraction_backup from Req / SessionSlot into ReqKvInfo, completing the record of per-request resources that live outside the prefix cache. Req.detach_kv() now hands mamba state and the retraction backup over together with the KV row, so the per-field copy and clear blocks in SessionSlot.save_from_req / restore_to_req and the mamba kwargs on the mid-abort ephemeral slot disappear; SessionSlot is down to the shared ReqKvInfo, the tree lock handles, and its virtual_node. The getattr(req, "mamba_*", None) call sites become direct reads -- with the record always present the fallback would silently return the default forever. mamba_lazy_is_insert stays on Req (a scheduling flag, not a resource handle), and the same-named MatchResult.mamba_branching_seqlen is unrelated and untouched. Pure relocation, no behavior change. Stacks on #37108.


CI States

Latest PR Test (Base): 🚫 Run #33358305272
Latest PR Test (Extra): 🚫 Run #33358305110
Latest PR Test (AMD ROCm 7.2): 🚫 Run #33358305233

@hnyls2002
hnyls2002 force-pushed the lsyin/kv-ownership-pr5b branch from 9ed7971 to 669d89e Compare August 30, 2026 23:38
@hnyls2002 hnyls2002 added run-ci CI: run the baseline test suite on this PR run-ci-extra CI: also run the extra suite (requires run-ci) high priority bypass-fastfail labels Aug 30, 2026
# Conflicts:
#	test/registered/unit/mem_cache/test_streaming_session_unit.py
@hnyls2002

hnyls2002 commented Aug 31, 2026 •

Copy link
Copy Markdown
Collaborator Author

Latest PR Test (Base): ✅ Run #33343014722
Latest PR Test (Extra): ✅ Run #33343014656

@hnyls2002
hnyls2002 merged commit 5d12ad4 into main Aug 31, 2026
77 of 183 checks passed
@hnyls2002
hnyls2002 deleted the lsyin/kv-ownership-pr5b branch August 31, 2026 05:03
StevenChenSE pushed a commit to StevenChenSE/sglang that referenced this pull request Sep 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

apple-silicon bypass-fastfail high priority memory-pool run-ci CI: run the baseline test suite on this PR run-ci-extra CI: also run the extra suite (requires run-ci) unified-radix-cache

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant