[None][fix] Fix a capacity issue in KVCacheManagerV2 for SWA compatibility#12968
[None][fix] Fix a capacity issue in KVCacheManagerV2 for SWA compatibility#12968lfr-0531 merged 10 commits intoNVIDIA:mainfrom
Conversation
Signed-off-by: yuhangh <58161490+heyuhhh@users.noreply.github.com>
|
/bot help |
GitHub Bot Help
Provide a user friendly way for developers to interact with a Jenkins server. Run See details below for each supported subcommand. Details
Launch build/test pipelines. All previously running jobs will be killed.
kill
Kill all running builds associated with pull request. skip
Skip testing for latest commit on pull request. reuse-pipeline
Reuse a previous pipeline to validate current commit. This action will also kill all currently running builds associated with the pull request. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break. |
|
/bot run --disable-fail-fast |
📝 WalkthroughWalkthroughModified KV cache resizing logic in Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@tensorrt_llm/_torch/pyexecutor/resource_manager.py`:
- Around line 2297-2302: The generation warmup sets history_hint and passes it
to kv_cache.resize (history_hint = dummy_capacity if is_gen else None), but
subsequent resizes omit history_length and can desync history from capacity;
update every resize call performed during generation (both the main cache
kv_cache.resize(...) and the draft cache resize call(s) such as
draft_kv_cache.resize(...) or draft_cache.resize(...)) to pass
history_length=history_hint when is_gen is true (i.e., reuse the existing
history_hint/dummy_capacity variable) so all generation resizes remain in sync
and preserve the stale-block optimization.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 3087e83d-2ceb-48dc-9cc7-afb54932032f
📒 Files selected for processing (1)
tensorrt_llm/_torch/pyexecutor/resource_manager.py
|
PR_Github #42880 [ run ] triggered by Bot. Commit: |
|
PR_Github #42880 [ run ] completed with state
|
Signed-off-by: yuhangh <58161490+heyuhhh@users.noreply.github.com>
|
/bot run --disable-fail-fast |
|
PR_Github #42948 [ run ] triggered by Bot. Commit: |
|
PR_Github #42948 [ run ] completed with state
|
|
/bot run |
|
PR_Github #43027 [ run ] triggered by Bot. Commit: |
|
PR_Github #43027 [ run ] completed with state
|
|
/bot run --disable-fail-fast |
|
PR_Github #43064 [ run ] triggered by Bot. Commit: |
|
PR_Github #43064 [ run ] completed with state
|
|
/bot run |
|
PR_Github #43125 [ run ] triggered by Bot. Commit: |
|
PR_Github #43125 [ run ] completed with state
|
|
PR_Github #43319 [ run ] triggered by Bot. Commit: |
|
PR_Github #43319 [ run ] completed with state
|
|
/bot run |
|
PR_Github #43369 [ run ] triggered by Bot. Commit: |
|
@eopXD could you review this? thanks |
|
PR_Github #43369 [ run ] completed with state
|
|
/bot run |
|
PR_Github #43405 [ run ] triggered by Bot. Commit: |
|
PR_Github #43405 [ run ] completed with state
|
|
/bot run |
|
PR_Github #43471 [ run ] triggered by Bot. Commit: |
|
PR_Github #43471 [ run ] completed with state
|
|
/bot run --disable-fail-fast |
|
PR_Github #43523 [ run ] triggered by Bot. Commit: |
|
PR_Github #43523 [ run ] completed with state
|
|
/bot run |
|
PR_Github #43627 [ run ] triggered by Bot. Commit: |
|
PR_Github #43627 [ run ] completed with state
|
|
/bot run |
|
PR_Github #43648 [ run ] triggered by Bot. Commit: |
|
PR_Github #43648 [ run ] completed with state
|
|
/bot run |
|
PR_Github #43684 [ run ] triggered by Bot. Commit: |
|
PR_Github #43684 [ run ] completed with state |
|
Hi @nvpohanh @lowsfer , the CI has passed, could you please help to merge this PR? I've discussed with @yizhang-nv offline and he has approved this PR. |
Summary by CodeRabbit
Description
For generation phase we only need
ceil(window_size / tokens_per_block)blocks in SWA. Otherwise CacheManager can't handle the situation that applied blocks are more than reserved blocks, which may cause illegal memory access in warmup stagesTest Coverage
PR Checklist
Please review the following before submitting your PR:
PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.
PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.
Test cases are provided for new code paths (see test instructions)
Any new dependencies have been scanned for license and vulnerabilities
CODEOWNERS updated if ownership changes
Documentation updated as needed
Update tava architecture diagram if there is a significant design change in PR.
The reviewers assigned automatically/manually are appropriate for the PR.
Please check this after reviewing the above items as appropriate for this PR.
GitHub Bot Help
To see a list of available CI bot commands, please comment
/bot help.