Skip to content

[https://nvbugs/7142489][fix] Isolate MPI workers for the user buffer ledger test - #22838

Merged
zhaoyangwang-nvidia merged 2 commits into
NVIDIA:mainfrom
zhaoyangwang-nvidia:fix/ub-ledger-7142489
Nov 25, 2026
Merged

zhaoyangwang-nvidia merged 2 commits into
NVIDIA:mainfrom
zhaoyangwang-nvidia:fix/ub-ledger-7142489

Conversation

@zhaoyangwang-nvidia

@zhaoyangwang-nvidia zhaoyangwang-nvidia commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

Dev Engineer Review

  • The ledger test no longer uses the shared mpi_pool_executor fixture. It creates its own MPIPoolExecutor(tensor_parallel_size) per run, so its MPI workers do not inherit allocator state from earlier tests.
  • run_single_rank_ledger now receives its arguments through executor.map with two positional lists instead of zip(*...). The call shape is equivalent for the fixed two-rank case.
  • The tensor_parallel_size parameter now drives the pool size. The existing skipif for fewer than two GPUs still applies.
  • Scope is limited to one test function and one import.

QA Engineer Review

  • Test file modified: tests/unittest/_torch/multi_gpu/test_user_buffers.py.
  • Test modified: test_user_buffers_are_in_the_native_memory_ledger. It now parametrizes tensor_parallel_size directly and owns its MPI pool.
  • Behavior covered: each rank runs run_single_rank_ledger with an 8 MiB user buffer, and every rank must return True.
  • Test-list entries (test-db/, qa/): not available from this diff.
  • Coverage verdict: sufficient for the ledger path. The RMSNorm tests are not changed by this diff.
  • Reported local runs: the author reports two B200 passes for the ledger test and the RMSNorm cases. The H100 post-merge stage has not been rerun.

Per-File QA Perspective

  • tests/unittest/_torch/multi_gpu/test_user_buffers.py: Verify that the ledger test passes on two GPUs in a fresh MPI pool. Confirm the test-list entry in test-db/ covers it; that listing is not available from this diff.

Description

The module-scoped MPI pool lets earlier RMSNorm tests initialize the user buffer allocator on both ranks. Initializing it again reuses the existing communicator, so the ledger count stays at four and the cold-start assertion fails.

Give the ledger test its own two-worker MPI pool. This preserves the count and byte assertions for both communicator initialization and tensor allocation.

Test Coverage

Ran the following sequence on two B200 GPUs:

python3 -m pytest -q tests/unittest/_torch/multi_gpu/test_user_buffers.py -k 'test_user_buffers_are_in_the_native_memory_ledger or (test_user_buffers_ar_rms_norm and not fp)'

Before the fix, both RMSNorm cases passed and the ledger test failed with AssertionError: (4, 4). After the fix, all three passed. The original H100 post-merge stage has not been rerun locally. Local pre-commit passed. The advisory Pyrefly check could not run because Pyrefly was unavailable.

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.

@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The native-memory-ledger test now creates an MPI pool with tensor_parallel_size workers and runs the worker function across that pool. It passes 8 << 20 to each rank and checks that all workers return True.

Changes

Native-memory-ledger test

Layer / File(s) Summary
Configure and run the test pool
tests/unittest/_torch/multi_gpu/test_user_buffers.py
The test imports MPIPoolExecutor and uses it with tensor_parallel_size workers instead of the shared executor fixture. It passes 8 << 20 to each rank and checks each result.

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

Change: Other

Suggested reviewers: allisonlim-nv

Merge Risk: Minimal · up to 22d17

This change only affects a multi-GPU unit test. It gives the user buffer ledger test its own MPI pool, which addresses the reported cold-start assertion failure. It has no production impact and no remaining merge risk was identified.

Security architecture risk: Minimal · up to 22d17

Giving the ledger test fresh MPI workers prevents earlier tests from carrying allocator state into its cold-start check. The change is limited to test execution.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: it isolates the MPI workers used by the user buffer ledger test. It follows the repository template with an NVBugs ID and the [fix] type. It matches the raw summary, w…
Description check Passed The description follows the repository template. It explains the problem: the module-scoped MPI pool causes the communicator to be reused, so the ledger count stays at four. It states the fix: the led…
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.
Full details: Title check

Explanation

The title names the main change: it isolates the MPI workers used by the user buffer ledger test. It follows the repository template with an NVBugs ID and the [fix] type. It matches the raw summary, which says the ledger test now creates its own MPI executor instead of using the shared fixture.

Full details: Description check

Explanation

The description follows the repository template. It explains the problem: the module-scoped MPI pool causes the communicator to be reused, so the ledger count stays at four. It states the fix: the ledger test gets its own two-worker MPI pool. The Test Coverage section lists the exact pytest command, the before and after results on two B200 GPUs, and notes that the H100 post-merge stage was not rerun. The checklist is marked. The template's '@coderabbitai summary' header is present but the description does not show the generated summary text, which is acceptable for a pass. The 'Test Coverage' section names specific tests and results, so coverage is clear.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between c61e57f and 22d1785.

Files selected for processing: 1

  • tests/unittest/_torch/multi_gpu/test_user_buffers.py

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

@zhaoyangwang-nvidia

Copy link
Copy Markdown
Collaborator Author

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #86954 [ run ] triggered by Bot. Commit: c61e57f Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #86954 [ run ] completed with state FAILURE. Commit: c61e57f
/LLM/main/L0_MergeRequest_PR pipeline #72113 completed with status: 'UNSTABLE'

CI Report

⚠️ Multi-GPU Label Required:
Multi-GPU tests require the ci: full pre-merge approved label on this PR. Either:

  • Wait for the PR to be fully approved — the label is added automatically once approval is complete. Having unresolved open comments is fine, or
  • If needed, ask a member of NVIDIA/trt-llm-ci-approvers to add the label manually.
    Then re-trigger CI with the same bot command (no rebase needed).

⚠️ 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

@trtllm-agent-review trtllm-agent-review 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.

Thanks for the PR. Gives the user-buffer native-memory-ledger test its own two-worker MPI pool, so the cold-start registration counts it asserts no longer see the userbuffers state that earlier tests leave in the shared module-scoped pool.

Reviewed at commit c61e57f38b (1 file, +10/−8).

The review covers the one changed test file at the PR head. The userbuffers C++ code it exercises was read but is unchanged.

Approve: no Blocker found. 1 suggestion below is nice to have.

Nice to have (1): 1 inline, 0 below
  • (R3: Repository rules) The rewritten test signature has no type annotations, which CODING_GUIDELINES.md (Static Typing, rule 4) asks for on every function. (test_user_buffers.py:316)
What this review checked
  • A fresh MPIPoolExecutor(2) spawns new workers. On each rank UserBufferAllocator::initialize (cpp/tensorrt_llm/kernels/userbuffers/ub_allocator.cpp:29-35) then builds the communicator, and the ledger goes from 0 to 1 (its region, userbuffers-host.cpp:320) to 2 (the 8 MiB buffer). These are the deltas run_single_rank_ledger asserts; in the shared pool the counts could only stay at (4, 4).
  • The test still runs pre-merge. unittest/_torch/multi_gpu -m "not post_merge" (l0_dgx_h100.yml:28) collects it on the DGX_H100 2-GPU stage, the tests/unittest/_torch/multi_gpu/ path triggers that stage (jenkins/L0_MergeRequest.groovy:2036), and the node id stays [2].
  • pytest now runs the test last in the module, while the module-scoped pool is still alive. That stage already runs concurrent 2-worker pools, so MPI slots are not a concern. If the second multicast mapping fails, userbuffers falls back to unicast and still records the registrations the test counts (userbuffers-host.cpp:261-292, 379).
  • Not covered: No GPU run. The code does not settle whether H100 can create a second userbuffers multicast object while the module pool's workers still hold theirs on the same two GPUs. The B200 run in the description had the same state, and this PR's DGX_H100 pre-merge run had not finished.
  • Not covered: NVBug 7142489 itself was not read.

Automated review by trtllm-agent-review. If a point is wrong, reply in its thread. Once you have pushed code changes and replied in every Blocker thread, the bot re-checks the Blockers within a few hours.

@zhaoyangwang-nvidia

Copy link
Copy Markdown
Collaborator Author

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #86975 [ run ] triggered by Bot. Commit: 22d1785 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #86975 [ run ] completed with state FAILURE. Commit: 22d1785
/LLM/main/L0_MergeRequest_PR pipeline #72134 completed with status: 'UNSTABLE'

CI Report

⚠️ Multi-GPU Label Required:
Multi-GPU tests require the ci: full pre-merge approved label on this PR. Either:

  • Wait for the PR to be fully approved — the label is added automatically once approval is complete. Having unresolved open comments is fine, or
  • If needed, ask a member of NVIDIA/trt-llm-ci-approvers to add the label manually.
    Then re-trigger CI with the same bot command (no rebase needed).

⚠️ 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

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

@zhaoyangwang-nvidia

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #87120 [ run ] triggered by Bot. Commit: 22d1785 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #87120 [ run ] completed with state SUCCESS. Commit: 22d1785
/LLM/main/L0_MergeRequest_PR pipeline #72272 completed with status: 'SUCCESS'

CI Report

Link to invocation

@zhaoyangwang-nvidia
zhaoyangwang-nvidia added this pull request to the merge queue Nov 25, 2026
Merged via the queue into NVIDIA:main with commit 3afb4e1 Nov 25, 2026
17 checks passed
@zhaoyangwang-nvidia
zhaoyangwang-nvidia deleted the fix/ub-ledger-7142489 branch November 25, 2026 06:33
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.

5 participants