KEMBAR78
[https://nvbugs/5433581][fix] DeepGEMM installation on SBSA by zongfeijing · Pull Request #6588 · NVIDIA/TensorRT-LLM · GitHub
Skip to content

Conversation

@zongfeijing
Copy link
Collaborator

@zongfeijing zongfeijing commented Aug 4, 2025

Summary by CodeRabbit

  • New Features

    • Integrated DeepGEMM as a new optional module with build and packaging support, including CMake options and Python bindings.
  • Chores

    • Updated dependency management and build scripts to support DeepGEMM integration.
    • Added DeepGEMM-related files and directories to ignore lists.
    • Included DeepGEMM license and related files in package data.
  • Refactor

    • Updated import statements to use the new DeepGEMM module path throughout the codebase.
  • Tests

    • Adjusted test imports to align with the new DeepGEMM integration.

Description

Test Coverage

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.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 4, 2025

📝 Walkthrough

Walkthrough

This change integrates the DeepGEMM module as a new third-party submodule and build target. It updates build scripts, CMake configurations, and packaging logic to support DeepGEMM, including copying source files, adapting imports, and handling Python bindings. Import statements across relevant Python modules and tests are updated to reflect the new package structure.

Changes

Cohort / File(s) Change Summary
DeepGEMM Submodule Integration
.gitmodules, 3rdparty/DeepGEMM
Added DeepGEMM as a git submodule at 3rdparty/DeepGEMM with a specific commit reference. Updated .gitmodules accordingly.
Build System: CMake
cpp/CMakeLists.txt, cpp/tensorrt_llm/CMakeLists.txt
Introduced BUILD_DEEP_GEMM CMake option (enabled by default). Updated logic to conditionally include DeepGEMM in the build process, similar to existing DeepEP logic.
DeepGEMM Build Logic
cpp/tensorrt_llm/deep_gemm/CMakeLists.txt, cpp/tensorrt_llm/deep_gemm/deep_gemm_cpp_tllm.version
Added new CMakeLists.txt for building DeepGEMM: sets up custom targets, copies/adapts Python files, configures and builds the pybind11 module, handles dependencies, and manages symbol visibility with a version script.
Python Packaging and Build Script
scripts/build_wheel.py, setup.py
Extended build and packaging scripts to support DeepGEMM: added build flags, handled installation and symlink logic, included DeepGEMM files in package data, and enabled stub generation for its bindings.
Dependency Management
requirements.txt
Removed the deep_gemm dependency from requirements, as it is now included as a submodule and built in-tree.
.gitignore Update
.gitignore
Added ignore rules for DeepGEMM build artifacts and directories, mirroring those for DeepEP.
Python Import Path Updates
tensorrt_llm/_torch/modules/fused_moe/fused_moe_deepgemm.py, tensorrt_llm/_torch/modules/linear.py, tests/unittest/_torch/thop/test_fp8_block_scale_gemm.py
Changed import statements to reference DeepGEMM via the tensorrt_llm package instead of direct or local imports.

Sequence Diagram(s)

sequenceDiagram
    participant Developer
    participant BuildScript
    participant CMake
    participant DeepGEMM Submodule
    participant PythonPackage

    Developer->>BuildScript: Run build_wheel.py
    BuildScript->>CMake: Configure with -DBUILD_DEEP_GEMM=ON
    CMake->>DeepGEMM Submodule: Build deep_gemm target
    DeepGEMM Submodule->>CMake: Copy/adapt Python & C++ sources, build pybind11 module
    CMake->>BuildScript: Build outputs (shared object, Python files)
    BuildScript->>PythonPackage: Install deep_gemm_cpp_tllm, copy bindings
    BuildScript->>PythonPackage: Generate stubs for deep_gemm_cpp_tllm
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~35 minutes

Suggested reviewers

  • chzblych
  • HuiGao-NV
  • pcastonguay
  • Shixiaowei02

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 54e65c1 and f96f760.

📒 Files selected for processing (3)
  • .gitmodules (1 hunks)
  • 3rdparty/DeepGEMM (1 hunks)
  • cpp/tensorrt_llm/deep_gemm/CMakeLists.txt (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • .gitmodules
🚧 Files skipped from review as they are similar to previous changes (2)
  • 3rdparty/DeepGEMM
  • cpp/tensorrt_llm/deep_gemm/CMakeLists.txt
⏰ 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
✨ Finishing Touches
🧪 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.
    • Explain this complex logic.
    • 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. Examples:
    • @coderabbitai explain this code block.
  • 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 src/utils.ts and explain its main purpose.
    • @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 comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai 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.

Documentation and Community

  • 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: 1

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2279cec and 40760cf.

📒 Files selected for processing (2)
  • requirements.txt (1 hunks)
  • tests/unittest/test_pip_install.py (0 hunks)
💤 Files with no reviewable changes (1)
  • tests/unittest/test_pip_install.py

@zongfeijing zongfeijing requested a review from a team as a code owner August 5, 2025 07:00
Signed-off-by: Zongfei Jing <20381269+zongfeijing@users.noreply.github.com>
@zongfeijing
Copy link
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd
Copy link
Collaborator

PR_Github #14107 [ run ] triggered by Bot

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

🧹 Nitpick comments (2)
scripts/build_wheel.py (1)

495-495: Fix line length violation.

The CMake configure command line exceeds the 120-character limit flagged by static analysis.

Split the long line for better readability:

-            cmake_configure_command = (
-                f'cmake -DCMAKE_BUILD_TYPE="{build_type}" -DBUILD_PYT="{build_pyt}" -DBINDING_TYPE="{binding_type}" -DBUILD_DEEP_EP="{build_deep_ep}" -DBUILD_DEEP_GEMM="{build_deep_gemm}"'
+            cmake_configure_command = (
+                f'cmake -DCMAKE_BUILD_TYPE="{build_type}" -DBUILD_PYT="{build_pyt}" '
+                f'-DBINDING_TYPE="{binding_type}" -DBUILD_DEEP_EP="{build_deep_ep}" '
+                f'-DBUILD_DEEP_GEMM="{build_deep_gemm}"'
cpp/tensorrt_llm/deep_gemm/CMakeLists.txt (1)

134-135: Consider adding platform-specific optimization flags.

The compile options include -Wno-psabi which is GCC-specific. Consider making this conditional for better cross-compiler compatibility.

-target_compile_options(deep_gemm_cpp_tllm PRIVATE ${TORCH_CXX_FLAGS} -std=c++20
-                                                  -O3 -fPIC -Wno-psabi)
+target_compile_options(deep_gemm_cpp_tllm PRIVATE ${TORCH_CXX_FLAGS} -std=c++20 -O3 -fPIC)
+if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+  target_compile_options(deep_gemm_cpp_tllm PRIVATE -Wno-psabi)
+endif()
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 40760cf and 78830cb.

📒 Files selected for processing (13)
  • .gitignore (1 hunks)
  • .gitmodules (1 hunks)
  • 3rdparty/deepgemm (1 hunks)
  • cpp/CMakeLists.txt (3 hunks)
  • cpp/tensorrt_llm/CMakeLists.txt (1 hunks)
  • cpp/tensorrt_llm/deep_gemm/CMakeLists.txt (1 hunks)
  • cpp/tensorrt_llm/deep_gemm/deep_gemm_cpp_tllm.version (1 hunks)
  • requirements.txt (0 hunks)
  • scripts/build_wheel.py (5 hunks)
  • setup.py (1 hunks)
  • tensorrt_llm/_torch/modules/fused_moe/fused_moe_deepgemm.py (1 hunks)
  • tensorrt_llm/_torch/modules/linear.py (1 hunks)
  • tests/unittest/_torch/thop/test_fp8_block_scale_gemm.py (1 hunks)
💤 Files with no reviewable changes (1)
  • requirements.txt
✅ Files skipped from review due to trivial changes (7)
  • .gitmodules
  • setup.py
  • 3rdparty/deepgemm
  • cpp/tensorrt_llm/CMakeLists.txt
  • .gitignore
  • cpp/tensorrt_llm/deep_gemm/deep_gemm_cpp_tllm.version
  • tests/unittest/_torch/thop/test_fp8_block_scale_gemm.py
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: in tensorrt-llm, examples directory can have different dependency versions than the root requirement...
Learnt from: yibinl-nvidia
PR: NVIDIA/TensorRT-LLM#6506
File: examples/models/core/mixtral/requirements.txt:3-3
Timestamp: 2025-08-01T15:14:45.673Z
Learning: In TensorRT-LLM, examples directory can have different dependency versions than the root requirements.txt file. Version conflicts between root and examples dependencies are acceptable because examples are designed to be standalone and self-contained.

Applied to files:

  • cpp/CMakeLists.txt
🪛 Ruff (0.12.2)
scripts/build_wheel.py

495-495: Line too long (188 > 120)

(E501)

🔇 Additional comments (24)
tensorrt_llm/_torch/modules/fused_moe/fused_moe_deepgemm.py (1)

9-9: LGTM! Import path updated for DeepGEMM submodule integration.

The change from direct import to relative import from the tensorrt_llm package is correct and aligns with the broader effort to integrate DeepGEMM as a submodule rather than an external dependency.

cpp/CMakeLists.txt (3)

34-34: LGTM! DeepGEMM build option added.

The new BUILD_DEEPGEMM option follows the same pattern as other build options and is appropriately enabled by default.


203-208: LGTM! Conditional logic properly updated for DeepGEMM.

The pybind11 subdirectory inclusion logic is correctly extended to include the new BUILD_DEEPGEMM option alongside existing conditions, ensuring pybind11 is available when DeepGEMM is being built.


224-228: LGTM! Include directories logic properly updated.

The pybind11 include directories are correctly made available when BUILD_DEEPGEMM is enabled, maintaining consistency with the subdirectory inclusion logic above.

tensorrt_llm/_torch/modules/linear.py (1)

576-576: LGTM! Import path updated for DeepGEMM submodule integration.

The change from direct import to relative import from the tensorrt_llm package is consistent with the DeepGEMM submodule integration. The conditional import for SM version 100 remains properly structured.

scripts/build_wheel.py (6)

451-451: LGTM: Consistent variable initialization.

The build_deep_gemm = "OFF" initialization follows the same pattern as build_deep_ep for cpp_only builds.


453-453: LGTM: Proper target extension.

Adding "deep_gemm" to the targets list alongside "deep_ep" maintains consistency with the existing pattern.


456-456: LGTM: Consistent build flag setting.

The build_deep_gemm = "ON" assignment follows the established pattern for non-cpp_only builds.


642-648: LGTM: Proper deep_gemm directory cleanup.

The cleanup logic correctly mirrors the deep_ep pattern, handling both symlinks and directories appropriately.


698-708: LGTM: Consistent deep_gemm installation logic.

The installation steps properly mirror the deep_ep pattern, including:

  • CUDA architecture file detection
  • Conditional pybind11 library installation
  • Python bindings directory installation

782-785: LGTM: Consistent stub generation for deep_gemm.

The pybind11 stub generation logic correctly follows the same conditional pattern as deep_ep, ensuring stubs are only generated when CUDA architectures are available.

cpp/tensorrt_llm/deep_gemm/CMakeLists.txt (13)

1-1: LGTM: Proper custom target definition.

Creating the deep_gemm custom target follows CMake best practices.


7-21: LGTM: Robust CUDA architecture filtering.

The regex-based CUDA architecture parsing correctly filters for major version >= 9, with proper error handling for invalid formats.


24-26: LGTM: Proper Windows exclusion.

Explicitly clearing CUDA architectures on Windows prevents build attempts on unsupported platforms.


32-34: LGTM: Early return for unsupported architectures.

The early return when no suitable CUDA architectures are available prevents unnecessary build steps.


43-48: LGTM: Comprehensive submodule validation.

The check for DeepGEMM submodule existence with clear error message and remediation instructions is well-implemented.


51-56: LGTM: Dependency validation.

Checking for cutlass include directory ensures submodule dependencies are properly initialized.


74-89: LGTM: Smart Python file adaptation.

The logic to modify import statements in Python files (deep_gemm_cpptensorrt_llm.deep_gemm_cpp_tllm) and add adaptation headers is well-designed for integration.


97-101: LGTM: Proper dependency tracking.

Adding source files to CMAKE_CONFIGURE_DEPENDS ensures CMake reconfigures when source files change.


114-114: LGTM: Appropriate compilation setting.

Disabling interprocedural optimization for CUDA separable compilation is correct for this use case.


123-132: LGTM: Proper pybind11 module configuration.

The module configuration with C++20 standard, CUDA architectures, and RPATH settings follows best practices.


149-150: LGTM: Appropriate library linking.

Linking against TORCH_LIBRARIES, TORCH_PYTHON_LIB, cuda, and cudart provides the necessary dependencies.


153-155: LGTM: Proper CUDA library directories.

Including both lib64 and lib64/stubs directories ensures proper CUDA library resolution.


159-159: LGTM: Correct dependency declaration.

Making the deep_gemm target depend on deep_gemm_cpp_tllm ensures proper build ordering.

Signed-off-by: Zongfei Jing <20381269+zongfeijing@users.noreply.github.com>
@zongfeijing
Copy link
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd
Copy link
Collaborator

PR_Github #14119 [ run ] triggered by Bot

@tensorrt-cicd
Copy link
Collaborator

PR_Github #14107 [ run ] completed with state ABORTED

Signed-off-by: Zongfei Jing <20381269+zongfeijing@users.noreply.github.com>
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: 0

🔭 Outside diff range comments (1)
scripts/build_wheel.py (1)

774-780: Make deep_gemm stub generation conditional like deep_ep.

The deep_gemm stub generation is unconditional while deep_ep checks for CUDA architectures first. This could fail if the deep_gemm module wasn't built.

                         if deep_ep_cuda_architectures:
                             build_run(
                                 f"\"{venv_python}\" -m pybind11_stubgen -o . deep_ep_cpp_tllm --exit-code",
                                 env=env_ld)
-                        build_run(
-                            f"\"{venv_python}\" -m pybind11_stubgen -o . deep_gemm_cpp_tllm --exit-code",
-                            env=env_ld)
+                        # Check if deep_gemm was built before generating stubs
+                        if (pkg_dir / "deep_gemm_cpp_tllm.so").exists() or list(pkg_dir.glob("deep_gemm_cpp_tllm.*.so")):
+                            build_run(
+                                f"\"{venv_python}\" -m pybind11_stubgen -o . deep_gemm_cpp_tllm --exit-code",
+                                env=env_ld)
🧹 Nitpick comments (2)
scripts/build_wheel.py (2)

495-495: Split the long CMake command line for better readability.

The CMake configuration is correct, but the line exceeds the 120-character limit.

Consider splitting the command across multiple lines:

-                f'cmake -DCMAKE_BUILD_TYPE="{build_type}" -DBUILD_PYT="{build_pyt}" -DBINDING_TYPE="{binding_type}" -DBUILD_DEEP_EP="{build_deep_ep}" -DBUILD_DEEP_GEMM="{build_deep_gemm}"'
+                f'cmake -DCMAKE_BUILD_TYPE="{build_type}" -DBUILD_PYT="{build_pyt}" '
+                f'-DBINDING_TYPE="{binding_type}" -DBUILD_DEEP_EP="{build_deep_ep}" '
+                f'-DBUILD_DEEP_GEMM="{build_deep_gemm}"'

2-2: Update copyright year to include 2025.

The copyright header should be updated to reflect the current year.

-# SPDX-FileCopyrightText: Copyright (c) 2022-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+# SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 109adb6 and cce77ae.

📒 Files selected for processing (5)
  • .gitmodules (1 hunks)
  • 3rdparty/DeepGEMM (1 hunks)
  • cpp/CMakeLists.txt (3 hunks)
  • cpp/tensorrt_llm/deep_gemm/CMakeLists.txt (1 hunks)
  • scripts/build_wheel.py (5 hunks)
✅ Files skipped from review due to trivial changes (2)
  • 3rdparty/DeepGEMM
  • .gitmodules
🚧 Files skipped from review as they are similar to previous changes (2)
  • cpp/CMakeLists.txt
  • cpp/tensorrt_llm/deep_gemm/CMakeLists.txt
🧰 Additional context used
📓 Path-based instructions (2)
**/*.py

📄 CodeRabbit Inference Engine (CODING_GUIDELINES.md)

**/*.py: The code developed for TensorRT-LLM should conform to Python 3.8+.
Indent Python code with 4 spaces. Do not use tabs.
Always maintain the namespace when importing in Python, even if only one class or function from a module is used.
Python filenames should use snake_case (e.g., some_file.py).
Python classes should use PascalCase (e.g., class SomeClass).
Python functions and methods should use snake_case (e.g., def my_awesome_function():).
Python local variables should use snake_case. Prefix k for variable names that start with a number (e.g., k_99th_percentile).
Python global variables should use upper snake_case and prefix G (e.g., G_MY_GLOBAL).
Python constants should use upper snake_case (e.g., MY_CONSTANT).
Avoid shadowing variables declared in an outer scope in Python.
Initialize all externally visible members of a Python class in the constructor.
For interfaces that may be used outside a file, prefer docstrings over comments in Python.
Comments in Python should be reserved for code within a function, or interfaces that are local to a file.
Use Google style docstrings for Python classes and functions, which can be parsed by Sphinx.
Attributes and variables in Python can be documented inline; attribute docstrings will be rendered under the docstring for the class.
Avoid using reflection in Python when functionality can be easily achieved without reflection.
When using try-except blocks in Python, limit the except to the smallest set of errors possible.
When using try-except blocks to handle multiple possible variable types in Python, keep the body of the try as small as possible, using the else block to implement the logic.

Files:

  • scripts/build_wheel.py
**/*.{cpp,h,cu,py}

📄 CodeRabbit Inference Engine (CODING_GUIDELINES.md)

All TensorRT-LLM Open Source Software code should contain an NVIDIA copyright header that includes the current year. This includes .cpp, .h, .cu, .py, and any other source files which are compiled or interpreted.

Files:

  • scripts/build_wheel.py
🪛 Ruff (0.12.2)
scripts/build_wheel.py

495-495: Line too long (188 > 120)

(E501)

⏰ 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 (3)
scripts/build_wheel.py (3)

451-456: LGTM! Consistent integration of deep_gemm build flag.

The build_deep_gemm flag is properly integrated following the same pattern as build_deep_ep, correctly toggling based on the cpp_only setting.


642-648: LGTM! Proper cleanup handling for deep_gemm directory.

The deep_gemm directory cleanup follows the same robust pattern as deep_ep, correctly handling both symlinks and regular directories.


697-703: Review deep_gemm installation CUDA guard

We’ve noticed a discrepancy between how deep_ep and deep_gemm are handled in scripts/build_wheel.py:

  • deep_ep (lines 678–684) is only installed when deep_ep_cuda_architectures is non-empty.
  • deep_gemm (lines 697–703) is installed unconditionally—and there is no cuda_architectures.txt for deep_gemm in the CMake setup.

Please clarify the intended behavior:

• If deep_gemm should only ship when GPU architectures are specified, introduce a deep_gemm_cuda_architectures variable (by reading build_dir/tensorrt_llm/deep_gemm/cuda_architectures.txt) and wrap both

install_file(get_binding_lib("deep_gemm", "deep_gemm_cpp_tllm"), pkg_dir)
install_tree(... "tensorrt_llm/deep_gemm/python/deep_gemm", deep_gemm_dir, dirs_exist_ok=True)

in if deep_gemm_cuda_architectures:.

• Otherwise, please add a comment explaining why deep_gemm is always installed (e.g., CPU fallback or unified binary).

Location to review:

  • scripts/build_wheel.py lines 697–703

@zongfeijing zongfeijing requested a review from litaotju August 5, 2025 13:54
@zongfeijing
Copy link
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd
Copy link
Collaborator

PR_Github #14156 [ run ] triggered by Bot

@tensorrt-cicd
Copy link
Collaborator

PR_Github #14119 [ run ] completed with state ABORTED

@tensorrt-cicd
Copy link
Collaborator

PR_Github #14156 [ run ] completed with state SUCCESS
/LLM/main/L0_MergeRequest_PR pipeline #10682 completed with status: 'SUCCESS'
Pipeline passed with automatic retried tests. Check the rerun report for details.

@zongfeijing zongfeijing requested a review from a team as a code owner August 5, 2025 23:30
@zongfeijing zongfeijing requested a review from hlu1 August 5, 2025 23:30
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: 4

🧹 Nitpick comments (3)
cpp/tensorrt_llm/deep_gemm/CMakeLists.txt (3)

90-102: Duplicate / conflicting C++ standard flags
CXX_STANDARD 17 is already enforced via target properties. Injecting -std=c++17 again in target_compile_options is redundant and risks conflicting flags if a toolchain wrapper adds its own -std= option.

Simply drop the manual -std=c++17 flag:

-target_compile_options(deep_gemm_cpp_tllm PRIVATE ${TORCH_CXX_FLAGS} -std=c++17
-                                                 -O3 -fPIC -Wno-psabi)
+target_compile_options(deep_gemm_cpp_tllm PRIVATE ${TORCH_CXX_FLAGS} -O3 -fPIC -Wno-psabi)

95-96: CUDA_SEPARABLE_COMPILATION has no effect
The target contains only .cpp sources; enabling CUDA_SEPARABLE_COMPILATION is a no-op and can trigger CMake warnings when CUDA language isn’t enabled. Remove it or guard it with if (TARGET CUDA::cuda_driver).


119-122: target_link_directories unnecessary once imported CUDA targets are used
If the previous suggestion is applied, manual target_link_directories can be dropped—CUDA::cudart already provides the correct paths.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cce77ae and f2f30d7.

📒 Files selected for processing (3)
  • .gitmodules (1 hunks)
  • 3rdparty/DeepGEMM (1 hunks)
  • cpp/tensorrt_llm/deep_gemm/CMakeLists.txt (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • .gitmodules
🚧 Files skipped from review as they are similar to previous changes (1)
  • 3rdparty/DeepGEMM
⏰ 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

@zongfeijing
Copy link
Collaborator Author

/bot run --disable-fail-fast

Signed-off-by: Zongfei Jing <20381269+zongfeijing@users.noreply.github.com>
@zongfeijing
Copy link
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd
Copy link
Collaborator

PR_Github #14192 [ run ] triggered by Bot

@tensorrt-cicd
Copy link
Collaborator

PR_Github #14193 [ run ] triggered by Bot

@tensorrt-cicd
Copy link
Collaborator

PR_Github #14192 [ run ] completed with state ABORTED

@tensorrt-cicd
Copy link
Collaborator

PR_Github #14193 [ run ] completed with state SUCCESS
/LLM/main/L0_MergeRequest_PR pipeline #10718 completed with status: 'FAILURE'

@zongfeijing
Copy link
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd
Copy link
Collaborator

PR_Github #14218 [ run ] triggered by Bot

@tensorrt-cicd
Copy link
Collaborator

PR_Github #14218 [ run ] completed with state SUCCESS
/LLM/main/L0_MergeRequest_PR pipeline #10737 completed with status: 'SUCCESS'

@zongfeijing zongfeijing merged commit 0ff8df9 into NVIDIA:main Aug 6, 2025
4 checks passed
jain-ria pushed a commit to jain-ria/TensorRT-LLM that referenced this pull request Aug 7, 2025
)

Signed-off-by: Zongfei Jing <20381269+zongfeijing@users.noreply.github.com>
@zongfeijing zongfeijing deleted the user/zongfeij/fix branch September 2, 2025 08:57
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