Skip to content

[https://nvbugs/6932241][fix] Scope NCCL window leases in helix attention tests - #20588

Merged
yuxianq merged 1 commit into
NVIDIA:release/1.3from
yuxianq:fix-mha-helix-flaky
Oct 19, 2026
Merged

yuxianq merged 1 commit into
NVIDIA:release/1.3from
yuxianq:fix-mha-helix-flaky

Conversation

@yuxianq

@yuxianq yuxianq commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

Dev Engineer Review

The MHA and MLA tests now run generation inside nccl_window_tensor_scope and clone the output before leaving the scope. This keeps the output available for accuracy checks while the NCCL window lease is scoped. The change also removes two waivers. No review findings were provided, so finding counts are unavailable.

QA Engineer Review

The change modifies two test files and tests/integration/test_lists/waives.txt. It removes the broad _torch/attention waiver and the test_mha_helix_distributed waiver. No matching helix test entries were found in the test-db/ or qa/ lists. No test results were supplied. Coverage verdict: needs follow-up.

Per-File QA Perspective

  • tests/unittest/_torch/attention/multi_gpu/test_mha_helix.py: Covers distributed MHA attention behavior and accuracy after scoped generation. No matching registration was found in the CI or manual-QA lists.
  • tests/unittest/_torch/attention/multi_gpu/test_mla_helix.py: Covers distributed MLA attention behavior and accuracy after scoped generation. No matching registration was found in the CI or manual-QA lists.
  • tests/integration/test_lists/waives.txt: Removes two skip waivers, allowing the associated tests to run instead of being waived.

Description

Fixes https://nvbugs/6932241 and its duplicate https://nvbugs/6932265 (release/1.3 only).

Symptom. On DGX_B300-4_GPUs-PyTorch-Post-Merge-1, test_mha_helix_distributed[nccl-...batch=1, ctx_len=64...] never finishes. It runs into the 2400 s stage timeout and is reported as "Test terminated unexpectedly". The aggregated unittest/_torch/attention ... entry (6932265) fails because of the same hang: in every failing build its culprit is IN-FLIGHT .../test_mha_helix.py::test_mha_helix_distributed[nccl-...].

Root cause. #17705 (NCCL symmetric-window lease scoping, release/1.3 only) gives an NCCL-window lease to the o_proj GEMM output and to the NCCL-symmetric all-reduce output. These leases are meant to be released by an enclosing nccl_window_tensor_scope; the model engine installs one around each decoder layer. A lease released by its tensor destructor instead logs:

[NCCLUtil] NCCL window lease 1 on comm 0x... was released by its tensor destructor instead of an explicit final consumer. Quarantining this buffer until communicator teardown.
Fatal Python error: Aborted

and calls std::abort() (TLLM_NCCL_WINDOW_LIFECYCLE_ASSERT defaults to 1). The helix MHA/MLA tests call the attention module directly, outside any scope. Both MPI ranks compute the correct result (0 mismatches) and then abort when _run_attention_distributed returns. MPIPoolExecutor doesn't notice that its spawned ranks died, so the parent waits until the stage timeout.

The hang is deterministic, not flaky. It reproduces on every run, for every comms medium (nccl, fifo_v1, fifo_v2), and in both test_mha_helix and test_mla_helix. CI only ever showed the first parametrization because it blocks everything after it. On release/1.3 post-merge, builds #15–#28 passed all 48 MHA/MLA helix cases; #29 (the first build containing #17705) through #31 hung, after which the waivers landed.

Fix. This follows the pattern #17705 applied to other tests that call modules directly. The distributed generation step runs inside nccl_window_tensor_scope(input_gen), and its output is cloned so the accuracy check doesn't depend on the lease lifetime. The waivers for both bugs are removed. Test-only change.

main isn't affected: #17705 targeted release/1.3 and isn't on main. Main post-merge #3015–#3027 pass all 48 MHA/MLA helix cases on B300. Locally on B300, main L0_PostMerge #3010 passes the 6932241 command 10/10, and the 6932265 aggregate command completes with all helix cases passing.

Test Coverage

On B300 ×4 (umb-b300-dp-127), using the exact failing CI environment: the release-1.3 L0_PostMerge #30 build tarball and its CI image (pytorch-26.08-...-202610082043-19909). The helix test files and the NCCL-window code are identical between #30 and the release/1.3 tip.

Command Before fix After fix
6932241 verbatim: test_mha_helix.py::test_mha_helix_distributed[nccl-scenario: ...batch=1, ctx_len=64...] hang, 5/5 runs (both ranks Fatal Python error: Aborted) 10/10 passed (~21 s each)
test_mha_helix.py -k fifo_v2 hang passed (below)
test_mla_helix.py -k nccl hang passed (below)
test_mha_helix.py test_mla_helix.py (all comms media and scenarios) — 49 passed
6932265 verbatim: unittest/_torch/attention --ignore=... hang at test_mha_helix completes: 3691 passed, 341 skipped; all helix cases pass. The 4 failures are outside CI scope: 2 are waived on release/1.3 (nvbugs/6574939, nvbugs/6831694), and 2 rocketkv model tests need LLM_MODELS_ROOT.

CI: /bot run --extra-stage "DGX_B300-4_GPUs-PyTorch-Post-Merge-1"

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.

🤖 Generated with Claude Code

…tion tests

The helix MHA/MLA unit tests call the attention module directly, so the
NCCL-window tensors produced around the o_proj all-reduce have no enclosing
tensor-lease scope. Their leases are released by tensor destructors, which
aborts both ranks under TLLM_NCCL_WINDOW_LIFECYCLE_ASSERT and leaves the
MPIPoolExecutor parent waiting until the stage timeout.

Run the distributed generation step inside nccl_window_tensor_scope and clone
its output for the accuracy check, and remove the waivers for nvbugs 6932241
and 6932265.

Signed-off-by: Yuxian Qiu <142763828+yuxianq@users.noreply.github.com>
@yuxianq
yuxianq requested a review from a team as a code owner October 19, 2026 08:17
@yuxianq
yuxianq requested review from heyuhhh and lfr-0531 October 19, 2026 08:17
@coderabbitai

coderabbitai Bot commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: NVIDIA/TensorRT-LLM/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Enterprise
  • Run ID: dcc02da7-3365-476f-87cb-4c63e719f7f6
📥 Commits

Reviewing files that changed from the base of the PR and between d6701a1 and 5e99544.

📒 Files selected for processing: 3
  • tests/integration/test_lists/waives.txt
  • tests/unittest/_torch/attention/multi_gpu/test_mha_helix.py
  • tests/unittest/_torch/attention/multi_gpu/test_mla_helix.py
💤 Files with no reviewable changes: 1
  • tests/integration/test_lists/waives.txt

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.

Walkthrough

The distributed MHA and MLA tests now run generation inside nccl_window_tensor_scope and clone the output before leaving the scope. Two related integration skip waivers were removed.

Changes

Distributed attention tests

Layer / File(s) Summary
Scoped generation and waiver removal
tests/unittest/_torch/attention/multi_gpu/test_mha_helix.py, tests/unittest/_torch/attention/multi_gpu/test_mla_helix.py, tests/integration/test_lists/waives.txt
The MHA and MLA tests run generation inside nccl_window_tensor_scope and clone the output inside the scope. The waiver list removes the _torch/attention and test_mha_helix_distributed waivers.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: brb-nv, trtllm-agent

Merge Risk: ⚪ Minimal · up to 5e995

The change scopes distributed attention generation and re-enables broader attention integration coverage. The inspected paths reveal no concrete merge-blocking issue; the reported aggregate tests also passed.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly identifies the fix, the NCCL window lease scope, and the affected helix attention tests. It follows the required NVBugs and type format.
Description check Passed The description explains the symptoms, root cause, fix, affected release, removed waivers, test coverage, and CI validation. It includes the required sections and completed review checkbox.
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.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@yuxianq

yuxianq commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator Author

@yunruis, could you help to review this PR as trt-llm-torch-attention-devs? Thanks~

Assignment explanation
Componentsintegration/attention-tests (100%)
Tagsrepresentation:gqa (50%); representation:mla (50%); phase:decode (100%); features:context-parallelism (100%)
PR effort2 points — A small, repeated test correction requires checking scope boundaries and whether cloned outputs remain valid for accuracy checks after cleanup. The two call sites share the same reasoning, keeping attention review effort low.
Affinity (0–1)0.412 component/tag match
Outstanding points at selection58 → 60 (+2)
Points already reserved on this PR0
Effective weight1
Completed review points (preceding 168 hours)16
Combined points after assignment76
Demand-derived target76.00 points (soft share)
Additional fair share before assignment2.00 points
Share explanationWithin demand-derived share.
Selection rulebalance-first maintenance
Assignment scope (yunruis)all

Affinity and workload are snapshots at selection, not live counters. Existing reservations on this PR are counted once.

@yuxianq
yuxianq requested review from yunruis and removed request for heyuhhh and lfr-0531 October 19, 2026 08:35
@yuxianq

yuxianq commented Oct 19, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #78871 [ run ] triggered by Bot. Commit: 5e99544 Link to invocation

@github-actions

Copy link
Copy Markdown

Automatically added "ci: full pre-merge approved" because this PR has satisfied the required GitHub review approvals. Unresolved review conversations and other required checks remain independent merge requirements.

@yuxianq
yuxianq requested a review from brb-nv October 19, 2026 08:58
@yuxianq
yuxianq enabled auto-merge (squash) October 19, 2026 08:59
@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #78871 [ run ] completed with state SUCCESS. Commit: 5e99544
/LLM/release-1.3/L0_MergeRequest_PR pipeline #343 completed with status: 'SUCCESS'

CI Report

Link to invocation

@yuxianq
yuxianq merged commit 356b1a2 into NVIDIA:release/1.3 Oct 19, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants