[None][feat] Add radix tree cache priority boost and store chunked context blocks#12696
Draft
lancelly wants to merge 1 commit intoNVIDIA:feat/bench_yfrom
Draft
[None][feat] Add radix tree cache priority boost and store chunked context blocks#12696lancelly wants to merge 1 commit intoNVIDIA:feat/bench_yfrom
lancelly wants to merge 1 commit intoNVIDIA:feat/bench_yfrom
Conversation
…ntext blocks Cherry-pick Features A and B from PR NVIDIA#12481 (improve-scheduler) onto feat/bench_y. Feature A (Radix tree cache priority boost): - Blocks in the radix tree get priority boosted (kRadixTreeBlockPriority = kDefaultPriority + 10) on release, so truly-free blocks are evicted first, preserving cached data longer. - Adds getNumTrulyFreeBlocks() to distinguish empty blocks from cached ones. Feature B (Store chunked context blocks): - New storeChunkedContextBlocks() method stores full blocks from a completed (non-final) context chunk immediately, enabling prefix sharing with concurrent requests before the full context finishes processing. - Integrated into both TRT and PyTorch (PyExecutor) backends. - SWA windows are skipped (their block boundaries are unstable mid-context). Note: Feature C (reservation-based scheduling) from PR NVIDIA#12481 is intentionally excluded. The pinning infrastructure (boostReservedBlock/unpinAllReservedBlocks) is also excluded as it has no call site without Feature C. Signed-off-by: Lanyu Liao <lancelly@users.noreply.github.com>
e3dd6a4 to
85a4299
Compare
SimengLiu-nv
approved these changes
Apr 2, 2026
| auto const kMaxPriority = executor::KvCacheRetentionConfig::kMaxRetentionPriority; | ||
|
|
||
| auto const kDefaultPriority = executor::KvCacheRetentionConfig::kDefaultRetentionPriority; | ||
| // No longer used for priority boosting (pinning replaced it), but kept for backward compat. |
Collaborator
There was a problem hiding this comment.
Can remove this comment later.
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
Cherry-pick Features A and B from PR #12481 (
improve-scheduler) ontofeat/bench_y.kRadixTreeBlockPriority = kDefaultPriority + 10) on release, so truly-free blocks are evicted first, preserving cached data longer. AddsgetNumTrulyFreeBlocks()to distinguish empty blocks from cached ones.storeChunkedContextBlocks()stores full blocks from a completed (non-final) context chunk immediately, enabling prefix sharing with concurrent requests before the full context finishes. Integrated into both TRT and PyTorch backends. SWA windows are skipped.