Skip to content

TRT 11 MD Ops - #4321

Merged
apbose merged 7 commits into
pytorch:mainfrom
jloftin-nv:dev-jloftin-trt-11-md-ops
Jun 24, 2026
Merged

apbose merged 7 commits into
pytorch:mainfrom
jloftin-nv:dev-jloftin-trt-11-md-ops

Conversation

@jloftin-nv

@jloftin-nv jloftin-nv commented Jun 4, 2026 •

Copy link
Copy Markdown
Contributor

Description

Adds support for TRT 11 Multi-Device (MD) ops: All to All, Scatter, and Gather, along with tests

Type of change

Please delete options that are not relevant and/or add your own.

  • New feature (non-breaking change which adds functionality)

Checklist:

  • My code follows the style guidelines of this project (You can use the linters)
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas and hacks
  • I have made corresponding changes to the documentation
  • I have added tests to verify my fix or my feature
  • New and existing unit tests pass locally with my changes
  • I have added the relevant labels to my PR in so that relevant reviewers are notified

@meta-cla

meta-cla Bot commented Jun 4, 2026

Copy link
Copy Markdown

Hi @jloftin-nv!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@github-actions github-actions Bot added component: tests Issues re: Tests component: lowering Issues re: The lowering / preprocessing passes component: conversion Issues re: Conversion stage component: core Issues re: The core compiler component: converters Issues re: Specific op converters component: api [Python] Issues re: Python API component: dynamo Issues relating to the `torch.compile` or `torch._dynamo.export` paths labels Jun 4, 2026
@narendasan
narendasan requested a review from apbose June 4, 2026 21:08
@jloftin-nv
jloftin-nv force-pushed the dev-jloftin-trt-11-md-ops branch from 21f1b77 to d198665 Compare June 10, 2026 18:57
@meta-cla meta-cla Bot added the cla signed label Jun 22, 2026
@meta-cla

meta-cla Bot commented Jun 22, 2026

Copy link
Copy Markdown

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@github-actions
github-actions Bot requested a review from cehongwang June 22, 2026 22:30
Comment thread py/torch_tensorrt/_features.py Resolved
@apbose
apbose merged commit 492d52c into pytorch:main Jun 24, 2026
50 of 51 checks passed
apbose added a commit that referenced this pull request Jul 7, 2026
cehongwang pushed a commit that referenced this pull request Jul 9, 2026
apbose pushed a commit that referenced this pull request Jul 15, 2026
test_native_nccl.py:
- Fix test_distributed_mode_subgroup and test_distributed_mode_context_switch
  regressions introduced by PR #4222 (Python runtime rework): add
  dist.barrier(group=subgroup) before first TRT forward so PyTorch's lazy
  ncclComm_t is initialized and bind_nccl_comm() sees a non-zero getCommPtr().
- Remove all use_python_runtime=True flags (deprecated no-op in 2.13).
- Add _cpp_runtime_available() guard to TestPythonRuntimePickle so it skips
  in C++ builds where _TRTEngine's custom op is never registered.
- Fix _multirank_scatter_correctness / _multirank_gather_correctness in
  run_multirank_tests(): wrap with lambdas that loop over root ranks to match
  their (root, rank, world_size, device) signature (broken since PR #4321).
- Remove _multirank_distributed_mode_subgroup_python and
  _multirank_distributed_mode_context_switch_python (cannot work when C++
  extension is loaded); collapse _multirank_pg_migration to cpp-only.

_nccl_utils.py:
- setup_nccl_for_torch_tensorrt(): drop ensure_nccl_symlink() call and
  pre-load libnccl.so.2 directly instead of via the unversioned symlink.
  TRT 11.0+ (ncclWrapper.cpp) tries dlopen("libnccl.so.2") first, matching
  PyTorch's soname exactly; glibc reuses the already-loaded handle so no
  symlink is needed. ensure_nccl_symlink() is kept for TRT < 11.0 users.
- Update module docstring to reflect confirmed TRT 11.0+ behavior.
apbose pushed a commit that referenced this pull request Jul 15, 2026
test_native_nccl.py:
- Fix test_distributed_mode_subgroup and test_distributed_mode_context_switch
  regressions introduced by PR #4222 (Python runtime rework): add
  dist.barrier(group=subgroup) before first TRT forward so PyTorch's lazy
  ncclComm_t is initialized and bind_nccl_comm() sees a non-zero getCommPtr().
- Remove all use_python_runtime=True flags (deprecated no-op in 2.13).
- Add _cpp_runtime_available() guard to TestPythonRuntimePickle so it skips
  in C++ builds where _TRTEngine's custom op is never registered.
- Fix _multirank_scatter_correctness / _multirank_gather_correctness in
  run_multirank_tests(): wrap with lambdas that loop over root ranks to match
  their (root, rank, world_size, device) signature (broken since PR #4321).
- Remove _multirank_distributed_mode_subgroup_python and
  _multirank_distributed_mode_context_switch_python (cannot work when C++
  extension is loaded); collapse _multirank_pg_migration to cpp-only.

_nccl_utils.py:
- setup_nccl_for_torch_tensorrt(): drop ensure_nccl_symlink() call and
  pre-load libnccl.so.2 directly instead of via the unversioned symlink.
  TRT 11.0+ (ncclWrapper.cpp) tries dlopen("libnccl.so.2") first, matching
  PyTorch's soname exactly; glibc reuses the already-loaded handle so no
  symlink is needed. ensure_nccl_symlink() is kept for TRT < 11.0 users.
- Update module docstring to reflect confirmed TRT 11.0+ behavior.
apbose pushed a commit that referenced this pull request Jul 20, 2026
test_native_nccl.py:
- Fix test_distributed_mode_subgroup and test_distributed_mode_context_switch
  regressions introduced by PR #4222 (Python runtime rework): add
  dist.barrier(group=subgroup) before first TRT forward so PyTorch's lazy
  ncclComm_t is initialized and bind_nccl_comm() sees a non-zero getCommPtr().
- Remove all use_python_runtime=True flags (deprecated no-op in 2.13).
- Add _cpp_runtime_available() guard to TestPythonRuntimePickle so it skips
  in C++ builds where _TRTEngine's custom op is never registered.
- Fix _multirank_scatter_correctness / _multirank_gather_correctness in
  run_multirank_tests(): wrap with lambdas that loop over root ranks to match
  their (root, rank, world_size, device) signature (broken since PR #4321).
- Remove _multirank_distributed_mode_subgroup_python and
  _multirank_distributed_mode_context_switch_python (cannot work when C++
  extension is loaded); collapse _multirank_pg_migration to cpp-only.

_nccl_utils.py:
- setup_nccl_for_torch_tensorrt(): drop ensure_nccl_symlink() call and
  pre-load libnccl.so.2 directly instead of via the unversioned symlink.
  TRT 11.0+ (ncclWrapper.cpp) tries dlopen("libnccl.so.2") first, matching
  PyTorch's soname exactly; glibc reuses the already-loaded handle so no
  symlink is needed. ensure_nccl_symlink() is kept for TRT < 11.0 users.
- Update module docstring to reflect confirmed TRT 11.0+ behavior.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla signed component: api [Python] Issues re: Python API component: conversion Issues re: Conversion stage component: converters Issues re: Specific op converters component: core Issues re: The core compiler component: dynamo Issues relating to the `torch.compile` or `torch._dynamo.export` paths component: lowering Issues re: The lowering / preprocessing passes component: tests Issues re: Tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants