Skip to content

[TRTLLM-12982][perf] remove sync after FlashInfer attention plan() - #14634

Merged
ixlmar merged 1 commit into
NVIDIA:mainfrom
ixlmar:perf/remove-sync
May 29, 2026
Merged

[TRTLLM-12982][perf] remove sync after FlashInfer attention plan()#14634
ixlmar merged 1 commit into
NVIDIA:mainfrom
ixlmar:perf/remove-sync

Conversation

@ixlmar

@ixlmar ixlmar commented May 27, 2026

Copy link
Copy Markdown
Collaborator

Description

This sync appears not to be necessary.

Test Coverage

pytest -svx "accuracy/test_llm_api_pytorch_multimodal.py::TestNemotron_Nano_12B_V2_VL::test_auto_dtype" still succeeds.

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)

  • If PR introduces API changes, an appropriate PR label is added - either api-compatible or api-breaking. For api-breaking, include BREAKING in the PR title.

  • 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.

Summary by CodeRabbit

  • Refactor
    • Optimized internal attention computation performance in the FlashInfer backend.

Review Change Stack

@ixlmar

ixlmar commented May 27, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run

@ixlmar
ixlmar requested a review from yechank-nvidia May 27, 2026 14:28
@ixlmar
ixlmar force-pushed the perf/remove-sync branch from e50c18a to 57838fe Compare May 27, 2026 14:28
@ixlmar

ixlmar commented May 27, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run

@ixlmar
ixlmar marked this pull request as ready for review May 27, 2026 14:28
@ixlmar
ixlmar requested a review from a team as a code owner May 27, 2026 14:28
@ixlmar
ixlmar requested a review from pengbowang-nv May 27, 2026 14:28
@coderabbitai

coderabbitai Bot commented May 27, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

This PR removes a single CUDA stream synchronization call from the FlashInfer ragged prefill planning code path that handles the case when no KV cache manager is provided, occurring before the validation and execution of the no-KV ragged planning routine.

Changes

FlashInfer Ragged Prefill Synchronization

Layer / File(s) Summary
Remove synchronization from ragged prefill planning
tensorrt_llm/_torch/attention_backend/flashinfer.py
Deleted a torch.cuda.current_stream().synchronize() call from the no-KV-cache ragged prefill branch before num_contexts validation and _plan_ragged_cudnn_no_kv() invocation.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related PRs

  • NVIDIA/TensorRT-LLM#13428: Introduces FlashInfer MLA planning with explicit synchronization around plan() execution—directly related to CUDA-stream synchronization changes in the same FlashInfer module.

Suggested reviewers

  • QiJune
  • tburt-nv
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The PR description is vague and lacks sufficient detail about the rationale for removing the synchronization call. Expand the description to explain why the torch.cuda.current_stream().synchronize() call is unnecessary and what performance or correctness implications this change has.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: removing an unnecessary synchronization call from the FlashInfer attention plan() function for performance improvement.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

✏️ 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.

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #50553 [ run ] triggered by Bot. Commit: 57838fe Link to invocation

@yechank-nvidia yechank-nvidia 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.

Thx for the catch!

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #50554 [ run ] triggered by Bot. Commit: 57838fe Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #50553 [ run ] completed with state ABORTED. Commit: 57838fe

Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #50554 [ run ] completed with state FAILURE. Commit: 57838fe
/LLM/main/L0_MergeRequest_PR pipeline #40055 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

CI Agent Failure Analysis

Link to invocation

Signed-off-by: ixlmar <206748156+ixlmar@users.noreply.github.com>
@ixlmar
ixlmar force-pushed the perf/remove-sync branch from 57838fe to 427f7c1 Compare May 28, 2026 06:33
@ixlmar

ixlmar commented May 28, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #50709 [ run ] triggered by Bot. Commit: 427f7c1 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #50709 [ run ] completed with state FAILURE. Commit: 427f7c1
/LLM/main/L0_MergeRequest_PR pipeline #40193 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

CI Agent Failure Analysis

Link to invocation

@ixlmar

ixlmar commented May 28, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #50755 [ run ] triggered by Bot. Commit: 427f7c1 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #50755 [ run ] completed with state FAILURE. Commit: 427f7c1
/LLM/main/L0_MergeRequest_PR pipeline #40234 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

CI Agent Failure Analysis

Link to invocation

@ixlmar

ixlmar commented May 28, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #50818 [ run ] triggered by Bot. Commit: 427f7c1 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 #50818 [ run ] completed with state FAILURE. Commit: 427f7c1
/LLM/main/L0_MergeRequest_PR pipeline #40288 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

CI Agent Failure Analysis

Link to invocation

@ixlmar

ixlmar commented May 29, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #51004 [ run ] triggered by Bot. Commit: 427f7c1 Link to invocation

@ixlmar
ixlmar enabled auto-merge (squash) May 29, 2026 10:36
@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #51004 [ run ] completed with state FAILURE. Commit: 427f7c1
/LLM/main/L0_MergeRequest_PR pipeline #40453 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

CI Agent Failure Analysis

Link to invocation

@ixlmar

ixlmar commented May 29, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #51045 [ run ] triggered by Bot. Commit: 427f7c1 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #51045 [ run ] completed with state SUCCESS. Commit: 427f7c1
/LLM/main/L0_MergeRequest_PR pipeline #40492 completed with status: 'SUCCESS'

CI Report

Link to invocation

@ixlmar
ixlmar merged commit 208ed9b into NVIDIA:main May 29, 2026
8 checks passed
@ixlmar
ixlmar deleted the perf/remove-sync branch June 1, 2026 08:25
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