Skip to content

Conversation

@hyukn
Copy link
Collaborator

@hyukn hyukn commented Jan 23, 2026

Summary by CodeRabbit

  • New Features

    • Introduced configurable MPI-offload support for distributed reduction operations, enabling proper operation without MPI dependencies through new control parameters.
  • Tests

    • Enhanced test infrastructure for distributed operations to improve MPI handling in multi-GPU scenarios.

✏️ Tip: You can customize this high-level summary in your review settings.

Description

Test Coverage

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)

  • 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

/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)]

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.

For guidance on mapping tests to stage names, see docs/source/reference/ci-overview.md
and the scripts/test_to_stage_mapping.py helper.

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.

@hyukn hyukn requested review from a team as code owners January 23, 2026 08:18
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 23, 2026

📝 Walkthrough

Walkthrough

The changes add MPI-offload support toggles to AllReduce-related APIs across custom operations and distributed operations modules. Function signatures for AllReduceRunner, tunable_allreduce, and related resolver functions now include disable_mpi and rank parameters. The forward execution path conditionally retrieves model extra attributes when MPI is disabled and passes them to the underlying operation. Test configuration for MPI pickling was also updated to use explicit module imports and protocol specification.

Changes

Cohort / File(s) Summary
AllReduce API Updates
tensorrt_llm/_torch/custom_ops/torch_custom_ops.py, tensorrt_llm/_torch/distributed/ops.py
Added disable_mpi: bool and rank: int parameters to AllReduceRunner.__init__, tunable_allreduce(), and resolver function signatures. Modified forward execution path to conditionally fetch and inject model extra attributes (including pg_boxed) when MPI is disabled. Simplified condition for tunable_allreduce invocation based on strategy and autotune flags.
Test Configuration
tests/unittest/_torch/multi_gpu/test_allreduce.py
Updated MPI pickling configuration to explicitly import utils.util instead of manipulating sys.modules directly; added pickle.HIGHEST_PROTOCOL to initialization call.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is largely empty; it only contains the template with HTML comments and checklist items, but no actual explanation of the issue, solution, or test coverage. Fill in the Description section to explain what problem this solves and how; add Test Coverage section listing relevant tests; check off completed items in the PR Checklist.
Docstring Coverage ⚠️ Warning Docstring coverage is 16.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 and specifically describes the main change: applying tunable AllReduce to the Ray path, as confirmed by the code changes to AllReduce-related APIs and distributed ops.

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

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

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

⚠️ Outside diff range comments (3)
tensorrt_llm/_torch/distributed/ops.py (2)

1-5: Add NVIDIA SPDX header to this source file.

This file is missing the required NVIDIA copyright SPDX header with the year of latest modification (2026).

📝 Suggested header
+ # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+ # SPDX-License-Identifier: Apache-2.0

As per coding guidelines.


829-854: Non-AUTO path now leaves output undefined.

Line 829 only assigns output inside the AUTO branch; when disable_allreduce_autotune is true or strategy ≠ AUTO, this will raise UnboundLocalError. Also, Line 832 assumes get_model_extra_attrs() is initialized in the MPI-disabled path—add a guard to fail clearly.

🐛 Proposed fix
-        if allreduce_strategy == AllReduceStrategy.AUTO and not disable_allreduce_autotune:
+        if allreduce_strategy == AllReduceStrategy.AUTO and not disable_allreduce_autotune:
             # Set up pg_boxed in extra_attrs for tunable_allreduce to access
             if self._disable_mpi:
-                extra_attrs = get_model_extra_attrs()
+                extra_attrs = get_model_extra_attrs()
+                assert extra_attrs is not None, "Model extra attrs not initialized"
                 pg = self.mapping.tp_group_pg
                 assert pg is not None, "TP ProcessGroup not initialised"
                 extra_attrs["pg_boxed"] = pg.boxed()

             output = torch.ops.trtllm.tunable_allreduce(
                 input=input,
                 residual=all_reduce_params.residual,
                 norm_weight=all_reduce_params.norm_weight,
                 scale=all_reduce_params.scale,
                 bias=all_reduce_params.bias,
                 workspace=self.workspace,
                 group=self.mapping.tp_group,
                 strategy=allreduce_strategy,
                 op=all_reduce_params.fusion_op,
                 eps=all_reduce_params.eps,
                 trigger_completion_at_end=all_reduce_params.
                 trigger_completion_at_end,
                 disable_mpi=self._disable_mpi,
                 rank=self.mapping.tp_rank,
             )
+        else:
+            extra_args = {}
+            if self._disable_mpi:
+                pg = self.mapping.tp_group_pg
+                assert pg is not None, "TP ProcessGroup not initialised"
+                extra_args = {"pg_boxed": pg.boxed(), "rank": self.mapping.tp_rank}
+            output = self.all_reduce_op(
+                input=input,
+                residual=all_reduce_params.residual,
+                norm_weight=all_reduce_params.norm_weight,
+                scale=all_reduce_params.scale,
+                bias=all_reduce_params.bias,
+                workspace=self.workspace,
+                group=self.mapping.tp_group,
+                strategy=allreduce_strategy,
+                op=all_reduce_params.fusion_op,
+                eps=all_reduce_params.eps,
+                trigger_completion_at_end=all_reduce_params.trigger_completion_at_end,
+                **extra_args,
+            )
tensorrt_llm/_torch/custom_ops/torch_custom_ops.py (1)

1-5: Add NVIDIA SPDX header to this source file.

This file is missing the required NVIDIA copyright SPDX header with the year of latest modification (2026).

📝 Suggested header
+ # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+ # SPDX-License-Identifier: Apache-2.0

As per coding guidelines.

🤖 Fix all issues with AI agents
In `@tensorrt_llm/_torch/custom_ops/torch_custom_ops.py`:
- Around line 1736-1756: The MPI-disabled branch assumes get_model_extra_attrs()
returns a dict with "pg_boxed"; add a defensive assertion before indexing: when
self.disable_mpi is true, call extra_attrs = get_model_extra_attrs() and assert
extra_attrs is a dict and "pg_boxed" in extra_attrs (or raise a clear
AssertionError/ValueError) so extra_args = {"pg_boxed": extra_attrs["pg_boxed"],
"rank": self.rank} cannot raise a TypeError/KeyError; keep the rest of the
all_reduce_op call unchanged (references: self.disable_mpi,
get_model_extra_attrs, extra_args, self.rank, all_reduce_op).
🧹 Nitpick comments (2)
tensorrt_llm/_torch/distributed/ops.py (1)

13-13: Keep module namespace for utils import.

Use a module import (e.g., import tensorrt_llm._torch.utils as torch_utils) and call torch_utils.get_model_extra_attrs() to follow the namespace rule.

♻️ Suggested change
-from tensorrt_llm._torch.utils import get_model_extra_attrs
+import tensorrt_llm._torch.utils as torch_utils
-                extra_attrs = get_model_extra_attrs()
+                extra_attrs = torch_utils.get_model_extra_attrs()

As per coding guidelines.

tensorrt_llm/_torch/custom_ops/torch_custom_ops.py (1)

10-10: Keep module namespace for utils import.

Use a module import (e.g., import tensorrt_llm._torch.utils as torch_utils) and call torch_utils.get_model_extra_attrs() to follow the namespace rule.

♻️ Suggested change
-from tensorrt_llm._torch.utils import get_model_extra_attrs
+import tensorrt_llm._torch.utils as torch_utils
-            extra_attrs = get_model_extra_attrs()
+            extra_attrs = torch_utils.get_model_extra_attrs()

As per coding guidelines.

@hyukn
Copy link
Collaborator Author

hyukn commented Jan 23, 2026

/bot run --disable-fail-fast --only-multi-gpu-test

@tensorrt-cicd
Copy link
Collaborator

PR_Github #33353 [ run ] triggered by Bot. Commit: 35cf455

Signed-off-by: Yukun He <23156053+hyukn@users.noreply.github.com>
@hyukn hyukn force-pushed the feat/allreduce_autotune_ray branch from 35cf455 to eec378e Compare January 23, 2026 11:15
@hyukn
Copy link
Collaborator Author

hyukn commented Jan 23, 2026

/bot run --disable-fail-fast --only-multi-gpu-test

@tensorrt-cicd
Copy link
Collaborator

PR_Github #33374 [ run ] triggered by Bot. Commit: eec378e

@tensorrt-cicd
Copy link
Collaborator

PR_Github #33374 [ run ] completed with state SUCCESS. Commit: eec378e
/LLM/main/L0_MergeRequest_PR pipeline #25761 (Partly Tested) completed with status: 'FAILURE'

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

@hyukn
Copy link
Collaborator Author

hyukn commented Jan 24, 2026

/bot run --disable-fail-fast --only-multi-gpu-test

@tensorrt-cicd
Copy link
Collaborator

PR_Github #33435 [ run ] triggered by Bot. Commit: eec378e

@tensorrt-cicd
Copy link
Collaborator

PR_Github #33435 [ run ] completed with state SUCCESS. Commit: eec378e
/LLM/main/L0_MergeRequest_PR pipeline #25807 (Partly Tested) completed with status: 'FAILURE'

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

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.

3 participants