Skip to content

Conversation

@yuantailing
Copy link
Member

@yuantailing yuantailing commented Oct 30, 2025

Summary by CodeRabbit

  • New Features

    • Added layer-wise benchmarking examples for DeepSeek models with support for both MPI and Slurm execution.
    • Introduced configurable benchmark scenarios with KV cache, model initialization, and per-iteration parameters.
  • Documentation

    • Added comprehensive guide for running and profiling layer-wise benchmarks with step-by-step instructions and example commands.
  • Tests

    • Added benchmark integration tests covering multiple configurations and deployment modes.
  • Chores

    • Updated ignore rules for containerized build artifacts.

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.

Signed-off-by: Tailing Yuan <yuantailing@gmail.com>
Signed-off-by: Tailing Yuan <yuantailing@gmail.com>
Signed-off-by: Tailing Yuan <yuantailing@gmail.com>
Signed-off-by: Tailing Yuan <yuantailing@gmail.com>
Signed-off-by: Tailing Yuan <yuantailing@gmail.com>
Signed-off-by: Tailing Yuan <yuantailing@gmail.com>
Signed-off-by: Tailing Yuan <yuantailing@gmail.com>
Signed-off-by: Tailing Yuan <yuantailing@gmail.com>
Signed-off-by: Tailing Yuan <yuantailing@gmail.com>
Signed-off-by: Tailing Yuan <yuantailing@gmail.com>
Signed-off-by: Tailing Yuan <yuantailing@gmail.com>
Signed-off-by: Tailing Yuan <yuantailing@gmail.com>
Signed-off-by: Tailing Yuan <yuantailing@gmail.com>
Signed-off-by: Tailing Yuan <yuantailing@gmail.com>
Signed-off-by: Tailing Yuan <yuantailing@gmail.com>
Signed-off-by: Tailing Yuan <yuantailing@gmail.com>
@yuantailing yuantailing requested a review from a team as a code owner October 30, 2025 06:35
@yuantailing yuantailing requested review from QiJune and kaiyux October 30, 2025 06:35
@yuantailing
Copy link
Member Author

/bot run

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 30, 2025

📝 Walkthrough

Walkthrough

This PR introduces layer-wise benchmarking infrastructure for DeepSeek models, including configuration files, MPI/Slurm launch scripts, a Python runner implementation with customizable MoE routing strategies, a standalone benchmark runner script, and corresponding test cases.

Changes

Cohort / File(s) Summary
Documentation & configuration
.gitignore, examples/layer_wise_benchmarks/README.md
Added Enroot SQSH ignore rule and comprehensive README documenting layer-wise benchmark execution paths, environment setup, and usage instructions for MPI and Slurm deployment modes.
Benchmark configuration files
examples/layer_wise_benchmarks/config_ctx.yaml, examples/layer_wise_benchmarks/config_gen.yaml
New YAML configuration files defining model, KV cache, and runtime settings for layer-wise benchmark contexts with context and generation modes respectively.
MPI/Slurm launch scripts
examples/layer_wise_benchmarks/mpi_launch.sh, examples/layer_wise_benchmarks/slurm_alloc.sh, examples/layer_wise_benchmarks/slurm_init_containers.sh, examples/layer_wise_benchmarks/slurm_launch.sh
New shell scripts for MPI execution, Slurm resource allocation, container initialization, and Slurm job launching with environment configuration and command forwarding.
Benchmark runner & execution
examples/layer_wise_benchmarks/run_single.py, examples/layer_wise_benchmarks/run_single.sh
Python script implementing full command-line workflow for configuring and running layer-wise benchmarks with MPI context setup, KV cache management, CUDA graph capture, and profiling statistics; shell wrapper enabling optional Nsight Systems profiling and GPU metrics collection.
DeepSeek V3 runner implementation
tensorrt_llm/tools/layer_wise_benchmarks/deepseekv3_runner.py
New module implementing BalanceMethod enum, RoutingMethod MoE routing strategy, DeepSeekV3Runner for model construction and execution, with support for dynamic routing, weak scaling, KV cache management, and customizable MoE load balancing.
Test infrastructure
tests/unittest/tools/test_layer_wise_benchmarks.py, tests/integration/test_lists/test-db/l0_dgx_b200.yml
New PyTest test module with three GPU-enabled benchmark tests covering different configurations and backends; integration test list registration for DGX B200 systems.

Sequence Diagram

sequenceDiagram
    participant User
    participant run_single.sh
    participant run_single.py
    participant DeepSeekV3Runner
    participant KVCacheManager
    participant Profiler

    User->>run_single.sh: Execute with config
    run_single.sh->>run_single.sh: Setup MPI/OpenMPI env
    run_single.sh->>run_single.sh: Enable nsys profiling (optional)
    run_single.sh->>run_single.py: Execute benchmark script

    run_single.py->>run_single.py: Parse YAML config + CLI args
    run_single.py->>run_single.py: Initialize MPI context (rank, world_size)
    run_single.py->>run_single.py: Set CUDA device

    run_single.py->>DeepSeekV3Runner: Create instance
    DeepSeekV3Runner->>DeepSeekV3Runner: Load model with custom RoutingMethod
    DeepSeekV3Runner->>DeepSeekV3Runner: Apply MoE routing balance strategy

    run_single.py->>KVCacheManager: Create KV cache manager
    run_single.py->>DeepSeekV3Runner: Create run_pack (callable)
    
    rect rgba(100, 200, 100, 0.3)
    Note over run_single.py,Profiler: Warmup Phase
    run_single.py->>Profiler: Start CUDA events
    run_single.py->>DeepSeekV3Runner: Execute warmup iterations
    run_single.py->>Profiler: Stop events (no timing)
    end

    rect rgba(100, 150, 255, 0.3)
    Note over run_single.py,Profiler: Timed Profiling Phase
    run_single.py->>Profiler: Enable CUDA profiler
    run_single.py->>Profiler: Record CUDA events (timed runs)
    run_single.py->>DeepSeekV3Runner: Execute benchmark iterations
    opt CUDA Graph Enabled
        run_single.py->>run_single.py: Capture CUDA graph
        run_single.py->>run_single.py: Replay graph
    end
    run_single.py->>Profiler: Stop CUDA profiler
    end

    run_single.py->>run_single.py: Compute stats (min, max, mean, median, P90)
    run_single.py->>User: Print timing statistics per rank
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Areas requiring extra attention:

  • tensorrt_llm/tools/layer_wise_benchmarks/deepseekv3_runner.py: High-complexity implementation with multiple interacting classes (RouteMethod, DeepSeekV3Runner), custom MoE routing logic with four balance strategies, scaling adjustments, KV cache manager integration, and CUDA graph handling. Requires careful verification of routing calculations and model construction correctness.

  • examples/layer_wise_benchmarks/run_single.py: Dense logic combining MPI initialization, CUDA event management, CUDA graph capture, profiling coordination, and optional graph replay. The ordering of CUDA operations and stream synchronization is critical and error-prone.

  • examples/layer_wise_benchmarks/slurm_init_containers.sh & slurm_launch.sh: Container and environment variable handling with multiple conditional branches; requires verification of Enroot integration, image resolution logic, and proper environment propagation to nested processes.

  • Test module (tests/unittest/tools/test_layer_wise_benchmarks.py): Validates integration across shell scripts, Python code, and external dependencies; GPU availability assumptions should be verified.

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The PR description is largely incomplete. While the PR template structure is present with all required section headings (Description, Test Coverage, PR Checklist), the critical sections contain only template comments and instructions but no substantive content. The Description section, which should explain "the issue and the solution in short," is empty. The Test Coverage section, which should "list clearly what are the relevant test(s) that can safeguard the changes," is also empty. The PR Checklist items are unchecked with no completion notes. Only the template skeleton and bot help documentation are included, not the actual information required by the template. Please complete the PR description by filling in the Description section with an explanation of what this PR adds and why. Provide a clear list of the relevant tests in the Test Coverage section (such as the three tests added in test_layer_wise_benchmarks.py). Complete the PR Checklist by reviewing each item and marking it as applicable or checked off, and ensure all CODEOWNERS and documentation updates are addressed.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Title Check ✅ Passed The PR title "[None][feat] Add layer wise benchmarks" directly and clearly summarizes the primary change in the pull request. The title is concise, follows the required template format with the ticket reference and type indicator, and accurately represents the main objective of adding layer-wise benchmarking infrastructure. A teammate scanning git history would immediately understand this PR introduces benchmarking functionality. The title is specific enough and avoids vague terms like "misc updates."
✨ 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: 7

🧹 Nitpick comments (3)
examples/layer_wise_benchmarks/mpi_launch.sh (1)

6-7: Consider quoting command substitution to prevent word splitting issues.

The shellcheck warnings (SC2046) suggest quoting the command substitution. While word splitting is intentional here (unset needs multiple arguments), the current approach could fail if environment variable names contain special characters.

A more robust approach using a while-read loop:

-# Clear slurm envs
-unset $(env | grep -i slurm | awk -F'=' '{print $1}')
-unset $(env | grep MPI | awk -F'=' '{print $1}')
+# Clear slurm envs
+while IFS='=' read -r name _; do
+    unset "$name"
+done < <(env | grep -i slurm)
+while IFS='=' read -r name _; do
+    unset "$name"
+done < <(env | grep MPI)
tests/unittest/tools/test_layer_wise_benchmarks.py (1)

20-20: Remove unnecessary import.

The llm_root import on Line 20 is unnecessary because llm_root is a pytest fixture defined in conftest.py and is automatically discovered by pytest. The noqa directive is flagged as unused (RUF100), and the import causes redefinition warnings (F811) when llm_root is used as a fixture parameter in the test functions.

Apply this diff to remove the unnecessary import:

-from utils.cpp_paths import llm_root  # noqa: F401
examples/layer_wise_benchmarks/run_single.py (1)

148-149: Consider using itertools.pairwise() for iterating over successive pairs.

The current code uses zip(events, events[1:]) to iterate over successive pairs. Python 3.10+ provides itertools.pairwise() which is more explicit and readable for this pattern.

Apply this diff:

+import itertools
+
 import argparse

 # ... rest of imports ...

 # Print statistics
 #   Print before `cudaProfilerStop` to ensure messages are included in the profile
-time_list = [
-    start.elapsed_time(stop) for start, stop in zip(events, events[1:])
-]
+time_list = [
+    start.elapsed_time(stop) for start, stop in itertools.pairwise(events)
+]
📜 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 e689a73 and 2692888.

