Skip to content

[https://nvbugs/6248764][fix] Normalize non-sliding KV windows to full attention in AutoDeploy - #14906

Merged
eopXD merged 2 commits into
NVIDIA:mainfrom
eopXD:nvbugs-fix
Jun 5, 2026
Merged

[https://nvbugs/6248764][fix] Normalize non-sliding KV windows to full attention in AutoDeploy#14906
eopXD merged 2 commits into
NVIDIA:mainfrom
eopXD:nvbugs-fix

Conversation

@eopXD

@eopXD eopXD commented Jun 3, 2026

Copy link
Copy Markdown
Collaborator

A KV-cache layer whose sliding_window >= max_seq_len can never slide and is functionally full attention. The AutoDeploy kvcache transform was keying pool grouping off the raw sliding_window, so such a layer forked its own pool and tripped the trtllm backend's uniform-cache requirement.

For google/gemma-3-1b-it at max_seq_len=511, the local layers' sliding_window=512 produced a window=512 pool alongside the global window=511 pool, failing with: KV resources are not uniform ... requires all KV caches to share a single pool.

This normalizes sliding_window to 0 (full attention) when it is >= max_seq_len before grouping, so the layer shares the full-attention pool.

Test coverage

  • Unwaives test_autodeploy_from_registry[google_gemma-3-1b-it-False].

Summary by CodeRabbit

  • Bug Fixes

    • Fixed KV cache resource pool grouping for layers with large sliding windows.
  • Tests

    • Resolved previously failing Gemma 3.1B autodeploy accuracy test.

Review Change Stack

@eopXD
eopXD requested a review from a team as a code owner June 3, 2026 11:29
@eopXD
eopXD requested a review from marinayanov June 3, 2026 11:29
@coderabbitai

coderabbitai Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

The PR fixes KV cache pool grouping by detecting and normalizing oversized sliding_window values in KVPagedResourceHandler that cannot slide within max_seq_len, rewriting them to 0 to force full-attention pooling semantics. A previously skipped test now passes with this fix.

Changes

KVCache Pool Grouping Normalization

Layer / File(s) Summary
KVCache sliding window normalization
tensorrt_llm/_torch/auto_deploy/transform/library/kvcache.py
Detects KVPagedResourceHandler instances where sliding_window >= max_seq_len and rewrites sliding_window to 0 to ensure they use full-attention pooling instead of creating redundant separate pools.
Test waiver removal
tests/integration/test_lists/waives.txt
Removes SKIP waiver for test_autodeploy_from_registry[google_gemma-3-1b-it-False], validating that the sliding window normalization fix resolves the previously failing test.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Suggested reviewers

  • greg-kwasniewski1
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and specifically describes the main change: normalizing KV windows to full attention in AutoDeploy, matching the core fix in the changeset.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed PR description clearly explains the issue, solution, and test coverage with specific details about the problem and fix.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


Comment @coderabbitai help to get the list of available commands and usage tips.

eopXD added 2 commits June 3, 2026 19:33
…l attention in AutoDeploy

The AutoDeploy kvcache transform keyed KV-cache pool grouping off the raw
KVPagedResourceHandler.sliding_window (via __eq__). A layer whose
sliding_window is >= max_seq_len can never slide and is functionally full
attention, but it still compared unequal to the full-attention handlers
(sliding_window=0), forking a redundant single-window pool.

For google/gemma-3-1b-it run with max_seq_len=511, the local layers'
sliding_window=512 produced a window=512 pool alongside the global
window=511 pool, tripping the trtllm backend's uniform-cache requirement:
"KV resources are not uniform ... requires all KV caches to share a single
pool."

Normalize sliding_window to 0 when it is >= max_seq_len before grouping, so
such layers share the full-attention pool. Mirrors the KVCacheManager window
clamp in resource_manager.py for the shim/grouping path.

Signed-off-by: Yueh-Ting Chen <yuehtingc@nvidia.com>
…ry test

The non-uniform KV pool failure for
test_autodeploy_from_registry[google_gemma-3-1b-it-False] is resolved by
normalizing non-sliding KV windows to full attention, so remove its SKIP
waiver.

Signed-off-by: Yueh-Ting Chen <yuehtingc@nvidia.com>
@eopXD

eopXD commented Jun 3, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #51834 [ run ] triggered by Bot. Commit: b3bf607 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #51834 [ run ] completed with state SUCCESS. Commit: b3bf607
/LLM/main/L0_MergeRequest_PR pipeline #41196 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

Link to invocation

@tburt-nv

tburt-nv commented Jun 3, 2026

Copy link
Copy Markdown
Collaborator

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #51894 [ run ] triggered by Bot. Commit: b3bf607 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #51894 [ run ] completed with state FAILURE. Commit: b3bf607
/LLM/main/L0_MergeRequest_PR pipeline #41252 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

Link to invocation

@eopXD

eopXD commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #52199 [ run ] triggered by Bot. Commit: b3bf607 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #52199 [ run ] completed with state SUCCESS. Commit: b3bf607
/LLM/main/L0_MergeRequest_PR pipeline #41520 completed with status: 'SUCCESS'

CI Report

Link to invocation

@eopXD
eopXD merged commit df2d5b9 into NVIDIA:main Jun 5, 2026
7 checks passed
fbxai pushed a commit to fbxai/TensorRT-LLM that referenced this pull request Jun 5, 2026
…l attention in AutoDeploy (NVIDIA#14906)

Signed-off-by: Yueh-Ting Chen <yuehtingc@nvidia.com>
Signed-off-by: NVFB <186336021+NVFB@users.noreply.github.com>
2ez4bz pushed a commit to 2ez4bz/TensorRT-LLM that referenced this pull request Jun 8, 2026
…l attention in AutoDeploy (NVIDIA#14906)

Signed-off-by: Yueh-Ting Chen <yuehtingc@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants