Skip to content

[None][fix] Fix kv_layout for FLASHINFER backend#13190

Merged
2ez4bz merged 3 commits into
NVIDIA:mainfrom
yechank-nvidia:flashinfer_kv
Apr 21, 2026
Merged

[None][fix] Fix kv_layout for FLASHINFER backend#13190
2ez4bz merged 3 commits into
NVIDIA:mainfrom
yechank-nvidia:flashinfer_kv

Conversation

@yechank-nvidia

@yechank-nvidia yechank-nvidia commented Apr 19, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

Release Notes

  • Bug Fixes

    • Fixed tensor handling in attention prefill operations for improved stability.
  • Refactor

    • Improved attention backend configuration for better compatibility and flexibility.

@yechank-nvidia yechank-nvidia self-assigned this Apr 19, 2026
@yechank-nvidia

Copy link
Copy Markdown
Collaborator Author

/bot run

@2ez4bz
2ez4bz marked this pull request as ready for review April 20, 2026 16:12
@2ez4bz
2ez4bz requested review from a team as code owners April 20, 2026 16:12
@coderabbitai

coderabbitai Bot commented Apr 20, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Two files updated: flashinfer attention backend now enforces tensor contiguity during ragged prefill kernel execution; modeling_radio refactors attention metadata initialization to conditionally set kv_layout for FLASHINFER backend while preserving defaults for others.

Changes

Cohort / File(s) Summary
FlashInfer Kernel Input Handling
tensorrt_llm/_torch/attention_backend/flashinfer.py
Updated forward_impl to enforce tensor contiguity by passing q.contiguous(), k.contiguous(), and v.contiguous() to wrapper.run() in the KV-cache-less ragged prefill path.
Attention Metadata Initialization
tensorrt_llm/_torch/models/modeling_radio.py
Refactored metadata instantiation to build a metadata_kwargs dictionary with conditional backend-specific configuration; sets kv_layout = "NHD" for FLASHINFER backend while preserving defaults for others.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description contains only a placeholder command '@coderabbitai summary' with no actual descriptive content, explanation, test coverage, or checklist verification. Replace the placeholder with a clear description of the issue being fixed, the solution approach, relevant test coverage, and verification of the PR checklist items.
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main changes: fixing kv_layout configuration for the FLASHINFER backend.

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

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

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
tensorrt_llm/_torch/attention_backend/flashinfer.py (1)

1-1: ⚠️ Potential issue | 🟠 Major

Add NVIDIA copyright header to this modified source file.

This file is modified, but Line 1 begins directly with imports and has no required header.

💡 Proposed fix
+# Copyright (c) 2025-2026, NVIDIA CORPORATION. All rights reserved.
+
 import math

As per coding guidelines, "All TensorRT-LLM source files must contain an NVIDIA copyright header with the year of latest meaningful modification".

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tensorrt_llm/_torch/attention_backend/flashinfer.py` at line 1, This file
(flashinfer.py) is missing the required NVIDIA copyright header at the top; add
the standard NVIDIA copyright header comment block including the year of latest
meaningful modification and the project/license statement as per coding
guidelines, placing it as the very first lines of
tensorrt_llm/_torch/attention_backend/flashinfer.py before any imports (ensure
the header includes the current year and matches the project's canonical header
format).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@tensorrt_llm/_torch/attention_backend/flashinfer.py`:
- Line 1: This file (flashinfer.py) is missing the required NVIDIA copyright
header at the top; add the standard NVIDIA copyright header comment block
including the year of latest meaningful modification and the project/license
statement as per coding guidelines, placing it as the very first lines of
tensorrt_llm/_torch/attention_backend/flashinfer.py before any imports (ensure
the header includes the current year and matches the project's canonical header
format).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 319760c2-858d-428b-8ab7-e15833df5a39

📥 Commits

Reviewing files that changed from the base of the PR and between 66431d8 and 818f4a8.

📒 Files selected for processing (2)
  • tensorrt_llm/_torch/attention_backend/flashinfer.py
  • tensorrt_llm/_torch/models/modeling_radio.py

@2ez4bz

2ez4bz commented Apr 20, 2026

Copy link
Copy Markdown
Collaborator

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #44489 [ run ] triggered by Bot. Commit: 5890a85 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #44489 [ run ] completed with state SUCCESS. Commit: 5890a85
/LLM/main/L0_MergeRequest_PR pipeline #34889 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

@yechank-nvidia

Copy link
Copy Markdown
Collaborator Author

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #44537 [ run ] triggered by Bot. Commit: 0b27ffa Link to invocation

@brb-nv brb-nv left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #44537 [ run ] completed with state SUCCESS. Commit: 0b27ffa
/LLM/main/L0_MergeRequest_PR pipeline #34932 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

@2ez4bz

2ez4bz commented Apr 21, 2026

Copy link
Copy Markdown
Collaborator

/bot run

@2ez4bz
2ez4bz enabled auto-merge (squash) April 21, 2026 04:21
@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #44617 [ run ] triggered by Bot. Commit: 0b27ffa Link to invocation

Signed-off-by: yechank <161688079+yechank-nvidia@users.noreply.github.com>
Signed-off-by: yechank <161688079+yechank-nvidia@users.noreply.github.com>
Signed-off-by: yechank <161688079+yechank-nvidia@users.noreply.github.com>
@yechank-nvidia

Copy link
Copy Markdown
Collaborator Author

/bot run

@github-actions

Copy link
Copy Markdown

👎 Promotion blocked, new vulnerability found

Vulnerability report

Component Vulnerability Description Severity
encode/uvicorn CVE-2020-7694 This affects all versions of package uvicorn. The request logger provided by the package is vulnerable to ASNI escape sequence injection. Whenever any HTTP request is received, the default behaviour of uvicorn is to log its details to either the console or a log file. When attackers request crafted URLs with percent-encoded escape sequences, the logging component will log the URL after it's been processed with urllib.parse.unquote, therefore converting any percent-encoded characters into their single-character equivalent, which can have special meaning in terminal emulators. By requesting URLs with crafted paths, attackers can: * Pollute uvicorn's access logs, therefore jeopardising the integrity of such files. * Use ANSI sequence codes to attempt to interact with the terminal emulator that's displaying the logs (either in real time or from a file). HIGH
encode/uvicorn CVE-2020-7695 Uvicorn before 0.11.7 is vulnerable to HTTP response splitting. CRLF sequences are not escaped in the value of HTTP headers. Attackers can exploit this to add arbitrary headers to HTTP responses, or even return an arbitrary response body, whenever crafted input is used to construct HTTP headers. MEDIUM

@yechank-nvidia

Copy link
Copy Markdown
Collaborator Author

/bot kill

@github-actions

Copy link
Copy Markdown

👎 Promotion blocked, new vulnerability found

Vulnerability report

Component Vulnerability Description Severity
encode/uvicorn CVE-2020-7694 This affects all versions of package uvicorn. The request logger provided by the package is vulnerable to ASNI escape sequence injection. Whenever any HTTP request is received, the default behaviour of uvicorn is to log its details to either the console or a log file. When attackers request crafted URLs with percent-encoded escape sequences, the logging component will log the URL after it's been processed with urllib.parse.unquote, therefore converting any percent-encoded characters into their single-character equivalent, which can have special meaning in terminal emulators. By requesting URLs with crafted paths, attackers can: * Pollute uvicorn's access logs, therefore jeopardising the integrity of such files. * Use ANSI sequence codes to attempt to interact with the terminal emulator that's displaying the logs (either in real time or from a file). HIGH
encode/uvicorn CVE-2020-7695 Uvicorn before 0.11.7 is vulnerable to HTTP response splitting. CRLF sequences are not escaped in the value of HTTP headers. Attackers can exploit this to add arbitrary headers to HTTP responses, or even return an arbitrary response body, whenever crafted input is used to construct HTTP headers. MEDIUM

@yechank-nvidia

Copy link
Copy Markdown
Collaborator Author

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #44673 [ run ] triggered by Bot. Commit: a7863a5 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #44673 [ run ] completed with state SUCCESS. Commit: a7863a5
/LLM/main/L0_MergeRequest_PR pipeline #35042 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

@yechank-nvidia

Copy link
Copy Markdown
Collaborator Author

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #44749 [ run ] triggered by Bot. Commit: a7863a5 Link to invocation

@2ez4bz

2ez4bz commented Apr 21, 2026

Copy link
Copy Markdown
Collaborator

/bot help

@github-actions

Copy link
Copy Markdown

GitHub Bot Help

/bot [-h] ['run', 'kill', 'skip', 'reuse-pipeline'] ...

Provide a user friendly way for developers to interact with a Jenkins server.

Run /bot [-h|--help] to print this help message.

See details below for each supported subcommand.

Details

run [--reuse-test (optional)pipeline-id --disable-fail-fast --skip-test --stage-list "A10-PyTorch-1, xxx" --gpu-type "A30, H100_PCIe" --test-backend "pytorch, cpp" --add-multi-gpu-test --only-multi-gpu-test --disable-multi-gpu-test --post-merge --extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx" --detailed-log --debug(experimental) --high-priority]

Launch build/test pipelines. All previously running jobs will be killed.

--reuse-test (optional)pipeline-id (OPTIONAL) : Allow the new pipeline to reuse build artifacts and skip successful test stages from a specified pipeline or the last pipeline if no pipeline-id is indicated. If the Git commit ID has changed, this option will be always ignored. The DEFAULT behavior of the bot is to reuse build artifacts and successful test results from the last pipeline.

--disable-reuse-test (OPTIONAL) : Explicitly prevent the pipeline from reusing build artifacts and skipping successful test stages from a previous pipeline. Ensure that all builds and tests are run regardless of previous successes.

--disable-fail-fast (OPTIONAL) : Disable fail fast on build/tests/infra failures.

--skip-test (OPTIONAL) : Skip all test stages, but still run build stages, package stages and sanity check stages. Note: Does NOT update GitHub check status.

--stage-list "A10-PyTorch-1, xxx" (OPTIONAL) : Only run the specified test stages. Examples: "A10-PyTorch-1, xxx". Note: Does NOT update GitHub check status.

--gpu-type "A30, H100_PCIe" (OPTIONAL) : Only run the test stages on the specified GPU types. Examples: "A30, H100_PCIe". Note: Does NOT update GitHub check status.

--test-backend "pytorch, cpp" (OPTIONAL) : Skip test stages which don't match the specified backends. Only support [pytorch, cpp, tensorrt, triton]. Examples: "pytorch, cpp" (does not run test stages with tensorrt or triton backend). Note: Does NOT update GitHub pipeline status.

--only-multi-gpu-test (OPTIONAL) : Only run the multi-GPU tests. Note: Does NOT update GitHub check status.

--disable-multi-gpu-test (OPTIONAL) : Disable the multi-GPU tests. Note: Does NOT update GitHub check status.

--add-multi-gpu-test (OPTIONAL) : Force run the multi-GPU tests in addition to running L0 pre-merge pipeline.

--post-merge (OPTIONAL) : Run the L0 post-merge pipeline instead of the ordinary L0 pre-merge pipeline.

--extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx" (OPTIONAL) : Run the ordinary L0 pre-merge pipeline and specified test stages. Examples: --extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx".

--detailed-log (OPTIONAL) : Enable flushing out all logs to the Jenkins console. This will significantly increase the log volume and may slow down the job.

--debug (OPTIONAL) : Experimental feature. Enable access to the CI container for debugging purpose. Note: Specify exactly one stage in the stage-list parameter to access the appropriate container environment. Note: Does NOT update GitHub check status.

--high-priority (OPTIONAL) : Run the pipeline with high priority. This option is restricted to authorized users only and will route the job to a high-priority queue.

kill

kill

Kill all running builds associated with pull request.

skip

skip --comment COMMENT

Skip testing for latest commit on pull request. --comment "Reason for skipping build/test" is required. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break.

reuse-pipeline

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.

@2ez4bz

2ez4bz commented Apr 21, 2026

Copy link
Copy Markdown
Collaborator

/bot skip --comment "Prior pipeline passed all stages except B200 which is undergoing maintenance"

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #44789 [ skip ] triggered by Bot. Commit: a7863a5 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #44789 [ skip ] completed with state SUCCESS. Commit: a7863a5
Skipping testing for commit a7863a5

Link to invocation

@2ez4bz
2ez4bz merged commit 4dd1a3d into NVIDIA:main Apr 21, 2026
5 checks passed
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