Skip to content

[None][perf] Remove blocking cudaStreamSynchronize - #16

Merged
pcicotti merged 1 commit into
feat/m3_with_msafrom
user/brb/investigate-piecewise-cudagraph
Jul 21, 2026
Merged

pcicotti merged 1 commit into
feat/m3_with_msafrom
user/brb/investigate-piecewise-cudagraph

Conversation

@brb-nv

@brb-nv brb-nv commented Jul 21, 2026 •

Copy link
Copy Markdown
Owner

Description

There is an H2D copy in select_blocks_from_maxscore which turned out to be blocking.

nvb = n_valid_blocks.to(device=device, dtype=torch.long)

This MR creates the tensor on the device once per step so that such copy is no longer needed. Above line remains unchanged as issue is fixed at the source (tensor created on device instead of host).

For ISL=8192, OSL=1, c=1, request latency in ms:

Before:

[Latency] P50    : 298.2450
[Latency] P90    : 299.1159
[Latency] P95    : 299.5864
[Latency] P99    : 300.5684
[Latency] MINIMUM: 296.7526
[Latency] MAXIMUM: 300.5684
[Latency] AVERAGE: 298.3305

After removing sync:

[Latency] P50    : 269.5668
[Latency] P90    : 270.2923
[Latency] P95    : 272.9274
[Latency] P99    : 276.2878
[Latency] MINIMUM: 268.4211
[Latency] MAXIMUM: 276.2878
[Latency] AVERAGE: 269.7271

Test Coverage

$ pytest tests/integration/defs/accuracy/test_llm_api_pytorch.py::TestMiniMaxM3::test_nvfp4[use_msa=True] -s -v

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.

@brb-nv
brb-nv force-pushed the user/brb/investigate-piecewise-cudagraph branch from 41a5b1a to acab5c8 Compare July 21, 2026 04:47
@pcicotti
pcicotti merged commit 923fe33 into feat/m3_with_msa Jul 21, 2026
5 checks passed
brb-nv pushed a commit that referenced this pull request Nov 17, 2026
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.

2 participants