[https://nvbugs/6330273][fix] Reserve KV cache slots for concurrent decode in V2#15462
Open
Kevin-Li-2025 wants to merge 2 commits into
Open
[https://nvbugs/6330273][fix] Reserve KV cache slots for concurrent decode in V2#15462Kevin-Li-2025 wants to merge 2 commits into
Kevin-Li-2025 wants to merge 2 commits into
Conversation
Contributor
📝 WalkthroughWalkthrough
ChangesConcurrent decode constraint for windowed KV cache pools
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Signed-off-by: Kevin-Li-2025 <2242139@qq.com>
5755532 to
36634a6
Compare
Collaborator
|
@lowsfer could you review this? |
Signed-off-by: Kevin-Li-2025 <2242139@qq.com>
0c8e844 to
75e8beb
Compare
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.
Description
Fixes #15401.
KVCacheManagerV2can under-reserve windowed pool slots when capacity planning only sees long-history requests. For small sliding windows, the stale range can leave a windowed pool with a min-slot floor of 1, which can deadlock scheduling once concurrent decode requests exceed that single slot.This adds a generic concurrent-decode constraint to the V2 cache config:
max_batch_sizerequests at one token block withhistory_length=tokens_per_block - 1. Each decode request needs one slot in every pool group, so this floors the min slots atmax_batch_sizewithout changing scheduler behavior.The config also sets the existing StorageManager fallback typical-step explicitly, so adding the constraint does not accidentally switch ratio selection to constraint-only sizing.
Tests
python3 -m py_compile tensorrt_llm/_torch/pyexecutor/kv_cache_manager_v2.py tests/unittest/_torch/executor/test_per_layer_head_dim.pygit diff --checkI attempted the targeted pytest, but local collection is blocked by a missing
nvtxdependency in this checkout.Summary by CodeRabbit
New Features
Tests