Skip to content

Conversation

@yizhang-nv
Copy link
Member

@yizhang-nv yizhang-nv commented Sep 5, 2025

Summary by CodeRabbit

  • Bug Fixes

    • NCCL symmetric operations are now gated by NCCL version to prevent unsupported runtime paths on older installs.
    • User buffers are automatically disabled when using the NCCL symmetric strategy to avoid conflicts.
  • Tests

    • Skips NCCL symmetric test cases when NCCL < 2.27 to reflect unsupported environments.
  • Chores

    • Updated default NCCL package to 2.25.1 (CUDA 12.8) in installation scripts.
    • Refreshed CI image tags to latest build identifiers.

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

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

@yizhang-nv yizhang-nv changed the base branch from main to release/1.1.0rc2 September 5, 2025 06:30
@yizhang-nv yizhang-nv force-pushed the user/yizhan/downgrade-nccl branch 3 times, most recently from 1dbb894 to bf08945 Compare September 5, 2025 10:22
Signed-off-by: yizhang-nv <[email protected]>
@yizhang-nv yizhang-nv force-pushed the user/yizhan/downgrade-nccl branch from bf08945 to ca764b7 Compare September 5, 2025 10:25
@yizhang-nv yizhang-nv changed the title [None][fix] Downgrade NCCL [https://nvbugs/5498967][fix] Downgrade NCCL Sep 5, 2025
@yizhang-nv yizhang-nv marked this pull request as ready for review September 5, 2025 10:27
@yizhang-nv yizhang-nv requested review from a team as code owners September 5, 2025 10:27
@yizhang-nv
Copy link
Member Author

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #17779 [ run ] triggered by Bot

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 5, 2025

📝 Walkthrough

Walkthrough

Introduces NCCL version-gated UB allocator logic and NCCL helper in C++ (>=2.27 path enabled; <2.27 path hard-fails). Disables userbuffer init for NCCL_SYMMETRIC in PyTorch engine. Adds test skips for NCCL_SYMMETRIC on older NCCL. Downgrades NCCL version in install script. Updates Jenkins image tags.

Changes

Cohort / File(s) Summary
C++ UB allocator and NCCL gating
cpp/tensorrt_llm/kernels/userbuffers/ub_allocator.cpp, cpp/tensorrt_llm/kernels/userbuffers/ub_allocator.h
Adds NCCL version guards. For NCCL ≥ 2.27: introduces NCCLHelper (dynamic symbol load), extends UBBuffer with ncclWindow_t, implements NCCLUserBufferAllocator initialize/register using world group and window registration. For NCCL < 2.27: initialize stubs out with runtime error. Public signatures unchanged.
PyTorch engine UB init flow
tensorrt_llm/_torch/pyexecutor/model_engine.py
Adds early return in _init_userbuffers to disable UB when allreduce_strategy is NCCL_SYMMETRIC.
Tests: NCCL_SYMMETRIC skips on old NCCL
tests/unittest/_torch/multi_gpu/test_mnnvl_allreduce.py
Adds pytest.skip guards when NCCL < 2.27 and strategy is NCCL_SYMMETRIC.
Docker NCCL version
docker/common/install_tensorrt.sh
Changes NCCL_VER from 2.27.5-1+cuda12.9 to 2.25.1-1+cuda12.8; comments updated accordingly.
Jenkins image tags
jenkins/current_image_tags.properties
Updates four image tag values to new build ID 202509051530-7556.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant App as Caller
  participant Alloc as NCCLUserBufferAllocator
  participant NCCL as NCCL (dyn symbols)

  rect rgba(230,240,255,0.5)
  note over Alloc: initialize(world_config)
  App->>Alloc: initialize(world_config)
  alt NCCL >= 2.27
    Alloc->>NCCL: load symbols (memAlloc, commWindowRegister)
    NCCL-->>Alloc: function ptrs
    Alloc->>NCCL: create/get world group & communicator
    Alloc-->>App: initialized
    note over Alloc,NCCL: registerUBBuffer(bytes) uses ncclMemAlloc + window register
  else NCCL < 2.27
    Alloc-->>App: runtime error (upgrade NCCL or disable symmetric)
  end
  end
Loading
sequenceDiagram
  autonumber
  participant Eng as PyTorchModelEngine
  participant UB as _init_userbuffers

  Eng->>UB: _init_userbuffers(use_nccl_symmetric?)
  alt use_nccl_symmetric == True
    UB-->>Eng: return False (skip UB)
  else
    UB-->>Eng: proceed with UB initialization
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested reviewers

  • litaotju
  • yilin-void
  • niukuo
  • nv-guomingz
  • Shixiaowei02
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

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

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @coderabbitai title anywhere in the PR title to generate the title automatically.

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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: 3

Caution

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

⚠️ Outside diff range comments (4)
tensorrt_llm/_torch/pyexecutor/model_engine.py (1)

337-355: Avoid redundant UB init and clarify NCCL_SYMMETRIC handling.

_current logic calls init_userbuffers twice and sets a misleading use_ub_for_nccl that will always be False once NCCL_SYMMETRIC is chosen. Simplify and skip UB init entirely for NCCL_SYMMETRIC.

-        try:
-            use_ub_for_nccl = (
-                pytorch_backend_config.allreduce_strategy == "NCCL_SYMMETRIC"
-                and self._init_userbuffers(self.model.config.hidden_size))
+        try:
+            use_nccl_symmetric = pytorch_backend_config.allreduce_strategy == "NCCL_SYMMETRIC"
             if self._torch_compile_enabled:
                 set_torch_compiling(True)
-                use_ub = not use_ub_for_nccl and (
-                    pytorch_backend_config.torch_compile_enable_userbuffers
-                    and self._init_userbuffers(self.model.config.hidden_size))
+                use_ub = (
+                    not use_nccl_symmetric
+                    and pytorch_backend_config.torch_compile_enable_userbuffers
+                    and self._init_userbuffers(self.model.config.hidden_size)
+                )
cpp/tensorrt_llm/kernels/userbuffers/ub_allocator.cpp (3)

159-175: Out-of-bounds: libraryNames array lacks a null terminator and misses common soname.

The loop checks for a nullptr terminator but the array has none; also try libnccl.so.2.

-#ifdef _WIN32
-        char const* libraryNames[] = {"nccl.dll"};
-#else
-        char const* libraryNames[] = {"libnccl.so"};
-#endif
+#ifdef _WIN32
+        char const* libraryNames[] = {"nccl.dll", nullptr};
+#else
+        char const* libraryNames[] = {"libnccl.so", "libnccl.so.2", nullptr};
+#endif

196-203: isLoaded should require all required symbols, not just ncclMemAlloc.

Otherwise registerUBBuffer may dereference a null function pointer.

-        if (mNCCLMemAlloc)
-        {
-            mIsLoaded = true;
-        }
-        else
-        {
-            TLLM_LOG_WARNING("Failed to load required NCCL symbols");
-        }
+        if (mNCCLMemAlloc && mNCCLCommWindowRegister)
+        {
+            mIsLoaded = true;
+        }
+        else
+        {
+            TLLM_LOG_WARNING("Failed to load required NCCL symbols (ncclMemAlloc and/or ncclCommWindowRegister)");
+        }

103-121: Null-guard ncclCommWindowRegisterFunc and revise UBBuffer::invalid()

  • Insert

    TLLM_CHECK_WITH_INFO(ncclCommWindowRegisterFunc != nullptr,
        "Failed to resolve ncclCommWindowRegister; symmetric‐window path requires NCCL ≥ 2.27");

    before invoking ncclCommWindowRegisterFunc.

  • Do not simply set ub_buffer.handle = -1 without also changing UBBuffer::invalid(), which currently treats handle == -1 as “invalid”. Instead, refactor invalid() to ignore handle for the NCCL‐symmetric path and base validity on addr, size and the window field.

  • Verify (and implement if missing) a matching ncclCommWindowUnregister in your deallocation path so that window resources are correctly released.

🧹 Nitpick comments (7)
docker/common/install_tensorrt.sh (1)

12-13: Downgrading NCCL to 2.25.1: add guardrails and mirror fallback.

  • CUDA is 12.9 while NCCL is built for cuda12.8. Verify packages exist for Ubuntu 24.04 and RHEL8 across x86_64/aarch64 before CI runs.
  • The RHEL repo URL in this file currently uses developer.download.nvidia.cn elsewhere; add a robust mirror fallback to .com to reduce regional flakiness.

Example additions (outside this hunk):

+# Verify packages exist (Ubuntu)
+if grep -qi ubuntu /etc/os-release; then
+  apt-cache policy libnccl2 | sed -n '1,12p' || true
+fi
+
+# Mirror fallback for RockyLinux downloads
+NVIDIA_MIRROR_PRIMARY="https://developer.download.nvidia.com"
+NVIDIA_MIRROR_FALLBACK="https://developer.download.nvidia.cn"
+download_with_fallback() {
+  local path="$1"
+  wget -q --timeout=180 --tries=3 "${NVIDIA_MIRROR_PRIMARY}${path}" || \
+  wget -q --timeout=180 --tries=3 "${NVIDIA_MIRROR_FALLBACK}${path}"
+}
@@
-        wget -q --timeout=180 --tries=3 "https://developer.download.nvidia.cn/compute/cuda/repos/rhel8/${ARCH3}/${pkg}.rpm"
+        download_with_fallback "/compute/cuda/repos/rhel8/${ARCH3}/${pkg}.rpm"

Also consider setting a default for ENV to avoid redirecting to an empty path:

-    echo 'export LD_LIBRARY_PATH=/usr/local/tensorrt/lib:$LD_LIBRARY_PATH' >> "${ENV}"
+    : "${ENV:=/etc/profile.d/tensorrt-llm.sh}"
+    echo 'export LD_LIBRARY_PATH=/usr/local/tensorrt/lib:$LD_LIBRARY_PATH' >> "${ENV}"
cpp/tensorrt_llm/kernels/userbuffers/ub_allocator.cpp (1)

86-101: NIT: Style and logging.

  • Brace style in this block is K&R; repo guidelines specify Allman.
  • Consider logging the world size/ranks in the init info to aid debugging.
cpp/tensorrt_llm/kernels/userbuffers/ub_allocator.h (5)

38-41: Add Doxygen for the new window member and ctor param

Please document the new API surface per repo guidelines (//! for functions, //!< for members).

Apply:

 #if NCCL_VERSION_CODE >= NCCL_VERSION(2, 27, 0)
-    ncclWindow_t window;
+    ncclWindow_t window; //!< NCCL window handle associated with this buffer (nullable; NCCL >= 2.27).
 #endif

-    UBBuffer(void* a = nullptr, int h = -1, size_t s = 0
+    //! Constructs a UBBuffer; for NCCL >= 2.27, 'w' is the associated NCCL window (nullable).
+    UBBuffer(void* a = nullptr, int h = -1, size_t s = 0
 #if NCCL_VERSION_CODE >= NCCL_VERSION(2, 27, 0)
-        ,
-        ncclWindow_t w = nullptr
+        , ncclWindow_t w = nullptr
 #endif
         )

Also applies to: 42-47


115-119: Prefer #if defined over #ifdef for platform checks

Style consistency per repo guidelines.

Apply:

-#ifdef _WIN32
+#if defined(_WIN32)
     HMODULE mLibraryHandle;
 #else
     void* mLibraryHandle;
 #endif

129-129: Use lowerCamelCase parameter name and keep it consistent with base signature

Align with coding guidelines and the base declaration (worldConfig).

Apply:

-    void initialize(tensorrt_llm::runtime::WorldConfig const& world_config) override;
+    void initialize(tensorrt_llm::runtime::WorldConfig const& worldConfig) override;

And in the < 2.27 path:

-    void initialize(tensorrt_llm::runtime::WorldConfig const& world_config) override;
+    void initialize(tensorrt_llm::runtime::WorldConfig const& worldConfig) override;

Also applies to: 143-143


91-107: Add minimal Doxygen to new classes and accessors

Public headers should document new classes and APIs.

Apply examples:

-class NCCLHelper
+//! Helper for dynamically loading NCCL >= 2.27 symbols at runtime.
+class NCCLHelper
 {
 public:
-    NCCLHelper();
-    ~NCCLHelper();
+    NCCLHelper();
+    ~NCCLHelper(); //!< Closes the loaded library handle if open.

     // Dynamic loading function type definition
     using ncclCommWindowRegisterFunc = ncclResult_t (*)(ncclComm_t, void*, size_t, ncclWindow_t*, int);
     using ncclMemAllocFunc = ncclResult_t (*)(void**, size_t);

     // Get function pointer for ncclCommWindowRegister
-    ncclCommWindowRegisterFunc getNCCLCommWindowRegister();
+    ncclCommWindowRegisterFunc getNCCLCommWindowRegister(); //!< Returns nullptr if symbol not found.

     // Get function pointer for ncclMemAlloc
-    ncclMemAllocFunc getNCCLMemAlloc();
+    ncclMemAllocFunc getNCCLMemAlloc(); //!< Returns nullptr if symbol not found.

     // Check if NCCL library is successfully loaded
-    bool isLoaded() const;
+    bool isLoaded() const; //!< True if NCCL was located and loaded.
-class NCCLUserBufferAllocator : public UserBufferAllocator
+//! NCCL-backed UB allocator for NCCL >= 2.27 (window/symmetric support).
+class NCCLUserBufferAllocator : public UserBufferAllocator
 {
 public:
     void initialize(tensorrt_llm::runtime::WorldConfig const& worldConfig) override;
     UBBuffer registerUBBuffer(size_t bytes) override;

     // Get shared NCCLHelper instance
-    static NCCLHelper& getNCCLHelper();
+    static NCCLHelper& getNCCLHelper(); //!< Lazily initializes the shared helper.

Also applies to: 126-134


101-109: Consider [[nodiscard]] on isLoaded()

Prevents accidental ignoring of the load status.

Apply:

-    bool isLoaded() const;
+    [[nodiscard]] bool isLoaded() const;
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 9d6e87a and ca764b7.

📒 Files selected for processing (6)
  • cpp/tensorrt_llm/kernels/userbuffers/ub_allocator.cpp (2 hunks)
  • cpp/tensorrt_llm/kernels/userbuffers/ub_allocator.h (3 hunks)
  • docker/common/install_tensorrt.sh (1 hunks)
  • jenkins/current_image_tags.properties (1 hunks)
  • tensorrt_llm/_torch/pyexecutor/model_engine.py (1 hunks)
  • tests/unittest/_torch/multi_gpu/test_mnnvl_allreduce.py (1 hunks)
🧰 Additional context used
📓 Path-based instructions (8)
**/*.{h,hpp,hh,hxx,cpp,cxx,cc,cu,cuh,py}

📄 CodeRabbit inference engine (CODING_GUIDELINES.md)

Use only spaces, no tabs; indent with 4 spaces.

Files:

  • tensorrt_llm/_torch/pyexecutor/model_engine.py
  • cpp/tensorrt_llm/kernels/userbuffers/ub_allocator.h
  • tests/unittest/_torch/multi_gpu/test_mnnvl_allreduce.py
  • cpp/tensorrt_llm/kernels/userbuffers/ub_allocator.cpp
**/*.py

📄 CodeRabbit inference engine (CODING_GUIDELINES.md)

**/*.py: Python code must target Python 3.8+.
Indent Python code with 4 spaces; do not use tabs.
Maintain module namespace when importing; prefer 'from package.subpackage import foo' then 'foo.SomeClass()' instead of importing the class directly.
Python filenames should be snake_case (e.g., some_file.py).
Python classes use PascalCase names.
Functions and methods use snake_case names.
Local variables use snake_case; prefix 'k' for variables that start with a number (e.g., k_99th_percentile).
Global variables use upper SNAKE_CASE prefixed with 'G' (e.g., G_MY_GLOBAL).
Constants use upper SNAKE_CASE (e.g., MY_CONSTANT).
Avoid shadowing variables from an outer scope.
Initialize all externally visible members of a class in the constructor.
Prefer docstrings for interfaces that may be used outside a file; comments for in-function or file-local interfaces.
Use Google-style docstrings for classes and functions (Sphinx-parsable).
Document attributes and variables inline so they render under the class/function docstring.
Avoid reflection when a simpler, explicit approach suffices (e.g., avoid dict(**locals()) patterns).
In try/except, catch the most specific exceptions possible.
For duck-typing try/except, keep the try body minimal and use else for the main logic.

Files:

  • tensorrt_llm/_torch/pyexecutor/model_engine.py
  • tests/unittest/_torch/multi_gpu/test_mnnvl_allreduce.py
**/*.{cpp,cxx,cc,h,hpp,hh,hxx,cu,cuh,py}

📄 CodeRabbit inference engine (CODING_GUIDELINES.md)

Prepend the NVIDIA Apache-2.0 copyright header with current year to the top of all source files (e.g., .cpp, .h, .cu, .py).

Files:

  • tensorrt_llm/_torch/pyexecutor/model_engine.py
  • cpp/tensorrt_llm/kernels/userbuffers/ub_allocator.h
  • tests/unittest/_torch/multi_gpu/test_mnnvl_allreduce.py
  • cpp/tensorrt_llm/kernels/userbuffers/ub_allocator.cpp
**/*.{h,hpp,hh,hxx,cpp,cxx,cc,cu,cuh}

📄 CodeRabbit inference engine (CODING_GUIDELINES.md)

**/*.{h,hpp,hh,hxx,cpp,cxx,cc,cu,cuh}: Namespace closing braces must include a trailing comment with the namespace name (e.g., '} // namespace foo').
Prefer const or constexpr variables over #define for constants.
Declare variables that are not modified after initialization as const.
Avoid magic literals in code; except for 0, nullptr, true, false. Use named constants for comparisons and logic.
Use Allman brace style for formatting.
Place the semicolon of an empty for/while loop on a new line.
Bodies of switch/while/do-while/for must be compound statements (brace-delimited), and if/else must always be followed by brace-delimited statements.
Type names (e.g., classes) must be CamelCase starting with an uppercase letter (e.g., FooBar).
Local variables, methods, and namespaces use lowerCamelCase (e.g., localFooBar).
Non-magic-number global variables that are non-static and not in an anonymous namespace must be lowerCamelCase prefixed with 'g' (e.g., gDontUseGlobalFoos).
Non-magic-number globals that are static or in an anonymous namespace use lowerCamelCase prefixed with 's' (e.g., sMutableStaticGlobal).
Locally visible static variables use lowerCamelCase with 's' prefix (e.g., static std::once_flag sFlag).
Private/protected member variables use 'm' prefix with CamelCase (e.g., mNbFooValues). Public members may omit, but 'm' is encouraged for clarity.
Constants (enums, global constants, static constants, and function-scope magic/literal constants) use uppercase SNAKE_CASE with 'k' prefix (e.g., kDIGIT_NUM).
Function-scope constants that are not magic numbers or literals are named like non-constant variables (e.g., bool const pass = a && b).
If macros are necessary, name them in UPPER_SNAKE_CASE (e.g., FOO_VERSION) and prefer constants over #define.
Use LLVM clang-format; wrap lines at a maximum of 120 columns; use '// clang-format off/on' sparingly with justification.
Use smart pointers for heap allocations; prefer unique_ptr for sole ownership, shared_ptr for shared...

Files:

  • cpp/tensorrt_llm/kernels/userbuffers/ub_allocator.h
  • cpp/tensorrt_llm/kernels/userbuffers/ub_allocator.cpp
**/*.{cpp,cxx,cc,cu,h,hpp,hh,hxx,cuh}

📄 CodeRabbit inference engine (CODING_GUIDELINES.md)

C++ filenames should be lowerCamelCase (first letter lowercase) and must be case-insensitive unique within a compilation target.

Files:

  • cpp/tensorrt_llm/kernels/userbuffers/ub_allocator.h
  • cpp/tensorrt_llm/kernels/userbuffers/ub_allocator.cpp
**/*.{h,hpp,hh,hxx}

📄 CodeRabbit inference engine (CODING_GUIDELINES.md)

Document new class interfaces and function prototypes with Doxygen; use //! for single-line and //!< for members.

Files:

  • cpp/tensorrt_llm/kernels/userbuffers/ub_allocator.h
**/*.{h,hpp,hh,hxx,cpp,cxx,cc}

📄 CodeRabbit inference engine (CODING_GUIDELINES.md)

**/*.{h,hpp,hh,hxx,cpp,cxx,cc}: Prefer anonymous namespaces over 'static' for internal linkage of functions.
All templates (class/function/member/static) must be instantiated at least once; non-POD classes should have private data members.

Files:

  • cpp/tensorrt_llm/kernels/userbuffers/ub_allocator.h
  • cpp/tensorrt_llm/kernels/userbuffers/ub_allocator.cpp
**/*.{h,hpp,hh,hxx,cuh}

📄 CodeRabbit inference engine (CODING_GUIDELINES.md)

Use include guards named 'TRTLLM_<FILE_NAME_IN_CAPS_WITH_UNDERSCORES>_H' (no leading or trailing underscore; directory names excluded).

Files:

  • cpp/tensorrt_llm/kernels/userbuffers/ub_allocator.h
🧠 Learnings (1)
📚 Learning: 2025-08-21T00:16:56.457Z
Learnt from: farshadghodsian
PR: NVIDIA/TensorRT-LLM#7101
File: docs/source/blogs/tech_blog/blog9_Deploying_GPT_OSS_on_TRTLLM.md:36-36
Timestamp: 2025-08-21T00:16:56.457Z
Learning: TensorRT-LLM container release tags in documentation should only reference published NGC container images. The README badge version may be ahead of the actual published container versions.

Applied to files:

  • jenkins/current_image_tags.properties
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Pre-commit Check
🔇 Additional comments (8)
jenkins/current_image_tags.properties (1)

15-18: Manually verify URM image tags exist and are pullable before merging. Automated manifest inspect failed due to missing Docker CLI; please pull each image in an authenticated environment:

  • urm.nvidia.com/sw-tensorrt-docker/tensorrt-llm:pytorch-25.06-py3-x86_64-ubuntu24.04-trt10.11.0.33-skip-tritondevel-202509051530-7556
  • urm.nvidia.com/sw-tensorrt-docker/tensorrt-llm:pytorch-25.06-py3-aarch64-ubuntu24.04-trt10.11.0.33-skip-tritondevel-202509051530-7556
  • urm.nvidia.com/sw-tensorrt-docker/tensorrt-llm:cuda-12.9.1-devel-rocky8-x86_64-rocky8-py310-trt10.11.0.33-skip-tritondevel-202509051530-7556
  • urm.nvidia.com/sw-tensorrt-docker/tensorrt-llm:cuda-12.9.1-devel-rocky8-x86_64-rocky8-py312-trt10.11.0.33-skip-tritondevel-202509051530-7556
tensorrt_llm/_torch/pyexecutor/model_engine.py (1)

2337-2339: LGTM: early return disables UB for NCCL_SYMMETRIC.

This correctly prevents UB init on the symmetric path.

cpp/tensorrt_llm/kernels/userbuffers/ub_allocator.cpp (1)

249-257: Good: explicit runtime failure for NCCL < 2.27.

This makes the incompatibility clear at init time.

cpp/tensorrt_llm/kernels/userbuffers/ub_allocator.h (5)

38-41: LGTM on version-gated UBBuffer window support

The conditional field and initializer are correctly guarded for NCCL >= 2.27. This keeps ABI/source compatibility for older NCCL.

Also applies to: 51-53


57-60: Confirm whether window nullability should affect validity

If NCCL_SYMMETRIC requires a valid window, consider extending invalid() (under NCCL >= 2.27) or clearly documenting that window may be null even when addr/handle/size are valid.


89-90: LGTM on feature gating block

The NCCL >= 2.27 specialization is cleanly isolated behind compile-time guards.


140-145: Fallback class stub is fine; ensure runtime paths are gated accordingly

Confirm that callers don’t rely on registerUBBuffer specialization when NCCL < 2.27; the base implementation should be used or tests must skip symmetric paths.


137-137: No action needed: mNCCLHelper already has exactly one out-of-line definition in ub_allocator.cpp (line 125).

return mUbComm;
}

#if NCCL_VERSION_CODE >= NCCL_VERSION(2, 27, 0)
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Missing platform headers for dynamic loading.

dlopen/dlsym/dlclose and LoadLibraryA/GetProcAddress require including <dlfcn.h> or <windows.h>. Add these near the top of the file.

Outside this hunk:

#ifdef _WIN32
#include <windows.h>
#else
#include <dlfcn.h>
#endif
🤖 Prompt for AI Agents
In cpp/tensorrt_llm/kernels/userbuffers/ub_allocator.cpp around line 86, the
code uses dlopen/dlsym/dlclose and Windows LoadLibraryA/GetProcAddress without
including the platform headers; add a conditional include near the top of the
file (with the other includes) that #ifdef _WIN32 include <windows.h> else
include <dlfcn.h>, so the dynamic-loading symbols are declared on each platform
and compilation errors are avoided.

static NCCLHelper& getNCCLHelper();

private:
std::shared_ptr<ncclComm_t> mComm;
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

shared_ptr<ncclComm_t> is incorrect and dangerous

ncclComm_t is a pointer type; shared_ptr<ncclComm_t> manages a ncclComm_t* (double pointer) and will call delete by default — undefined behavior. Use a raw handle or a smart pointer with a proper deleter.

Apply one of:

Option A (simplest; recommended unless shared ownership is required):

-    std::shared_ptr<ncclComm_t> mComm;
+    ncclComm_t mComm{}; // raw NCCL handle; destroy via ncclCommDestroy in .cpp

Option B (owned handle with RAII deleter):

+    using NcclCommHandle = std::unique_ptr<std::remove_pointer_t<ncclComm_t>, void(*)(ncclComm_t)>;
-    std::shared_ptr<ncclComm_t> mComm;
+    NcclCommHandle mComm{nullptr, nullptr};

Note: Option B requires #include <type_traits> and setting the deleter to ncclCommDestroy at initialization.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
std::shared_ptr<ncclComm_t> mComm;
// Was:
// std::shared_ptr<ncclComm_t> mComm;
//
// Use a plain NCCL handle and destroy it in the .cpp via ncclCommDestroy():
ncclComm_t mComm{}; // raw NCCL handle; destroy via ncclCommDestroy in .cpp
🤖 Prompt for AI Agents
In cpp/tensorrt_llm/kernels/userbuffers/ub_allocator.h at line 136, mComm is
declared as std::shared_ptr<ncclComm_t> which is incorrect because ncclComm_t is
already a pointer type and shared_ptr would manage a double pointer and call
delete (UB); fix by replacing the shared_ptr with either a raw handle or an RAII
smart pointer with the correct deleter: Option A (recommended): use ncclComm_t
mComm; and manage lifetime explicitly where created/destroyed; Option B: use a
unique_ptr with the nccl destroy function as deleter, e.g.
std::unique_ptr<std::remove_pointer_t<ncclComm_t>, decltype(&ncclCommDestroy)>
mComm{nullptr, &ncclCommDestroy} and include the appropriate headers before use;
ensure creation/assignment matches the chosen ownership model.

Comment on lines +187 to +189
if strategy == AllReduceStrategy.NCCL_SYMMETRIC:
pytest.skip("NCCL symmetric is not supported for nccl version < 2.27.")

Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Make the skip conditional on NCCL version instead of unconditional.

Right now this always skips NCCL_SYMMETRIC. Gate it on runtime NCCL < 2.27.

-    if strategy == AllReduceStrategy.NCCL_SYMMETRIC:
-        pytest.skip("NCCL symmetric is not supported for nccl version < 2.27.")
+    if strategy == AllReduceStrategy.NCCL_SYMMETRIC:
+        try:
+            import torch.cuda.nccl as nccl
+            nccl_ver = nccl.version()  # e.g., 2708 for 2.7.8; returns int like 22700 for 2.27.0 in newer builds
+        except Exception:
+            nccl_ver = 0
+        # Treat values < 22700 as older than 2.27.0
+        if nccl_ver < 22700:
+            pytest.skip("NCCL symmetric is not supported for nccl version < 2.27.")
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if strategy == AllReduceStrategy.NCCL_SYMMETRIC:
pytest.skip("NCCL symmetric is not supported for nccl version < 2.27.")
if strategy == AllReduceStrategy.NCCL_SYMMETRIC:
try:
import torch.cuda.nccl as nccl
nccl_ver = nccl.version() # e.g., 2708 for 2.7.8; returns int like 22700 for 2.27.0 in newer builds
except Exception:
nccl_ver = 0
# Treat values < 22700 as older than 2.27.0
if nccl_ver < 22700:
pytest.skip("NCCL symmetric is not supported for nccl version < 2.27.")
🤖 Prompt for AI Agents
In tests/unittest/_torch/multi_gpu/test_mnnvl_allreduce.py around lines 187-189,
the current code always skips when strategy == AllReduceStrategy.NCCL_SYMMETRIC;
change this to only skip when the runtime NCCL version is less than 2.27. Query
the runtime NCCL version (e.g., via torch.cuda.nccl.version() or an equivalent
helper used in the test suite), normalize it to a comparable numeric form (e.g.,
2.27 -> 227 or parse a tuple), and only call pytest.skip(...) when the detected
version is < 2.27; otherwise let the test run. Ensure you import/handle the
torch API used and account for None/unsupported returns by treating them as
“skip” if appropriate.

@tensorrt-cicd
Copy link
Collaborator

PR_Github #17779 [ run ] completed with state SUCCESS
/LLM/release-1.1.0rc2/L0_MergeRequest_PR pipeline #78 completed with status: 'SUCCESS'

@litaotju litaotju merged commit 4658b77 into NVIDIA:release/1.1.0rc2 Sep 8, 2025
10 of 11 checks passed
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.

4 participants