Repository navigation
[rl] session KV holder: release running sessions' holds last, not never - #5477
Closed
felipemello1 wants to merge 2 commits into
Closed
felipemello1 wants to merge 2 commits into
felipemello1 wants to merge 2 commits into
Conversation
added 2 commits
October 17, 2026 19:13
Under memory pressure _evict_until_free released idle sessions and skipped sessions whose request runs. Once that request decodes, the hold alone keeps its prompt-end GDN state (and possibly a duplicate block), so under heavy pressure those pinned blocks made vLLM preempt running requests instead. Release sessions with no running request first, as before, then running sessions' holds, oldest hold first, until the floor is met. 1 H100, Qwen3.5-4B-Base TP1, multi-turn A/B (main vs this, interleaved): 310 blocks 233.7 -> 210.1 s (-10.1%), 372 blocks -3.4%, 434 blocks -0.3%.
Contributor
Author
|
Reply from claude: superseded by #5919, which deletes the session KV holder and evicts an ended rollout's KV from vLLM's prefix cache instead. Closing. |
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.
NOTE: H100 numbers; needs retesting on Blackwell.
TLDR: With the session KV holder on, a multi-turn run that outgrows GPU KV ran 9-15% slower than with no holder: the holder never releases the holds of sessions whose request is running. Releasing them last cuts the heavy case by 10% (233.7 -> 210.1 s), back to about no-holder speed. Headroom: no recipe turns the holder on yet.
Problem
VLLMSessionKVHolder._evict_until_freereleases idle sessions, idle longest first, and skips sessions whose request is running.Solution
_evict_until_free: iteratesorted(self._held, key=running_sessions.__contains__)and drop the skip.Results
1 H100, Qwen3.5-4B-Base TP1, FULL_DECODE_ONLY, 8 groups x 8 multi-turn rollouts (4 groups in flight, 4-10 turns, ~384-token replies, 512 tool tokens, ~2 s tool calls), KV pool set by
kv_cache_memory_bytes. Wall time for the whole workload; main and this PR interleaved in one process, main/PR/PR/main (434 blocks has a third pair):You may ask:
Test plan
pytest tests/rl/unit_tests/cpu/test_session_kv_holder.py:test_evict_until_free_releases_a_session_with_a_running_request_lastreplaces the skip test and fails on main.pytest tests/rl/unit_tests/cpu/test_generator.py tests/rl/unit_tests/cpu/test_engine_loop.py