Skip to content

Conversation

@MrGeva
Copy link
Collaborator

@MrGeva MrGeva commented Nov 10, 2025

  1. Enlarged the allreduce workspace size to 64MB because the 8MB that was before caused hangs and crashes (see the bug linked to the title). the problem surfaced due to this commit eeb56c2. Ideally the workspace calculation could be calculated dynamically based on the model config, however this is a bigger change to be considered.
  2. Added fallback from one shot to two shot kernel in case of a too short seq len that one shot does not support.
  3. Added all_reduce strategy arg to AutoDeploy's config
  4. Added a test for all strategies

Summary by CodeRabbit

Release Notes

  • New Features

    • Added configurable AllReduce strategy selection for distributed inference (AUTO, NCCL, ONESHOT, TWOSHOT, MIN_LATENCY, and others).
    • Added global AllReduce strategy configuration API with AUTO as default mode.
    • Added environment variable override for AllReduce fusion workspace size.
  • Improvements

    • TWOSHOT strategy now automatically falls back to ONESHOT when sequence length is smaller than tensor-parallel size.
  • Tests

    • Added multi-GPU AllReduce strategy benchmark test suite with timeout protection.

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.

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.

@MrGeva MrGeva requested a review from a team as a code owner November 10, 2025 15:12
@MrGeva MrGeva requested a review from nvchenghaoz November 10, 2025 15:12
@coderabbitai coderabbitai bot changed the title [https://nvbugs/5647400] @coderabbitai title [https://nvbugs/5647400] [feat] Add AllReduce strategy configuration system Nov 10, 2025
@MrGeva MrGeva changed the title [https://nvbugs/5647400] [feat] Add AllReduce strategy configuration system [https://nvbugs/5647400] [fix] Enlarged the allreduce workspace size to 64MB. Added strategy to AD config. Nov 10, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 10, 2025

📝 Walkthrough

Walkthrough

A distributed inference configuration system for AllReduce strategies was added, enabling runtime selection of AllReduce fusion kernel strategies. Changes span configuration fields, global strategy registry with setter functions, runtime application during executor initialization, safety guardrails for strategy constraints, and comprehensive multi-GPU validation tests.

Changes

Cohort / File(s) Summary
Configuration Layer
tensorrt_llm/_torch/auto_deploy/llm_args.py
Added allreduce_strategy field to AutoDeployConfig with Literal type supporting AUTO, NCCL, ONESHOT, TWOSHOT, MIN_LATENCY, LOWPRECISION, UB, MNNVL, NCCL_SYMMETRIC; defaults to AUTO.
Strategy Registry & Management
tensorrt_llm/_torch/auto_deploy/distributed/trtllm.py
Introduced global _global_allreduce_strategy variable, public set_allreduce_strategy(strategy) setter, cache key incorporation, and fallback stub for ImportError scenarios.
Runtime Application
tensorrt_llm/_torch/auto_deploy/shim/ad_executor.py
Added conditional strategy configuration block during executor creation that maps config string strategy to AllReduceStrategy enum and applies via set_allreduce_strategy() if non-AUTO.
C++ Implementation Guardrail
cpp/tensorrt_llm/thop/allreduceOp.cpp
Added validation for TWOSHOT strategy: if seq_len < tp_size, logs warning and falls back to ONESHOT instead of returning TWOSHOT.
Workspace Configuration
tensorrt_llm/plugin/plugin.py
Refactored workspace size calculation with environment variable override TRTLLM_ALLREDUCE_FUSION_WORKSPACE_SIZE, retains deterministic path, defaults to 64 MiB instead of prior smaller values.
Test Suite
tests/unittest/_torch/auto_deploy/unit/multigpu/test_ad_allreduce_strategies.py
New comprehensive test module with timeout protection, dataset preparation helpers, parameterized tests for AUTO/ONESHOT/TWOSHOT/MIN_LATENCY/NCCL strategies, and end-to-end multi-GPU validation.

Sequence Diagram

sequenceDiagram
    participant User as User Config
    participant LlmArgs as AutoDeployConfig
    participant Executor as ad_executor
    participant Strategy as Strategy Registry<br/>(trtllm.py)
    participant AllReduceOp as AllReduceOp<br/>(C++)

    User->>LlmArgs: allreduce_strategy: "TWOSHOT"
    LlmArgs->>Executor: create_autodeploy_executor(ad_config)
    
    alt allreduce_strategy != "AUTO"
        Executor->>Strategy: set_allreduce_strategy(TWOSHOT)
        Strategy->>Strategy: _global_allreduce_strategy = TWOSHOT<br/>clear cache
        Executor->>Executor: Log chosen strategy
    end
    
    Executor->>AllReduceOp: Initialize with global strategy
    
    alt TWOSHOT selected & seq_len < tp_size
        AllReduceOp->>AllReduceOp: Log warning
        AllReduceOp->>AllReduceOp: Fallback to ONESHOT
    else TWOSHOT & seq_len >= tp_size
        AllReduceOp->>AllReduceOp: Proceed with TWOSHOT
    else Other strategies
        AllReduceOp->>AllReduceOp: Use as configured
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Areas requiring extra attention:
    • Strategy fallback logic in allreduceOp.cpp: Verify condition (seq_len < tp_size) correctly identifies undersized sequences and that fallback to ONESHOT preserves correctness.
    • Cache invalidation in trtllm.py: Confirm cache clearing on strategy change prevents stale cached AllReduce instances with old strategies.
    • String-to-enum mapping in ad_executor.py: Ensure getattr(AllReduceStrategy, strategy_string) handles all supported strategy names and invalid inputs gracefully.
    • Test setup and teardown in test module: Verify dataset preparation, temporary directory cleanup, and timeout context manager don't leak resources or cause flaky test execution.
    • Workspace size change impact: Confirm 64 MiB default doesn't cause out-of-memory or performance regressions compared to previous defaults.

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Description check ⚠️ Warning PR description lacks required sections. Missing: formal PR title with ticket/type format, complete Description and Test Coverage sections. Provided content is only brief bullet points without proper structure. Add PR title following [TICKET][type] format, expand Description section explaining the issue and solution, and list specific test cases in Test Coverage section.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main changes: enlarging allreduce workspace size to 64MB and adding strategy to AutoDeploy config, matching the file modifications.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • 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

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

🧹 Nitpick comments (1)
tests/unittest/_torch/auto_deploy/unit/multigpu/test_ad_allreduce_strategies.py (1)

65-86: Use the active interpreter when spawning the dataset helper

Hard-coding "python3" will break on platforms where that binary name is missing or points to a different runtime. Switch to sys.executable so the helper runs under the same interpreter driving the tests.

-        "python3",
+        sys.executable,

Add import sys alongside the existing imports.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between edc91ba and 3640691.

📒 Files selected for processing (6)
  • cpp/tensorrt_llm/thop/allreduceOp.cpp (1 hunks)
  • tensorrt_llm/_torch/auto_deploy/distributed/trtllm.py (3 hunks)
  • tensorrt_llm/_torch/auto_deploy/llm_args.py (1 hunks)
  • tensorrt_llm/_torch/auto_deploy/shim/ad_executor.py (1 hunks)
  • tensorrt_llm/plugin/plugin.py (1 hunks)
  • tests/unittest/_torch/auto_deploy/unit/multigpu/test_ad_allreduce_strategies.py (1 hunks)
🧰 Additional context used
📓 Path-based instructions (6)
**/*.{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/thop/allreduceOp.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/thop/allreduceOp.cpp
**/*.{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:

  • cpp/tensorrt_llm/thop/allreduceOp.cpp
  • tensorrt_llm/_torch/auto_deploy/shim/ad_executor.py
  • tensorrt_llm/_torch/auto_deploy/distributed/trtllm.py
  • tensorrt_llm/plugin/plugin.py
  • tensorrt_llm/_torch/auto_deploy/llm_args.py
  • tests/unittest/_torch/auto_deploy/unit/multigpu/test_ad_allreduce_strategies.py
**/*.{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/thop/allreduceOp.cpp
**/*.{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:

  • cpp/tensorrt_llm/thop/allreduceOp.cpp
  • tensorrt_llm/_torch/auto_deploy/shim/ad_executor.py
  • tensorrt_llm/_torch/auto_deploy/distributed/trtllm.py
  • tensorrt_llm/plugin/plugin.py
  • tensorrt_llm/_torch/auto_deploy/llm_args.py
  • tests/unittest/_torch/auto_deploy/unit/multigpu/test_ad_allreduce_strategies.py
**/*.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/auto_deploy/shim/ad_executor.py
  • tensorrt_llm/_torch/auto_deploy/distributed/trtllm.py
  • tensorrt_llm/plugin/plugin.py
  • tensorrt_llm/_torch/auto_deploy/llm_args.py
  • tests/unittest/_torch/auto_deploy/unit/multigpu/test_ad_allreduce_strategies.py
🧠 Learnings (15)
📓 Common learnings
Learnt from: venkywonka
Repo: NVIDIA/TensorRT-LLM PR: 6029
File: .github/pull_request_template.md:45-53
Timestamp: 2025-08-27T17:50:13.264Z
Learning: For PR templates in TensorRT-LLM, avoid suggesting changes that would increase developer overhead, such as converting plain bullets to mandatory checkboxes. The team prefers guidance-style bullets that don't require explicit interaction to reduce friction in the PR creation process.
Learnt from: nv-lschneider
Repo: NVIDIA/TensorRT-LLM PR: 7910
File: cpp/tensorrt_llm/thop/allreduceOp.cpp:352-446
Timestamp: 2025-09-23T15:12:38.312Z
Learning: In TensorRT-LLM NCCL device allreduce implementation (cpp/tensorrt_llm/thop/allreduceOp.cpp), the goto pattern in runNCCLAllReduceDeviceFusion is intentionally used for future extensibility, allowing multiple switch cases to fallback to the default handler. While not aesthetically ideal, this pattern supports adding more fusion cases later that can reuse the same fallback logic.
Learnt from: tongyuantongyu
Repo: NVIDIA/TensorRT-LLM PR: 7520
File: tensorrt_llm/_torch/pyexecutor/resource_manager.py:605-613
Timestamp: 2025-09-24T03:31:28.908Z
Learning: In TensorRT-LLM Ray orchestrator mode, ProcessGroups are initialized with both Gloo and NCCL backends (e.g., "cuda:nccl,cpu:gloo"), allowing PyTorch distributed to automatically route CPU tensors through Gloo and GPU tensors through NCCL. This eliminates the need for manual device placement when performing allreduce operations on base types.
Learnt from: nv-lschneider
Repo: NVIDIA/TensorRT-LLM PR: 7910
File: tests/unittest/_torch/multi_gpu/test_nccl_device.py:138-149
Timestamp: 2025-10-13T19:45:03.518Z
Learning: In test_nccl_device.py, the NCCL device AllReduce implementation compares the entire residual tensor on each rank, unlike the UB implementation which compares per-rank chunks. The residual chunking calculations in the test are intentionally overridden to reflect this design difference.
📚 Learning: 2025-09-23T15:12:38.312Z
Learnt from: nv-lschneider
Repo: NVIDIA/TensorRT-LLM PR: 7910
File: cpp/tensorrt_llm/thop/allreduceOp.cpp:352-446
Timestamp: 2025-09-23T15:12:38.312Z
Learning: In TensorRT-LLM NCCL device allreduce implementation (cpp/tensorrt_llm/thop/allreduceOp.cpp), the goto pattern in runNCCLAllReduceDeviceFusion is intentionally used for future extensibility, allowing multiple switch cases to fallback to the default handler. While not aesthetically ideal, this pattern supports adding more fusion cases later that can reuse the same fallback logic.

Applied to files:

  • cpp/tensorrt_llm/thop/allreduceOp.cpp
  • tensorrt_llm/_torch/auto_deploy/distributed/trtllm.py
📚 Learning: 2025-08-14T06:36:40.701Z
Learnt from: timlee0212
Repo: NVIDIA/TensorRT-LLM PR: 6886
File: tensorrt_llm/_torch/models/modeling_deepseekv3.py:0-0
Timestamp: 2025-08-14T06:36:40.701Z
Learning: In DeepSeek V3 model (tensorrt_llm/_torch/models/modeling_deepseekv3.py), the disagreement between AllReduce.__init__ guard and _compute_mlp_tp_size logic for MNNVL usage is expected by design. The AllReduce component and MLP TP-size computation intentionally use different criteria for MNNVL availability decisions.

Applied to files:

  • cpp/tensorrt_llm/thop/allreduceOp.cpp
  • tensorrt_llm/_torch/auto_deploy/shim/ad_executor.py
  • tensorrt_llm/_torch/auto_deploy/distributed/trtllm.py
  • tensorrt_llm/plugin/plugin.py
  • tensorrt_llm/_torch/auto_deploy/llm_args.py
📚 Learning: 2025-08-20T06:56:02.889Z
Learnt from: eopXD
Repo: NVIDIA/TensorRT-LLM PR: 6768
File: cpp/tensorrt_llm/batch_manager/kvCacheManager.cpp:577-579
Timestamp: 2025-08-20T06:56:02.889Z
Learning: In cpp/tensorrt_llm/batch_manager/kvCacheManager.cpp, maxSequenceLength is now enforced as a non-optional argument in the BlockManager constructor, so concerns about std::nullopt defaulting to 0 are not applicable. When windowSize > maxSequenceLength, a warning should be added instead of handling optional parameter cases.

Applied to files:

  • cpp/tensorrt_llm/thop/allreduceOp.cpp
📚 Learning: 2025-09-23T15:12:38.312Z
Learnt from: nv-lschneider
Repo: NVIDIA/TensorRT-LLM PR: 7910
File: cpp/tensorrt_llm/thop/allreduceOp.cpp:352-446
Timestamp: 2025-09-23T15:12:38.312Z
Learning: In TensorRT-LLM NCCL device implementation, NCCL version 2.28+ requirements are handled at runtime in the nccl_device/config layer rather than with compile-time guards. This allows the allreduceOp to remain version-agnostic and delegates version compatibility validation to the appropriate lower-level components that can gracefully handle unsupported configurations.

Applied to files:

  • cpp/tensorrt_llm/thop/allreduceOp.cpp
  • tensorrt_llm/_torch/auto_deploy/distributed/trtllm.py
  • tensorrt_llm/plugin/plugin.py
  • tensorrt_llm/_torch/auto_deploy/llm_args.py
📚 Learning: 2025-09-19T21:28:13.751Z
Learnt from: jhaotingc
Repo: NVIDIA/TensorRT-LLM PR: 7856
File: cpp/tensorrt_llm/thop/fp8BlockScaleMoe.cpp:159-166
Timestamp: 2025-09-19T21:28:13.751Z
Learning: In TensorRT-LLM blockScaleMoe routing (cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/runner.cu), the DeepSeek routing method performs reinterpret_cast<float*>(routingLogits) at line 89, which could cause issues if routing_logits are BF16. However, Qwen3-FP8 models use RenormalizeNaive routing method and are not affected by this dtype casting issue.

Applied to files:

  • cpp/tensorrt_llm/thop/allreduceOp.cpp
📚 Learning: 2025-08-09T20:57:04.084Z
Learnt from: sklevtsov-nvidia
Repo: NVIDIA/TensorRT-LLM PR: 3294
File: cpp/tensorrt_llm/kernels/cutlass_kernels/moe_gemm/moe_gemm_tma_warp_specialized_input.cu:118-127
Timestamp: 2025-08-09T20:57:04.084Z
Learning: In the CUTLASS MoE finalize fusion implementation (cpp/tensorrt_llm/kernels/cutlass_kernels/moe_gemm/moe_gemm_tma_warp_specialized_input.cu), when setting `fused_finalize_epilogue.stride_final_output` with shape `(hidden_size, num_output_tokens, 1)`, the `num_rows_in_final_output` should be set to `num_output_tokens` (not `hidden_size`) because of a swap+transpose operation that maps rows of the output tensor to `hidden_size` and columns to `num_output_tokens`.

Applied to files:

  • cpp/tensorrt_llm/thop/allreduceOp.cpp
📚 Learning: 2025-08-14T23:23:27.449Z
Learnt from: djns99
Repo: NVIDIA/TensorRT-LLM PR: 6915
File: cpp/tensorrt_llm/kernels/cutlass_kernels/moe_gemm/moe_kernels.cu:4010-4012
Timestamp: 2025-08-14T23:23:27.449Z
Learning: For MOE (Mixture of Experts) code reviews in TensorRT-LLM, avoid repeatedly suggesting finalize fusion validation checks and safety assertions. The user djns99 has indicated these suggestions are repetitive and unwanted across multiple MOE-related changes.

Applied to files:

  • cpp/tensorrt_llm/thop/allreduceOp.cpp
📚 Learning: 2025-09-24T03:31:28.908Z
Learnt from: tongyuantongyu
Repo: NVIDIA/TensorRT-LLM PR: 7520
File: tensorrt_llm/_torch/pyexecutor/resource_manager.py:605-613
Timestamp: 2025-09-24T03:31:28.908Z
Learning: In TensorRT-LLM Ray orchestrator mode, ProcessGroups are initialized with both Gloo and NCCL backends (e.g., "cuda:nccl,cpu:gloo"), allowing PyTorch distributed to automatically route CPU tensors through Gloo and GPU tensors through NCCL. This eliminates the need for manual device placement when performing allreduce operations on base types.

Applied to files:

  • tensorrt_llm/_torch/auto_deploy/distributed/trtllm.py
📚 Learning: 2025-10-13T19:45:03.518Z
Learnt from: nv-lschneider
Repo: NVIDIA/TensorRT-LLM PR: 7910
File: tests/unittest/_torch/multi_gpu/test_nccl_device.py:138-149
Timestamp: 2025-10-13T19:45:03.518Z
Learning: In test_nccl_device.py, the NCCL device AllReduce implementation compares the entire residual tensor on each rank, unlike the UB implementation which compares per-rank chunks. The residual chunking calculations in the test are intentionally overridden to reflect this design difference.

Applied to files:

  • tensorrt_llm/_torch/auto_deploy/distributed/trtllm.py
  • tests/unittest/_torch/auto_deploy/unit/multigpu/test_ad_allreduce_strategies.py
📚 Learning: 2025-08-08T04:10:19.038Z
Learnt from: djns99
Repo: NVIDIA/TensorRT-LLM PR: 6728
File: cpp/tensorrt_llm/plugins/mixtureOfExperts/mixtureOfExpertsPlugin.cpp:966-966
Timestamp: 2025-08-08T04:10:19.038Z
Learning: TensorRT plugins currently don't support padding functionality, and TensorRT is not getting new features (in maintenance mode). This means that duplicating parameters like mExpertHiddenSize in function calls, even with TODO comments, can be acceptable as pragmatic solutions within these constraints.

Applied to files:

  • tensorrt_llm/plugin/plugin.py
📚 Learning: 2025-08-19T03:35:20.866Z
Learnt from: djns99
Repo: NVIDIA/TensorRT-LLM PR: 6915
File: cpp/tensorrt_llm/kernels/cutlass_kernels/moe_gemm/moe_kernels.cu:4616-4626
Timestamp: 2025-08-19T03:35:20.866Z
Learning: In the MOE profiler TMA workspace preparation (cpp/tensorrt_llm/kernels/cutlass_kernels/moe_gemm/moe_kernels.cu), the overlapping of TMA WS regions for NONE and FINALIZE variants is deliberate design to save memory space, as confirmed by djns99. The comment "reuse the same pointers to save space" reflects this intentional behavior.

Applied to files:

  • tensorrt_llm/plugin/plugin.py
📚 Learning: 2025-07-28T17:06:08.621Z
Learnt from: moraxu
Repo: NVIDIA/TensorRT-LLM PR: 6303
File: tests/integration/test_lists/qa/examples_test_list.txt:494-494
Timestamp: 2025-07-28T17:06:08.621Z
Learning: In TensorRT-LLM testing, it's common to have both CLI flow tests (test_cli_flow.py) and PyTorch API tests (test_llm_api_pytorch.py) for the same model. These serve different purposes: CLI flow tests validate the traditional command-line workflow, while PyTorch API tests validate the newer LLM API backend. Both are legitimate and should coexist.

Applied to files:

  • tests/unittest/_torch/auto_deploy/unit/multigpu/test_ad_allreduce_strategies.py
📚 Learning: 2025-08-26T09:49:04.956Z
Learnt from: pengbowang-nv
Repo: NVIDIA/TensorRT-LLM PR: 7192
File: tests/integration/test_lists/test-db/l0_dgx_b200.yml:56-72
Timestamp: 2025-08-26T09:49:04.956Z
Learning: In TensorRT-LLM test configuration files, the test scheduling system handles wildcard matching with special rules that prevent duplicate test execution even when the same tests appear in multiple yaml files with overlapping GPU wildcards (e.g., "*b200*" and "*gb200*").

Applied to files:

  • tests/unittest/_torch/auto_deploy/unit/multigpu/test_ad_allreduce_strategies.py
📚 Learning: 2025-09-09T09:40:45.658Z
Learnt from: fredricz-20070104
Repo: NVIDIA/TensorRT-LLM PR: 7645
File: tests/integration/test_lists/qa/llm_function_core.txt:648-648
Timestamp: 2025-09-09T09:40:45.658Z
Learning: In TensorRT-LLM test lists, it's common and intentional for the same test to appear in multiple test list files when they serve different purposes (e.g., llm_function_core.txt for comprehensive core functionality testing and llm_function_core_sanity.txt for quick sanity checks). This duplication allows tests to be run in different testing contexts.

Applied to files:

  • tests/unittest/_torch/auto_deploy/unit/multigpu/test_ad_allreduce_strategies.py
🧬 Code graph analysis (4)
tensorrt_llm/_torch/auto_deploy/shim/ad_executor.py (2)
tensorrt_llm/functional.py (1)
  • AllReduceStrategy (3876-3885)
tensorrt_llm/_torch/auto_deploy/distributed/trtllm.py (2)
  • set_allreduce_strategy (20-29)
  • set_allreduce_strategy (77-78)
tensorrt_llm/_torch/auto_deploy/distributed/trtllm.py (2)
tensorrt_llm/functional.py (1)
  • AllReduceStrategy (3876-3885)
tensorrt_llm/_torch/distributed/ops.py (1)
  • AllReduce (554-710)
tensorrt_llm/_torch/auto_deploy/llm_args.py (1)
tensorrt_llm/llmapi/llm_args.py (1)
  • Field (63-90)
tests/unittest/_torch/auto_deploy/unit/multigpu/test_ad_allreduce_strategies.py (1)
tests/integration/defs/conftest.py (1)
  • llm_root (192-193)
🪛 Ruff (0.14.3)
tensorrt_llm/_torch/auto_deploy/distributed/trtllm.py

77-77: Unused function argument: strategy

(ARG001)


78-78: Avoid specifying long messages outside the exception class

(TRY003)

tests/unittest/_torch/auto_deploy/unit/multigpu/test_ad_allreduce_strategies.py

31-31: Unused function argument: signum

(ARG001)


31-31: Unused function argument: frame

(ARG001)


32-32: Avoid specifying long messages outside the exception class

(TRY003)


84-84: subprocess call: check for execution of untrusted input

(S603)


88-88: Avoid specifying long messages outside the exception class

(TRY003)


105-105: Unused function argument: llm_root

(ARG001)

⏰ 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 (1)
tests/unittest/_torch/auto_deploy/unit/multigpu/test_ad_allreduce_strategies.py (1)

1-18: Add the mandatory NVIDIA Apache-2.0 header

New Python sources in this repo must start with the NVIDIA Apache-2.0 copyright/license block. Please prepend it so the file stays compliant. As per coding guidelines

+# Copyright (c) 2025, NVIDIA CORPORATION.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
⛔ Skipped due to learnings
Learnt from: xinhe-nv
Repo: NVIDIA/TensorRT-LLM PR: 8534
File: scripts/format_test_list.py:1-6
Timestamp: 2025-10-22T06:53:47.017Z
Learning: The file `scripts/format_test_list.py` in the TensorRT-LLM repository does not require the NVIDIA Apache-2.0 copyright header.
Learnt from: galagam
Repo: NVIDIA/TensorRT-LLM PR: 6487
File: tests/unittest/_torch/auto_deploy/unit/singlegpu/test_ad_trtllm_bench.py:1-12
Timestamp: 2025-08-06T13:58:07.506Z
Learning: In TensorRT-LLM, test files (files under tests/ directories) do not require NVIDIA copyright headers, unlike production source code files. Test files typically start directly with imports, docstrings, or code.
Learnt from: fredricz-20070104
Repo: NVIDIA/TensorRT-LLM PR: 7785
File: tests/integration/defs/perf/utils.py:321-333
Timestamp: 2025-09-17T06:01:01.836Z
Learning: In test infrastructure code for disaggregated serving tests, prefer logging errors and continuing execution rather than raising exceptions on timeout, to avoid disrupting test cleanup and causing cascading failures.
Learnt from: EmmaQiaoCh
Repo: NVIDIA/TensorRT-LLM PR: 7370
File: tests/unittest/trt/model_api/test_model_quantization.py:24-27
Timestamp: 2025-08-29T14:07:45.863Z
Learning: In TensorRT-LLM's CI infrastructure, pytest skip markers (pytest.mark.skip) are properly honored even when test files have __main__ blocks that call test functions directly. The testing system correctly skips tests without requiring modifications to the __main__ block execution pattern.
Learnt from: Funatiq
Repo: NVIDIA/TensorRT-LLM PR: 6754
File: tests/integration/test_lists/test-db/l0_a30.yml:41-47
Timestamp: 2025-08-13T11:07:11.772Z
Learning: In TensorRT-LLM test configuration files like tests/integration/test_lists/test-db/l0_a30.yml, TIMEOUT values are specified in minutes, not seconds.

@MrGeva
Copy link
Collaborator Author

MrGeva commented Nov 10, 2025

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #24030 [ run ] triggered by Bot. Commit: 9b2f3f1

@MrGeva MrGeva requested a review from a team as a code owner November 10, 2025 17:07
@MrGeva MrGeva requested a review from pcastonguay November 10, 2025 17:07
@tensorrt-cicd
Copy link
Collaborator

PR_Github #24030 [ run ] completed with state SUCCESS. Commit: 9b2f3f1
/LLM/main/L0_MergeRequest_PR pipeline #18104 completed with status: 'FAILURE'

@MrGeva MrGeva force-pushed the egeva/fix_auto_allreduce branch from b968266 to c8ea3ca Compare November 10, 2025 20:02
@MrGeva
Copy link
Collaborator Author

MrGeva commented Nov 10, 2025

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #24047 [ run ] triggered by Bot. Commit: c8ea3ca

@tensorrt-cicd
Copy link
Collaborator

PR_Github #24047 [ run ] completed with state SUCCESS. Commit: c8ea3ca
/LLM/main/L0_MergeRequest_PR pipeline #18121 completed with status: 'FAILURE'

@MrGeva
Copy link
Collaborator Author

MrGeva commented Nov 11, 2025

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #24159 [ run ] triggered by Bot. Commit: f77c3ba

@tensorrt-cicd
Copy link
Collaborator

PR_Github #24159 [ run ] completed with state SUCCESS. Commit: f77c3ba
/LLM/main/L0_MergeRequest_PR pipeline #18216 completed with status: 'FAILURE'

@MrGeva
Copy link
Collaborator Author

MrGeva commented Nov 11, 2025

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #24180 [ run ] triggered by Bot. Commit: c926392

@tensorrt-cicd
Copy link
Collaborator

PR_Github #24180 [ run ] completed with state SUCCESS. Commit: c926392
/LLM/main/L0_MergeRequest_PR pipeline #18231 completed with status: 'FAILURE'

Signed-off-by: Eran Geva <19514940+MrGeva@users.noreply.github.com>
Signed-off-by: Eran Geva <19514940+MrGeva@users.noreply.github.com>
Signed-off-by: Eran Geva <19514940+MrGeva@users.noreply.github.com>
@MrGeva MrGeva force-pushed the egeva/fix_auto_allreduce branch from d01cca9 to e040f90 Compare November 11, 2025 20:13
@MrGeva
Copy link
Collaborator Author

MrGeva commented Nov 11, 2025

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #24214 [ run ] triggered by Bot. Commit: e040f90

@MrGeva
Copy link
Collaborator Author

MrGeva commented Nov 11, 2025

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #24215 [ run ] triggered by Bot. Commit: 599791d

@tensorrt-cicd
Copy link
Collaborator

PR_Github #24214 [ run ] completed with state ABORTED. Commit: e040f90
LLM/main/L0_MergeRequest_PR #18260 (Blue Ocean) completed with status: ABORTED

@MrGeva
Copy link
Collaborator Author

MrGeva commented Nov 11, 2025

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #24217 [ run ] triggered by Bot. Commit: 3124116

@tensorrt-cicd
Copy link
Collaborator

PR_Github #24215 [ run ] completed with state ABORTED. Commit: 599791d
LLM/main/L0_MergeRequest_PR #18261 (Blue Ocean) completed with status: ABORTED

@suyoggupta
Copy link
Collaborator

@greg-kwasniewski1 and @lucaslie . Please review

@tensorrt-cicd
Copy link
Collaborator

PR_Github #24217 [ run ] completed with state SUCCESS. Commit: 3124116
/LLM/main/L0_MergeRequest_PR pipeline #18263 completed with status: 'FAILURE'

@MrGeva
Copy link
Collaborator Author

MrGeva commented Nov 12, 2025

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #24285 [ run ] triggered by Bot. Commit: 3124116

@MrGeva
Copy link
Collaborator Author

MrGeva commented Nov 12, 2025

@lucaslie @suyoggupta I am changing approach now, to make the strategy be a global variable to avoid having to touch so many places to pass this param, which could easily break in the future

Signed-off-by: Eran Geva <19514940+MrGeva@users.noreply.github.com>
@MrGeva MrGeva force-pushed the egeva/fix_auto_allreduce branch from 3124116 to a5a6c33 Compare November 12, 2025 14:42
Signed-off-by: Eran Geva <19514940+MrGeva@users.noreply.github.com>
Signed-off-by: Eran Geva <19514940+MrGeva@users.noreply.github.com>
@MrGeva
Copy link
Collaborator Author

MrGeva commented Nov 12, 2025

/bot run

@MrGeva
Copy link
Collaborator Author

MrGeva commented Nov 12, 2025

@lucaslie @suyoggupta its ready for review

@tensorrt-cicd
Copy link
Collaborator

PR_Github #24317 [ run ] triggered by Bot. Commit: 76fca0e

@tensorrt-cicd
Copy link
Collaborator

PR_Github #24285 [ run ] completed with state ABORTED. Commit: 3124116
LLM/main/L0_MergeRequest_PR #18321 (Blue Ocean) completed with status: ABORTED

@tensorrt-cicd
Copy link
Collaborator

PR_Github #24317 [ run ] completed with state SUCCESS. Commit: 76fca0e
/LLM/main/L0_MergeRequest_PR pipeline #18348 completed with status: 'FAILURE'

Copy link
Collaborator

@greg-kwasniewski1 greg-kwasniewski1 left a comment

Choose a reason for hiding this comment

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

Since we moved our discussion to the slack, I left here only a few comments.


try:
with timeout(TEST_TIMEOUT_SECONDS):
result = runner.invoke(main, args, catch_exceptions=False)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need to run the entire llama on the entire synthetic benchmark? Can we reproduce the same behavior of running out of buffer space on the unittest-size kernels, similar to test_tp_sharding.py? E.g., could a single MLP layer timeout on allreduce?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

unfortunately it did not reproduce with an MLP layer unit test

@MrGeva
Copy link
Collaborator Author

MrGeva commented Nov 13, 2025

Alternative proposal for avoiding global variable at: #9145

@MrGeva
Copy link
Collaborator Author

MrGeva commented Nov 13, 2025

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #24486 [ run ] triggered by Bot. Commit: 76fca0e

@tensorrt-cicd
Copy link
Collaborator

PR_Github #24486 [ run ] completed with state SUCCESS. Commit: 76fca0e
/LLM/main/L0_MergeRequest_PR pipeline #18479 completed with status: 'FAILURE'

@MrGeva MrGeva closed this Nov 16, 2025
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.

5 participants