Skip to content

Conversation

@yuantailing
Copy link
Member

@yuantailing yuantailing commented Nov 11, 2025

Summary by CodeRabbit

  • Documentation

    • Updated layer-wise benchmark documentation with new examples for additional models (Qwen3-Next) and expanded troubleshooting section addressing FP8 gemm errors on specific hardware configurations.
  • New Features

    • Added support for benchmarking additional model architectures with configurable backend options.
    • New command-line options for controlling batch sizes and token allocation during benchmarking.

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.

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>
@yuantailing yuantailing requested review from a team as code owners November 11, 2025 07:31
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 11, 2025

📝 Walkthrough

Walkthrough

This pull request introduces a modular runner framework for layer-wise benchmarking that replaces direct dependencies on DeepSeekV3Runner with a pluggable factory pattern. New base classes (RunnerBase, RunnerMixin) and utility functions define a standard interface. DeepSeekV3Runner is refactored to inherit from this new base, Qwen3NextRunner is added as a new implementation, and a factory function (get_runner_cls) routes model types to appropriate runner implementations. Configuration files are updated to support new benchmark models and remove redundant constraints.

Changes

Cohort / File(s) Summary
Build & Linting Configuration
.pre-commit-config.yaml, pyproject.toml, jenkins/L0_MergeRequest.groovy
Removed layer-wise benchmark files from exclusion lists and updated multi-GPU change detection to include new example benchmark paths and test files, enabling linting/formatting checks on previously excluded scripts.
Benchmark Examples & Configuration
examples/layer_wise_benchmarks/README.md, examples/layer_wise_benchmarks/config_ctx.yaml, examples/layer_wise_benchmarks/config_gen.yaml
Updated documentation with new Qwen3-Next and DeepEP benchmark invocations, troubleshooting guidance, and removed max_num_tokens constraints from YAML configuration files.
Benchmark Orchestration
examples/layer_wise_benchmarks/run_single.py
Refactored to use dynamic runner selection via get_runner_cls(model) instead of hardcoded DeepSeekV3Runner; added CLI options for --moe-max-num-tokens and --max-batch-size; updated runner initialization and KV cache setup to use new factory-based Runner API.
Runner Infrastructure (Base & Utilities)
tensorrt_llm/tools/layer_wise_benchmarks/runner_base.py, tensorrt_llm/tools/layer_wise_benchmarks/runner_utils.py, tensorrt_llm/tools/layer_wise_benchmarks/runner_factory.py
Introduced abstract base class RunnerBase with BalanceMethod enum and factory function get_runner_cls() for model-aware runner selection; added RunnerMixin providing shared utilities for KV cache management, quantization config, routing, and run-pack creation.
Runner Implementations
tensorrt_llm/tools/layer_wise_benchmarks/deepseekv3_runner.py, tensorrt_llm/tools/layer_wise_benchmarks/qwen3_next_runner.py
Refactored DeepSeekV3Runner to inherit from RunnerBase and RunnerMixin, updated routing method signatures, and added moe_max_num_tokens parameter; introduced new Qwen3NextRunner implementation inheriting from same base classes with support for Qwen3-Next models.
Tests
tests/unittest/tools/test_layer_wise_benchmarks.py, tests/integration/test_lists/test-db/l0_b200.yml
Added parameterized test test_qwen3_next_gen_tep for Qwen3-Next benchmarking with varying TP sizes; registered test entry in B200 test database.

Sequence Diagram

sequenceDiagram
    participant user as run_single.py
    participant factory as runner_factory
    participant runner as Runner (DeepSeekV3/Qwen3)
    participant base as RunnerBase
    participant mixin as RunnerMixin
    
    user->>factory: get_runner_cls(model_path)
    factory->>factory: load_pretrained_config(model_path)
    factory-->>user: Runner class (DeepSeekV3Runner/Qwen3NextRunner)
    
    user->>user: Instantiate Runner with args
    user->>runner: __init__(mapping, moe_backend, layer_indices, ...)
    runner->>mixin: scaled_from_ctx(scaled_from, mapping, config)
    mixin->>mixin: Build layers, apply quant config, init weights
    mixin-->>runner: Context exit, layers ready
    runner-->>user: Runner instance initialized
    
    user->>runner: create_kv_cache_manager(...)
    runner->>mixin: create_kv_cache_manager(...)
    mixin-->>runner: KVCacheManager instance
    runner-->>user: KVCacheManager ready
    
    user->>runner: create_run_pack(run_type, batch_size, ...)
    runner->>mixin: create_run_pack(...)
    mixin->>mixin: Build attention metadata, assemble run_pack
    mixin-->>runner: run_pack callable
    runner-->>user: Executable run_pack function
    
    user->>user: Execute benchmark loop with run_pack
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

  • Base architecture introduction: New abstract base class RunnerBase with BalanceMethod enum and abstract methods requires careful validation of interface design and consistency across implementations.
  • Mixin pattern complexity: RunnerMixin provides extensive orchestration logic (KV cache management, quantization config, run-pack creation, routing) with conditional behavior for multiple backends (TRTLLM, DeepEP, WIDEEP); verify integration points and edge cases.
  • Multi-runner coordination: DeepSeekV3Runner refactored with signature changes (added moe_max_num_tokens, removed create_kv_cache_manager/create_mapping static methods) while Qwen3NextRunner is newly added; ensure both implementations correctly implement the base interface.
  • Factory pattern: get_runner_cls() routes model types to implementations; verify model type detection logic and completeness of supported models.
  • CLI and config changes: New CLI arguments (--moe-max-num-tokens, --max-batch-size) interact with existing parameter derivation logic; validate parameter flow and default handling.
  • Routing method signature expansion: Static helper methods now accept additional parameters (dtype, world_size, rank); review all call sites for correct argument passing.

Possibly related PRs

  • [None][feat] Add layer wise benchmarks #8777: Directly related; both PRs modify layer-wise benchmark framework, runner abstractions, and add/refactor runner implementations (DeepSeekV3Runner, Qwen3NextRunner) with shared base architecture.

Suggested reviewers

  • QiJune
  • kaiyux
  • juney-nvidia

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
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.
Description check ⚠️ Warning PR description is incomplete: title section is empty, Description and Test Coverage sections lack content, and PR checklist items were not addressed. Fill in the PR title following the template format, provide a clear Description explaining what changes are made and why, list relevant Test Coverage items, and explicitly check the PR checklist items.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The PR title '[None][feat] Add Qwen3-Next to layer-wise benchmarks' clearly and specifically summarizes the main feature addition across the changeset.
✨ 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: 5

Caution

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

⚠️ Outside diff range comments (2)
examples/layer_wise_benchmarks/run_single.py (1)

1-7: Restore the NVIDIA Apache-2.0 header.

This Python entry point is missing the required 2025 NVIDIA Apache-2.0 banner at the top. Please restore it to keep the file compliant.

Apply this diff:

+# Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved.
+# 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.
+
 import argparse

As per coding guidelines

tensorrt_llm/tools/layer_wise_benchmarks/deepseekv3_runner.py (1)

1-24: Restore the NVIDIA Apache-2.0 header.

This file also needs the standard NVIDIA Apache-2.0 header at the top to satisfy the repository’s compliance requirements. As per coding guidelines.

+# Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved.
+# 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.
🧹 Nitpick comments (1)
examples/layer_wise_benchmarks/README.md (1)

101-105: Fix the section heading spelling.

Please collapse “Trouble shooting” into the standard “Troubleshooting” to match common usage.

Apply this diff:

-## Trouble shooting
+## Troubleshooting
📜 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 7aeac97 and 702cede.

📒 Files selected for processing (14)
  • .pre-commit-config.yaml (0 hunks)
  • examples/layer_wise_benchmarks/README.md (5 hunks)
  • examples/layer_wise_benchmarks/config_ctx.yaml (0 hunks)
  • examples/layer_wise_benchmarks/config_gen.yaml (0 hunks)
  • examples/layer_wise_benchmarks/run_single.py (6 hunks)
  • jenkins/L0_MergeRequest.groovy (3 hunks)
  • pyproject.toml (0 hunks)
  • tensorrt_llm/tools/layer_wise_benchmarks/deepseekv3_runner.py (4 hunks)
  • tensorrt_llm/tools/layer_wise_benchmarks/qwen3_next_runner.py (1 hunks)
  • tensorrt_llm/tools/layer_wise_benchmarks/runner_base.py (1 hunks)
  • tensorrt_llm/tools/layer_wise_benchmarks/runner_factory.py (1 hunks)
  • tensorrt_llm/tools/layer_wise_benchmarks/runner_utils.py (1 hunks)
  • tests/integration/test_lists/test-db/l0_b200.yml (1 hunks)
  • tests/unittest/tools/test_layer_wise_benchmarks.py (1 hunks)
💤 Files with no reviewable changes (4)
  • .pre-commit-config.yaml
  • examples/layer_wise_benchmarks/config_ctx.yaml
  • examples/layer_wise_benchmarks/config_gen.yaml
  • pyproject.toml
🧰 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:

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

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

  • tests/unittest/tools/test_layer_wise_benchmarks.py
  • tensorrt_llm/tools/layer_wise_benchmarks/qwen3_next_runner.py
  • tensorrt_llm/tools/layer_wise_benchmarks/runner_base.py
  • tensorrt_llm/tools/layer_wise_benchmarks/runner_factory.py
  • tensorrt_llm/tools/layer_wise_benchmarks/runner_utils.py
  • examples/layer_wise_benchmarks/run_single.py
  • tensorrt_llm/tools/layer_wise_benchmarks/deepseekv3_runner.py
🧠 Learnings (13)
📓 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.
📚 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/integration/test_lists/test-db/l0_b200.yml
  • jenkins/L0_MergeRequest.groovy
  • tests/unittest/tools/test_layer_wise_benchmarks.py
📚 Learning: 2025-09-17T02:48:52.732Z
Learnt from: tongyuantongyu
Repo: NVIDIA/TensorRT-LLM PR: 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_b200.yml
  • jenkins/L0_MergeRequest.groovy
📚 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/integration/test_lists/test-db/l0_b200.yml
  • jenkins/L0_MergeRequest.groovy
  • tests/unittest/tools/test_layer_wise_benchmarks.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/integration/test_lists/test-db/l0_b200.yml
  • examples/layer_wise_benchmarks/README.md
📚 Learning: 2025-08-06T13:58:07.506Z
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.

Applied to files:

  • jenkins/L0_MergeRequest.groovy
📚 Learning: 2025-08-01T15:14:45.673Z
Learnt from: yibinl-nvidia
Repo: NVIDIA/TensorRT-LLM PR: 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:

  • jenkins/L0_MergeRequest.groovy
📚 Learning: 2025-08-11T20:09:24.389Z
Learnt from: achartier
Repo: NVIDIA/TensorRT-LLM PR: 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:

  • jenkins/L0_MergeRequest.groovy
📚 Learning: 2025-08-20T07:43:36.447Z
Learnt from: ChristinaZ
Repo: NVIDIA/TensorRT-LLM PR: 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-29T15:14:28.503Z
Learnt from: amitz-nv
Repo: NVIDIA/TensorRT-LLM PR: 8063
File: tensorrt_llm/lora_manager.py:1080-1112
Timestamp: 2025-09-29T15:14:28.503Z
Learning: In tensorrt_llm/lora_manager.py, when calculating part_sizes for attn_qkv fused LoRA modules, the sizes are correctly multiplied by tp_size because model_config.num_heads and model_config.num_kv_heads are already divided by tp_size (per-TP-rank values), so multiplication is needed to get the original full concatenated dimension size. The interleave_fused_lora_weights_for_tp function provides proper validation.

Applied to files:

  • tests/unittest/tools/test_layer_wise_benchmarks.py
📚 Learning: 2025-09-29T15:14:28.503Z
Learnt from: amitz-nv
Repo: NVIDIA/TensorRT-LLM PR: 8063
File: tensorrt_llm/lora_manager.py:1080-1112
Timestamp: 2025-09-29T15:14:28.503Z
Learning: In tensorrt_llm/lora_manager.py, when calculating part_sizes for attn_qkv fused LoRA modules, the sizes are correctly multiplied by tp_size because model_config.num_heads and model_config.num_kv_heads are already divided by tp_size (per-TP-rank values), so multiplication is needed to get the original full concatenated dimension size. The interleave_fused_lora_weights_for_tp function provides proper validation with asserts for total size and TP divisibility.

Applied to files:

  • tests/unittest/tools/test_layer_wise_benchmarks.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:

  • tensorrt_llm/tools/layer_wise_benchmarks/deepseekv3_runner.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:

  • tensorrt_llm/tools/layer_wise_benchmarks/deepseekv3_runner.py
🧬 Code graph analysis (7)
tests/unittest/tools/test_layer_wise_benchmarks.py (2)
tests/integration/defs/conftest.py (2)
  • llm_root (192-193)
  • llm_models_root (80-94)
tests/integration/defs/trt_test_alternative.py (1)
  • check_call (250-258)
tensorrt_llm/tools/layer_wise_benchmarks/qwen3_next_runner.py (4)
tensorrt_llm/functional.py (1)
  • AllReduceStrategy (3876-3885)
tensorrt_llm/mapping.py (1)
  • Mapping (336-493)
tensorrt_llm/tools/layer_wise_benchmarks/runner_base.py (1)
  • RunnerBase (17-49)
tensorrt_llm/tools/layer_wise_benchmarks/runner_utils.py (4)
  • RunnerMixin (36-303)
  • has_mamba_metadata (39-40)
  • scaled_from_ctx (44-82)
  • apply_quant_config_exclude_modules (85-113)
tensorrt_llm/tools/layer_wise_benchmarks/runner_base.py (2)
tensorrt_llm/tools/layer_wise_benchmarks/runner_utils.py (4)
  • create_run_pack (115-187)
  • replace_routing_method (189-191)
  • create_kv_cache_manager (194-283)
  • create_mapping (286-303)
tensorrt_llm/tools/layer_wise_benchmarks/deepseekv3_runner.py (1)
  • replace_routing_method (211-219)
tensorrt_llm/tools/layer_wise_benchmarks/runner_factory.py (3)
tensorrt_llm/_torch/pyexecutor/config_utils.py (1)
  • load_pretrained_config (39-52)
tensorrt_llm/tools/layer_wise_benchmarks/deepseekv3_runner.py (1)
  • DeepSeekV3Runner (124-219)
tensorrt_llm/tools/layer_wise_benchmarks/qwen3_next_runner.py (1)
  • Qwen3NextRunner (15-90)
tensorrt_llm/tools/layer_wise_benchmarks/runner_utils.py (13)
tensorrt_llm/_torch/attention_backend/utils.py (1)
  • get_attention_backend (15-37)
tensorrt_llm/_torch/metadata.py (2)
  • KVCacheParams (9-31)
  • CacheType (34-40)
tensorrt_llm/_torch/modules/linear.py (2)
  • Linear (1877-2102)
  • WeightMode (35-41)
tensorrt_llm/_torch/modules/mamba/mamba2_metadata.py (1)
  • Mamba2Metadata (88-137)
tensorrt_llm/_torch/pyexecutor/_util.py (1)
  • get_kv_cache_manager_cls (47-55)
tensorrt_llm/_torch/pyexecutor/config_utils.py (2)
  • is_mla (12-16)
  • is_qwen3_next (19-23)
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/mapping.py (1)
  • Mapping (336-493)
tensorrt_llm/models/modeling_utils.py (2)
  • QuantConfig (131-271)
  • is_module_excluded_from_quantization (237-250)
tensorrt_llm/tools/layer_wise_benchmarks/runner_base.py (5)
  • BalanceMethod (10-14)
  • create_run_pack (19-28)
  • replace_routing_method (31-32)
  • create_kv_cache_manager (36-44)
  • create_mapping (48-49)
tensorrt_llm/tools/layer_wise_benchmarks/deepseekv3_runner.py (2)
  • has_mamba_metadata (126-127)
  • replace_routing_method (211-219)
tensorrt_llm/tools/layer_wise_benchmarks/qwen3_next_runner.py (1)
  • has_mamba_metadata (17-18)
examples/layer_wise_benchmarks/run_single.py (4)
tensorrt_llm/tools/layer_wise_benchmarks/runner_base.py (5)
  • BalanceMethod (10-14)
  • create_mapping (48-49)
  • create_kv_cache_manager (36-44)
  • create_run_pack (19-28)
  • replace_routing_method (31-32)
tensorrt_llm/tools/layer_wise_benchmarks/runner_factory.py (1)
  • get_runner_cls (7-13)
tensorrt_llm/tools/layer_wise_benchmarks/runner_utils.py (5)
  • create_mapping (286-303)
  • create_kv_cache_manager (194-283)
  • run_pack (179-185)
  • create_run_pack (115-187)
  • replace_routing_method (189-191)
tensorrt_llm/tools/layer_wise_benchmarks/deepseekv3_runner.py (1)
  • replace_routing_method (211-219)
tensorrt_llm/tools/layer_wise_benchmarks/deepseekv3_runner.py (3)
tensorrt_llm/_torch/models/modeling_deepseekv3.py (2)
  • DeepseekV3DecoderLayer (1004-1350)
  • DeepseekV3Gate (725-791)
tensorrt_llm/tools/layer_wise_benchmarks/runner_base.py (3)
  • BalanceMethod (10-14)
  • RunnerBase (17-49)
  • replace_routing_method (31-32)
tensorrt_llm/tools/layer_wise_benchmarks/runner_utils.py (6)
  • RunnerMixin (36-303)
  • ceil_div (28-29)
  • has_mamba_metadata (39-40)
  • scaled_from_ctx (44-82)
  • apply_quant_config_exclude_modules (85-113)
  • replace_routing_method (189-191)
🪛 LanguageTool
examples/layer_wise_benchmarks/README.md

[misspelling] ~101-~101: This word is normally spelled as one.
Context: ...`` ## Parse profiles Coming soon. ## Trouble shooting 1. Error `fp8 blockscale gemm only sup...

(EN_COMPOUNDS_TROUBLE_SHOOTING)

🪛 Ruff (0.14.4)
tests/unittest/tools/test_layer_wise_benchmarks.py

73-73: Redefinition of unused llm_root from line 6

(F811)


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

(S603)

tensorrt_llm/tools/layer_wise_benchmarks/qwen3_next_runner.py

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

Add explicit value for parameter strict=

(B905)


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

Replace zip() with itertools.pairwise()

(RUF007)

tensorrt_llm/tools/layer_wise_benchmarks/runner_utils.py

68-68: Unused function argument: cls

(ARG001)


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

(TRY003)


189-189: Unused method argument: balance_ratio

(ARG002)

examples/layer_wise_benchmarks/run_single.py

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

Add explicit value for parameter strict=

(B905)


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

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

Add explicit value for parameter strict=

(B905)


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

Replace zip() with itertools.pairwise()

(RUF007)

⏰ 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

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 force-pushed the layer_wise_benchmarks branch from 702cede to 10d7f19 Compare November 11, 2025 08:51
@yuantailing
Copy link
Member Author

/bot run --disable-fail-fast

@tensorrt-cicd
Copy link
Collaborator

PR_Github #24149 [ run ] triggered by Bot. Commit: 10d7f19

Signed-off-by: Tailing Yuan <yuantailing@gmail.com>
@yuantailing yuantailing requested a review from a team as a code owner November 11, 2025 09:39
@yuantailing yuantailing requested a review from galagam November 11, 2025 09:39
@tensorrt-cicd
Copy link
Collaborator

PR_Github #24149 [ run ] completed with state SUCCESS. Commit: 10d7f19
/LLM/main/L0_MergeRequest_PR pipeline #18207 completed with status: 'FAILURE'

@yuantailing
Copy link
Member Author

/bot run --disable-fail-fast

@tensorrt-cicd
Copy link
Collaborator

PR_Github #24202 [ run ] triggered by Bot. Commit: d058007

@tensorrt-cicd
Copy link
Collaborator

PR_Github #24202 [ run ] completed with state FAILURE. Commit: d058007

@yuantailing
Copy link
Member Author

/bot run --disable-fail-fast

@tensorrt-cicd
Copy link
Collaborator

PR_Github #24232 [ run ] triggered by Bot. Commit: 6766bc0

@yuantailing
Copy link
Member Author

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #24254 [ run ] triggered by Bot. Commit: 6766bc0

@tensorrt-cicd
Copy link
Collaborator

PR_Github #24232 [ run ] completed with state ABORTED. Commit: 6766bc0
LLM/main/L0_MergeRequest_PR #18278 (Blue Ocean) completed with status: ABORTED

@tensorrt-cicd
Copy link
Collaborator

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

@yuantailing yuantailing requested a review from a team as a code owner November 13, 2025 05:25
Signed-off-by: Tailing Yuan <yuantailing@gmail.com>
@yuantailing yuantailing requested review from chzblych and removed request for a team, Shixiaowei02, laikhtewari and ruodil November 13, 2025 05:48
@yuantailing
Copy link
Member Author

/bot run

@yuantailing yuantailing requested review from lucaslie and removed request for galagam November 13, 2025 05:58
@tensorrt-cicd
Copy link
Collaborator

PR_Github #24397 [ run ] triggered by Bot. Commit: 175a73f

@yuantailing
Copy link
Member Author

Hi @lucaslie , could you help review this PR?
In order to obey the rule of the new formatter (i.e., ruff), I moved from utils.cpp_paths import llm_root # noqa: F401 to conftest.py. That's why tests/unittest/_torch/auto_deploy/unit/singlegpu/test_ad_trtllm_bench.py is changed and it requires NVIDIA/trt-llm-torch-autodeploy-devs's review.

If not move the line to conftest.py, the formatter complains that

ruff.............................................................................Failed
- hook id: ruff
- exit code: 1

tests/unittest/tools/test_layer_wise_benchmarks.py:11:30: F811 Redefinition of unused `llm_root` from line 6
   |
10 | @pytest.mark.skipif(torch.cuda.device_count() < 4, reason="needs 4 GPUs to run this test")
11 | def test_deepseek_r1_ctx_tep(llm_root):
   |                              ^^^^^^^^ F811
12 |     model_root = llm_models_root(check=True)
13 |     check_call(
   |
   = help: Remove definition: `llm_root`

tests/unittest/tools/test_layer_wise_benchmarks.py:33:31: F811 Redefinition of unused `llm_root` from line 6
   |
32 | @pytest.mark.skipif(torch.cuda.device_count() < 4, reason="needs 4 GPUs to run this test")
33 | def test_deepseek_v32_ctx_dep(llm_root):
   |                               ^^^^^^^^ F811
34 |     model_root = llm_models_root(check=True)
35 |     check_call(
   |
   = help: Remove definition: `llm_root`

tests/unittest/tools/test_layer_wise_benchmarks.py:54:45: F811 Redefinition of unused `llm_root` from line 6
   |
53 | @pytest.mark.skipif(torch.cuda.device_count() < 4, reason="needs 4 GPUs to run this test")
54 | def test_deepseek_r1_gen_scaled_from_16_dep(llm_root):
   |                                             ^^^^^^^^ F811
55 |     model_root = llm_models_root(check=True)
56 |     check_call(
   |
   = help: Remove definition: `llm_root`

tests/unittest/tools/test_layer_wise_benchmarks.py:76:29: F811 Redefinition of unused `llm_root` from line 6
   |
75 | @pytest.mark.parametrize("tp_size", [1, 2, 4])
76 | def test_qwen3_next_gen_tep(llm_root, tp_size):
   |                             ^^^^^^^^ F811
77 |     if torch.cuda.device_count() < tp_size:
78 |         pytest.skip(f"needs {tp_size:d} GPUs to run this test")
   |
   = help: Remove definition: `llm_root`

Found 4 errors.

@tensorrt-cicd
Copy link
Collaborator

PR_Github #24397 [ run ] completed with state SUCCESS. Commit: 175a73f
/LLM/main/L0_MergeRequest_PR pipeline #18408 completed with status: 'FAILURE'

@yuantailing
Copy link
Member Author

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #24457 [ run ] triggered by Bot. Commit: 175a73f

@tensorrt-cicd
Copy link
Collaborator

PR_Github #24457 [ run ] completed with state SUCCESS. Commit: 175a73f
/LLM/main/L0_MergeRequest_PR pipeline #18454 completed with status: 'SUCCESS'

@yuantailing yuantailing merged commit cc4c980 into NVIDIA:main Nov 14, 2025
5 checks passed
zheyuf pushed a commit to zheyuf/TensorRT-LLM that referenced this pull request Nov 19, 2025
Signed-off-by: Tailing Yuan <yuantailing@gmail.com>
greg-kwasniewski1 pushed a commit to nv-auto-deploy/TensorRT-LLM that referenced this pull request Nov 20, 2025
Signed-off-by: Tailing Yuan <yuantailing@gmail.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.

4 participants