📒 Files selected for processing (13)
  • .gitignore (1 hunks)
  • examples/layer_wise_benchmarks/README.md (1 hunks)
  • examples/layer_wise_benchmarks/config_ctx.yaml (1 hunks)
  • examples/layer_wise_benchmarks/config_gen.yaml (1 hunks)
  • examples/layer_wise_benchmarks/mpi_launch.sh (1 hunks)
  • examples/layer_wise_benchmarks/run_single.py (1 hunks)
  • examples/layer_wise_benchmarks/run_single.sh (1 hunks)
  • examples/layer_wise_benchmarks/slurm_alloc.sh (1 hunks)
  • examples/layer_wise_benchmarks/slurm_init_containers.sh (1 hunks)
  • examples/layer_wise_benchmarks/slurm_launch.sh (1 hunks)
  • tensorrt_llm/tools/layer_wise_benchmarks/deepseekv3_runner.py (1 hunks)
  • tests/integration/test_lists/test-db/l0_dgx_b200.yml (1 hunks)
  • tests/unittest/tools/test_layer_wise_benchmarks.py (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{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:

  • examples/layer_wise_benchmarks/run_single.py
  • tensorrt_llm/tools/layer_wise_benchmarks/deepseekv3_runner.py
  • tests/unittest/tools/test_layer_wise_benchmarks.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:

  • examples/layer_wise_benchmarks/run_single.py
  • tensorrt_llm/tools/layer_wise_benchmarks/deepseekv3_runner.py
  • tests/unittest/tools/test_layer_wise_benchmarks.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:

  • examples/layer_wise_benchmarks/run_single.py
  • tensorrt_llm/tools/layer_wise_benchmarks/deepseekv3_runner.py
  • tests/unittest/tools/test_layer_wise_benchmarks.py
🧠 Learnings (12)
📚 Learning: 2025-07-28T17:06:08.621Z
Learnt from: moraxu
PR: NVIDIA/TensorRT-LLM#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:

  • examples/layer_wise_benchmarks/README.md
  • tests/integration/test_lists/test-db/l0_dgx_b200.yml
  • examples/layer_wise_benchmarks/run_single.py
  • tests/unittest/tools/test_layer_wise_benchmarks.py
📚 Learning: 2025-08-20T07:43:36.447Z
Learnt from: ChristinaZ
PR: NVIDIA/TensorRT-LLM#7068
File: cpp/tensorrt_llm/kernels/moeTopKFuncs.cuh:169-172
Timestamp: 2025-08-20T07:43:36.447Z
Learning: In TensorRT-LLM MOE kernels, when processing up to 128 experts across 32 threads, each thread handles at most 4 experts (N < 5 constraint), where N represents candidates per thread rather than total system capacity.

Applied to files:

  • examples/layer_wise_benchmarks/README.md
📚 Learning: 2025-09-09T09:40:45.658Z
Learnt from: fredricz-20070104
PR: NVIDIA/TensorRT-LLM#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/integration/test_lists/test-db/l0_dgx_b200.yml
  • tests/unittest/tools/test_layer_wise_benchmarks.py
📚 Learning: 2025-09-17T02:48:52.732Z
Learnt from: tongyuantongyu
PR: NVIDIA/TensorRT-LLM#7781
File: tests/integration/test_lists/waives.txt:313-313
Timestamp: 2025-09-17T02:48:52.732Z
Learning: In TensorRT-LLM, `tests/integration/test_lists/waives.txt` is specifically for waiving/skipping tests, while other test list files like those in `test-db/` and `qa/` directories are for different test execution contexts (pre-merge, post-merge, QA tests). The same test appearing in both waives.txt and execution list files is intentional - the test is part of test suites but will be skipped due to the waiver.

Applied to files:

  • tests/integration/test_lists/test-db/l0_dgx_b200.yml
  • tests/unittest/tools/test_layer_wise_benchmarks.py
📚 Learning: 2025-08-26T09:49:04.956Z
Learnt from: pengbowang-nv
PR: NVIDIA/TensorRT-LLM#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/integration/test_lists/test-db/l0_dgx_b200.yml
  • tests/unittest/tools/test_layer_wise_benchmarks.py
📚 Learning: 2025-08-22T19:08:10.822Z
Learnt from: yuanjingx87
PR: NVIDIA/TensorRT-LLM#7176
File: jenkins/L0_Test.groovy:361-389
Timestamp: 2025-08-22T19:08:10.822Z
Learning: In Slurm job monitoring scripts, when jobs have built-in timeouts configured (via --time parameter or partition/system timeouts), an additional timeout mechanism in the monitoring loop is typically unnecessary. When a Slurm job times out, it gets terminated and removed from the active queue, causing `squeue -j $jobId` to return non-zero and break monitoring loops naturally. The job's final status can then be checked via `sacct` to determine if it failed due to timeout.

Applied to files:

  • examples/layer_wise_benchmarks/slurm_alloc.sh
📚 Learning: 2025-08-20T15:04:42.885Z
Learnt from: dbari
PR: NVIDIA/TensorRT-LLM#7095
File: docker/Dockerfile.multi:168-168
Timestamp: 2025-08-20T15:04:42.885Z
Learning: In docker/Dockerfile.multi, wildcard COPY for benchmarks (${CPP_BUILD_DIR}/benchmarks/*Benchmark) is intentionally used instead of directory copy because the benchmarks directory contains various other build artifacts during C++ builds, and only specific benchmark executables should be copied to the final image.

Applied to files:

  • examples/layer_wise_benchmarks/slurm_launch.sh
📚 Learning: 2025-08-14T06:36:40.701Z
Learnt from: timlee0212
PR: NVIDIA/TensorRT-LLM#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:

  • examples/layer_wise_benchmarks/config_gen.yaml
📚 Learning: 2025-08-06T13:58:07.506Z
Learnt from: galagam
PR: NVIDIA/TensorRT-LLM#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.

Applied to files:

  • tests/unittest/tools/test_layer_wise_benchmarks.py
📚 Learning: 2025-08-29T14:07:45.863Z
Learnt from: EmmaQiaoCh
PR: NVIDIA/TensorRT-LLM#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.

Applied to files:

  • tests/unittest/tools/test_layer_wise_benchmarks.py
📚 Learning: 2025-08-11T20:09:24.389Z
Learnt from: achartier
PR: NVIDIA/TensorRT-LLM#6763
File: tests/integration/defs/triton_server/conftest.py:16-22
Timestamp: 2025-08-11T20:09:24.389Z
Learning: In the TensorRT-LLM test infrastructure, the team prefers simple, direct solutions (like hard-coding directory traversal counts) over more complex but robust approaches when dealing with stable directory structures. They accept the maintenance cost of updating tests if the layout changes.

Applied to files:

  • tests/unittest/tools/test_layer_wise_benchmarks.py
📚 Learning: 2025-08-01T15:14:45.673Z
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:

  • tests/unittest/tools/test_layer_wise_benchmarks.py
🧬 Code graph analysis (4)
examples/layer_wise_benchmarks/mpi_launch.sh (1)
tests/unittest/llmapi/apps/_test_disagg_serving_multi_nodes.py (1)
  • env (61-68)
examples/layer_wise_benchmarks/run_single.py (4)
tensorrt_llm/_torch/autotuner.py (2)
  • AutoTuner (514-959)
  • autotune (213-245)
tensorrt_llm/_torch/modules/multi_stream_utils.py (1)
  • with_multi_stream (26-32)
tensorrt_llm/_utils.py (2)
  • local_mpi_rank (553-554)
  • mpi_world_size (549-550)
tensorrt_llm/tools/layer_wise_benchmarks/deepseekv3_runner.py (7)
  • BalanceMethod (30-34)
  • DeepSeekV3Runner (140-413)
  • create_mapping (396-413)
  • create_kv_cache_manager (355-393)
  • run_pack (331-338)
  • create_run_pack (274-340)
  • replace_routing_method (342-352)
tensorrt_llm/tools/layer_wise_benchmarks/deepseekv3_runner.py (9)
tensorrt_llm/_torch/attention_backend/utils.py (1)
  • get_attention_backend (15-37)
tensorrt_llm/_torch/metadata.py (1)
  • KVCacheParams (9-31)
tensorrt_llm/_torch/models/modeling_deepseekv3.py (2)
  • DeepseekV3DecoderLayer (930-1270)
  • DeepseekV3Gate (651-717)
tensorrt_llm/_torch/modules/fused_moe/fused_moe_wide_ep.py (1)
  • WideEPMoE (28-1073)
tensorrt_llm/_torch/modules/linear.py (2)
  • Linear (1831-2056)
  • WeightMode (35-41)
tensorrt_llm/_torch/pyexecutor/_util.py (1)
  • get_kv_cache_manager_cls (48-56)
tensorrt_llm/_torch/utils.py (2)
  • get_model_extra_attrs (64-65)
  • model_extra_attrs (69-75)
tensorrt_llm/_utils.py (3)
  • local_mpi_size (557-558)
  • mpi_world_size (549-550)
  • torch_dtype_to_binding (417-420)
tensorrt_llm/models/modeling_utils.py (2)
  • QuantConfig (131-271)
  • is_module_excluded_from_quantization (237-250)
tests/unittest/tools/test_layer_wise_benchmarks.py (2)
tests/integration/defs/trt_test_alternative.py (1)
  • check_call (250-258)
tests/integration/defs/conftest.py (1)
  • llm_root (192-193)
🪛 Ruff (0.14.2)
examples/layer_wise_benchmarks/run_single.py

148-148: zip() without an explicit strict= parameter

Add explicit value for parameter strict=

(B905)


148-148: Prefer itertools.pairwise() over zip() when iterating over successive pairs

Replace zip() with itertools.pairwise()

(RUF007)

tensorrt_llm/tools/layer_wise_benchmarks/deepseekv3_runner.py

190-190: Unused function argument: cls

(ARG001)


256-256: Loop control variable name not used within loop body

(B007)


260-260: Loop control variable name not used within loop body

(B007)


265-265: zip() without an explicit strict= parameter

Add explicit value for parameter strict=

(B905)


265-265: Prefer itertools.pairwise() over zip() when iterating over successive pairs

Replace zip() with itertools.pairwise()

(RUF007)


283-284: Avoid specifying long messages outside the exception class

(TRY003)

tests/unittest/tools/test_layer_wise_benchmarks.py

20-20: Unused noqa directive (non-enabled: F401)

Remove unused noqa directive

(RUF100)


25-25: Redefinition of unused llm_root from line 20

(F811)


43-43: Redefinition of unused llm_root from line 20

(F811)


61-61: Redefinition of unused llm_root from line 20

(F811)

🪛 Shellcheck (0.11.0)
examples/layer_wise_benchmarks/mpi_launch.sh

[warning] 6-6: Quote this to prevent word splitting.

(SC2046)


[warning] 7-7: Quote this to prevent word splitting.

(SC2046)

Signed-off-by: Tailing Yuan <yuantailing@gmail.com>
@yuantailing yuantailing force-pushed the layer_wise_benchmarks branch from 2692888 to 84f5eee Compare October 30, 2025 06:45
@tensorrt-cicd
Copy link
Collaborator

PR_Github #22998 [ run ] triggered by Bot. Commit: 84f5eee

@tensorrt-cicd
Copy link
Collaborator

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

@juney-nvidia
Copy link
Collaborator

@yuantailing

This is a very useful tool to simplify performance benchmarking/profiling complexities to benefit the team.
Also the changes are mainly about newly added and modularized logics. I just merge it for now.
As to the code review feedbacks, pls iterate to refine in the later PRs.

Thanks
June

@juney-nvidia juney-nvidia merged commit f9c7786 into NVIDIA:main Oct 30, 2025
5 checks passed
fredricz-20070104 pushed a commit to fredricz-20070104/TensorRT-LLM that referenced this pull request Nov 5, 2025
Signed-off-by: Tailing Yuan <yuantailing@gmail.com>
Signed-off-by: FredricZ-2007 <226039983+fredricz-20070104@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants