Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[https://nvbugs/5516710][fix] fix Llama 3.3 TP PP case#7717

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

@Superjomn
Copy link
Collaborator

@SuperjomnSuperjomn commentedSep 15, 2025
edited by coderabbitaibot
Loading

add test

Summary by CodeRabbit

  • Bug Fixes

    • Added guards around input scaling so scale is only read when present across attention and post-allreduce paths, preserving safe defaults in both fusion and non-fusion scenarios.
  • Tests

    • Added a multi-GPU Llama 3.3 (70B FP8) integration test (2x tensor, 2x pipeline) with output verification.
    • Included the new test in the DGX B200 L0 test suite.

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 FollowsTRT-LLM CODING GUIDELINES to the best of your knowledge.

  • Test cases are provided for new code paths (seetest 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.

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: DoesNOT update GitHub check status.

--stage-list "A10-PyTorch-1, xxx"(OPTIONAL) : Only run the specified test stages. Examples: "A10-PyTorch-1, xxx". Note: DoesNOT 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: DoesNOT 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: DoesNOT update GitHub pipeline status.

--only-multi-gpu-test(OPTIONAL) : Only run the multi-GPU tests. Note: DoesNOT update GitHub check status.

--disable-multi-gpu-test(OPTIONAL) : Disable the multi-GPU tests. Note: DoesNOT 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 thestage-list parameter to access the appropriate container environment. Note: DoesNOT update GitHub check status.

For guidance on mapping tests to stage names, seedocs/source/reference/ci-overview.md
and thescripts/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.

@SuperjomnSuperjomn requested a review froma team as acode ownerSeptember 15, 2025 07:52
@coderabbitai
Copy link
Contributor

coderabbitaibot commentedSep 15, 2025
edited
Loading

📝 Walkthrough

Walkthrough

Adds attribute-existence guards forinput_scale reads in Llama decoder fusion/all-reduce paths and adds a multi-GPU integration test entry and test file for Llama‑3.3. No public API changes.

Changes

Cohort / File(s)Summary
Model: Llama decoder guards
tensorrt_llm/_torch/models/modeling_llama.py
Addshasattr guards around reads ofself.next_attn.qkv_proj.input_scale in two post-fusion code paths; when missing, sets fusion op toRESIDUAL_RMS_NORM andscale = None.
Model: Min-latency variant guards
tensorrt_llm/_torch/models/modeling_llama_min_latency.py
Addshasattr guards fornext_attn.qkv_proj.input_scale in two post-attention all-reduce paths (FP8 and NVFP4); uses the attribute if present, otherwise passesNone forscale.
Tests: integration list update
tests/integration/test_lists/test-db/l0_dgx_b200.yml
Inserts a new test path (unittest/_torch/multi_gpu_modeling/test_llama3.py::test_llama_3_3) into the L0 DGX B200 tests list.
Tests: new multi-GPU integration test
tests/unittest/_torch/multi_gpu_modeling/test_llama3.py
Addstest_llama_3_3() which initializes an LLM with tensor/pipeline parallel size 2, runs generation on two prompts, and asserts outputs start with expected prefixes using existing test utilities.

Sequence Diagram(s)

A high-level flow for the new guarded read (applies to both files/models):

sequenceDiagram    autonumber    participant Layer as DecoderLayer    participant QKV as next_attn.qkv_proj    participant FusionOp as FusionOpConfig    rect rgba(200,220,255,0.25)    Layer->>QKV: check hasattr(input_scale)?    alt input_scale exists        QKV-->>Layer: return input_scale        Layer->>FusionOp: set fusion op (existing path) with scale    else missing        QKV-->>Layer: attribute missing        Layer->>FusionOp: set fusion op = RESIDUAL_RMS_NORM\nand scale = None    end    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check nameStatusExplanationResolution
Description Check⚠️ WarningThe PR description contains only "add test" and leaves the repository's required template sections (Description, Test Coverage) unfilled, so it does not explain the bug, the implemented fix, affected files, reproduction steps, or how the new test should be run. This lack of detail is insufficient for reviewers—especially given the Release Blocker label—and prevents proper risk assessment and CI verification. Therefore the description check fails.Please update the PR description to follow the template: provide a concise explanation of the bug and the implemented fix, list changed files and behavioral impact, include steps or commands to reproduce the issue and run the new test(s), reference the NVBugs ID and relevant CI logs or commits, and state which tests cover the change and any special runtime requirements (e.g., multi‑GPU configuration).
Docstring Coverage⚠️ WarningDocstring 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 nameStatusExplanation
Title Check✅ PassedThe title "[https://nvbugs/5516710][fix] fix Llama 3.3 TP PP case" follows the repository template, includes the NVBugs ID and [fix] type, and succinctly identifies the primary intent (a fix for Llama 3.3 tensor-parallel/pipeline-parallel behavior). It maps to the changes in the diff (input_scale guards and an added multi‑GPU test) and is clear for reviewers scanning history.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between63e9c6b and07ac2c0.

📒 Files selected for processing (4)
  • tensorrt_llm/_torch/models/modeling_llama.py (2 hunks)
  • tensorrt_llm/_torch/models/modeling_llama_min_latency.py (2 hunks)
  • tests/integration/test_lists/test-db/l0_dgx_b200.yml (1 hunks)
  • tests/unittest/_torch/multi_gpu_modeling/test_llama3.py (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
  • tensorrt_llm/_torch/models/modeling_llama_min_latency.py
  • tests/integration/test_lists/test-db/l0_dgx_b200.yml
  • tensorrt_llm/_torch/models/modeling_llama.py
  • tests/unittest/_torch/multi_gpu_modeling/test_llama3.py
⏰ 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

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

@coderabbitaicoderabbitaibot 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

Caution

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

⚠️ Outside diff range comments (2)
tensorrt_llm/_torch/models/modeling_llama_min_latency.py (1)

1-1:Add the NVIDIA Apache‑2.0 header.

Source files must start with the NVIDIA Apache‑2.0 copyright header for 2025.

tensorrt_llm/_torch/models/modeling_llama.py (1)

1-1:Add the NVIDIA Apache‑2.0 header.

This source file should also carry the standard 2025 NVIDIA Apache‑2.0 header.

🧹 Nitpick comments (1)
tests/unittest/_torch/multi_gpu_modeling/test_llama3.py (1)

7-26:Gate and bound the integration test for portability and runtime.

Skip when insufficient GPUs and cap generation length to reduce CI time; similarity check should still hold.

+import pytest+import torch@@-def test_llama_3_3():+@pytest.mark.skipif(torch.cuda.device_count() < 4, reason="requires >=4 GPUs")+def test_llama_3_3():@@-    outputs = llm.generate(prompts)+    outputs = llm.generate(prompts, max_new_tokens=16)
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between9d719dd and582de7c.

📒 Files selected for processing (4)
  • tensorrt_llm/_torch/models/modeling_llama.py (2 hunks)
  • tensorrt_llm/_torch/models/modeling_llama_min_latency.py (2 hunks)
  • tests/integration/test_lists/test-db/l0_dgx_b200.yml (1 hunks)
  • tests/unittest/_torch/multi_gpu_modeling/test_llama3.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:

  • tensorrt_llm/_torch/models/modeling_llama_min_latency.py
  • tensorrt_llm/_torch/models/modeling_llama.py
  • tests/unittest/_torch/multi_gpu_modeling/test_llama3.py
**/*.py

📄 CodeRabbit inference engine (CODING_GUIDELINES.md)

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

Files:

  • tensorrt_llm/_torch/models/modeling_llama_min_latency.py
  • tensorrt_llm/_torch/models/modeling_llama.py
  • tests/unittest/_torch/multi_gpu_modeling/test_llama3.py
**/*.{cpp,cxx,cc,h,hpp,hh,hxx,cu,cuh,py}

📄 CodeRabbit inference engine (CODING_GUIDELINES.md)

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

Files:

  • tensorrt_llm/_torch/models/modeling_llama_min_latency.py
  • tensorrt_llm/_torch/models/modeling_llama.py
  • tests/unittest/_torch/multi_gpu_modeling/test_llama3.py
🧠 Learnings (4)
📚 Learning: 2025-09-09T09:40:45.658Z
Learnt from: fredricz-20070104PR: NVIDIA/TensorRT-LLM#7645File: tests/integration/test_lists/qa/llm_function_core.txt:648-648Timestamp: 2025-09-09T09:40:45.658ZLearning: 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/_torch/multi_gpu_modeling/test_llama3.py
📚 Learning: 2025-07-28T17:06:08.621Z
Learnt from: moraxuPR: NVIDIA/TensorRT-LLM#6303File: tests/integration/test_lists/qa/examples_test_list.txt:494-494Timestamp: 2025-07-28T17:06:08.621ZLearning: 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_dgx_b200.yml
  • tests/unittest/_torch/multi_gpu_modeling/test_llama3.py
📚 Learning: 2025-08-26T09:49:04.956Z
Learnt from: pengbowang-nvPR: NVIDIA/TensorRT-LLM#7192File: tests/integration/test_lists/test-db/l0_dgx_b200.yml:56-72Timestamp: 2025-08-26T09:49:04.956ZLearning: 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/_torch/multi_gpu_modeling/test_llama3.py
📚 Learning: 2025-08-06T13:58:07.506Z
Learnt from: galagamPR: NVIDIA/TensorRT-LLM#6487File: tests/unittest/_torch/auto_deploy/unit/singlegpu/test_ad_trtllm_bench.py:1-12Timestamp: 2025-08-06T13:58:07.506ZLearning: 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/_torch/multi_gpu_modeling/test_llama3.py
⏰ 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)
tests/integration/test_lists/test-db/l0_dgx_b200.yml (1)

18-18:LGTM: add Llama‑3.3 multi‑GPU test to B200 list.

Placement and format look correct. Scheduler de‑dupes across wildcarded lists as expected per infra behavior.

tensorrt_llm/_torch/models/modeling_llama.py (2)

561-568:Good defensive downgrade when next layer lacks input_scale.

Guarding input_scale and falling back to RESIDUAL_RMS_NORM prevents attribute errors and avoids invoking quantized fusion without a scale.


771-778:Same here: solid guard and fallback.

Consistent with the earlier block; this avoids QUANT op misuse when the next attention’s qkv_proj lacks input_scale.

@Superjomn
Copy link
CollaboratorAuthor

/bot run

Copy link
Contributor

@coderabbitaicoderabbitaibot 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

Caution

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

⚠️ Outside diff range comments (1)
tensorrt_llm/_torch/models/modeling_llama.py (1)

561-567:Avoid mutating fusion-op state inside forward; compute a local op instead

Overwritingself.post_feed_forward_fusion_op at runtime makes the downgrade “sticky” for the layer and can silently affect later passes/configs. Use a localfusion_op derived from availability ofinput_scale, and keep the member immutable after init.

Apply this diff:

-                # The next layernorm exists but it could be the last decoder layer.-                # Adjust the scale and fusion pattern.-                if self.next_attn is not None and (-                        self.is_nvfp4 or self.is_fp8_quant) and hasattr(-                            self.next_attn.qkv_proj, 'input_scale'):-                    scale = self.next_attn.qkv_proj.input_scale-                else:-                    self.post_feed_forward_fusion_op = AllReduceFusionOp.RESIDUAL_RMS_NORM-                    scale = None+                # The next layernorm exists but it could be the last decoder layer.+                # Adjust the scale and fusion pattern without mutating layer state.+                fusion_op = self.post_feed_forward_fusion_op+                scale = None+                if self.next_attn is not None and (self.is_nvfp4 or self.is_fp8_quant):+                    next_proj = getattr(self.next_attn, "qkv_proj", None)+                    scale = getattr(next_proj, "input_scale", None)+                    if scale is None:+                        fusion_op = AllReduceFusionOp.RESIDUAL_RMS_NORM@@-                    allreduce_output = self.all_reduce(+                    allreduce_output = self.all_reduce(                         hidden_states,                         all_reduce_params=AllReduceParams(-                            fusion_op=self.post_feed_forward_fusion_op,+                            fusion_op=fusion_op,                             residual=residual,                             norm_weight=self.next_layer_layernorm.weight,                             scale=scale,                             eps=self.next_layer_layernorm.variance_epsilon,                         ))

Also considers cases whereqkv_proj itself may be absent in dummy next-attn modules.

Also applies to: 588-595

♻️ Duplicate comments (1)
tensorrt_llm/_torch/models/modeling_llama.py (1)

771-777:Same state-mutation issue on the Llama (non‑4) path

Replicate the fix here to keeppost_mlp_fusion_op immutable during forward.

Apply this diff:

-                # The next layernorm exists but it could be the last decoder layer.-                # Adjust the scale and fusion pattern.-                if self.next_attn is not None and (-                        self.is_nvfp4 or self.is_fp8_quant) and hasattr(-                            self.next_attn.qkv_proj, 'input_scale'):-                    scale = self.next_attn.qkv_proj.input_scale-                else:-                    self.post_mlp_fusion_op = AllReduceFusionOp.RESIDUAL_RMS_NORM-                    scale = None+                # The next layernorm exists but it could be the last decoder layer.+                # Adjust the scale and fusion pattern without mutating layer state.+                fusion_op = self.post_mlp_fusion_op+                scale = None+                if self.next_attn is not None and (self.is_nvfp4 or self.is_fp8_quant):+                    next_proj = getattr(self.next_attn, "qkv_proj", None)+                    scale = getattr(next_proj, "input_scale", None)+                    if scale is None:+                        fusion_op = AllReduceFusionOp.RESIDUAL_RMS_NORM@@-                all_reduce_output = self.all_reduce(+                all_reduce_output = self.all_reduce(                     hidden_states,                     all_reduce_params=AllReduceParams(-                        fusion_op=self.post_mlp_fusion_op,+                        fusion_op=fusion_op,                         residual=residual,                         norm_weight=self.next_layer_layernorm.weight,                         scale=scale,                         eps=self.next_layer_layernorm.variance_epsilon,                     ))

Also applies to: 779-787

🧹 Nitpick comments (1)
tensorrt_llm/_torch/models/modeling_llama.py (1)

1-1:License header missing (pre‑existing)

Per repo guidelines, prepend the NVIDIA Apache‑2.0 header with the current year. Not blocking this PR; consider a follow‑up sweep.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between582de7c andb3973a0.

📒 Files selected for processing (4)
  • tensorrt_llm/_torch/models/modeling_llama.py (2 hunks)
  • tensorrt_llm/_torch/models/modeling_llama_min_latency.py (2 hunks)
  • tests/integration/test_lists/test-db/l0_dgx_b200.yml (1 hunks)
  • tests/unittest/_torch/multi_gpu_modeling/test_llama3.py (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • tensorrt_llm/_torch/models/modeling_llama_min_latency.py
  • tests/unittest/_torch/multi_gpu_modeling/test_llama3.py
🧰 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:

  • tensorrt_llm/_torch/models/modeling_llama.py
**/*.py

📄 CodeRabbit inference engine (CODING_GUIDELINES.md)

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

Files:

  • tensorrt_llm/_torch/models/modeling_llama.py
**/*.{cpp,cxx,cc,h,hpp,hh,hxx,cu,cuh,py}

📄 CodeRabbit inference engine (CODING_GUIDELINES.md)

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

Files:

  • tensorrt_llm/_torch/models/modeling_llama.py
🧠 Learnings (3)
📚 Learning: 2025-07-28T17:06:08.621Z
Learnt from: moraxuPR: NVIDIA/TensorRT-LLM#6303File: tests/integration/test_lists/qa/examples_test_list.txt:494-494Timestamp: 2025-07-28T17:06:08.621ZLearning: 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_dgx_b200.yml
📚 Learning: 2025-09-09T09:40:45.658Z
Learnt from: fredricz-20070104PR: NVIDIA/TensorRT-LLM#7645File: tests/integration/test_lists/qa/llm_function_core.txt:648-648Timestamp: 2025-09-09T09:40:45.658ZLearning: 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
📚 Learning: 2025-08-26T09:49:04.956Z
Learnt from: pengbowang-nvPR: NVIDIA/TensorRT-LLM#7192File: tests/integration/test_lists/test-db/l0_dgx_b200.yml:56-72Timestamp: 2025-08-26T09:49:04.956ZLearning: 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
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Pre-commit Check
🔇 Additional comments (1)
tests/integration/test_lists/test-db/l0_dgx_b200.yml (1)

18-18:LGTM: adds focused Llama‑3.3 multi‑GPU unittest to the B200 pool

Placement and node-id format are consistent with existing entries; should run on 4xGPU TP2+PP2 as intended. Please confirm the model asset path is available on B200 CI workers to avoid skips.

Copy link
Collaborator

@hyuknhyukn left a comment

Choose a reason for hiding this comment

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

LGTM.

@Superjomn
Copy link
CollaboratorAuthor

/bot run

@SuperjomnSuperjomnenabled auto-merge (squash)September 16, 2025 11:54
@SuperjomnSuperjomn added the Release BlockerPRs that blocking the final release build or branching out the release branch labelSep 16, 2025
@tensorrt-cicd
Copy link
Collaborator

PR_Github #18791 [ run ] triggered by Bot

Copy link
Contributor

@coderabbitaicoderabbitaibot 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: 2

♻️ Duplicate comments (1)
tests/unittest/_torch/multi_gpu_modeling/test_llama3.py (1)

7-7:On combining with existing LLM API tests

Echoing the earlier thread: consolidating withtest_llm_api_pytorch’s Llama‑3.3 suite is fine to do in a follow‑up, as agreed.

If you want to confirm current coverage overlap quickly:

#!/bin/bash# Find any existing Llama-3.3 tests in PyTorch API suitesrg -nP'Llama[-_ ]?3\.3|Llama3_3' -g'tests/**/test_llm_api_pytorch*.py' -C2
🧹 Nitpick comments (2)
tests/unittest/_torch/multi_gpu_modeling/test_llama3.py (2)

15-17:Prompt choice risk: reduce time‑sensitive/non‑deterministic content

“The president of the United States is” can drift. Consider more stable prompts (math/facts) or keep but rely on robust assertions below.


19-26:Determinism and robustness: constrain decoding and assert on signals, not long text

Constrain decoding for reproducibility and speed; prefer short, robust assertions over fuzzy long‑text similarity.

Apply this diff:

-    outputs = llm.generate(prompts)+    outputs = llm.generate(+        prompts,+        max_new_tokens=24,+        temperature=0.0,+        top_k=1,+        random_seed=1234,+    )-    expected_outputs = [-        " a city of romance, art, fashion, and cuisine. Paris, also known as the City of Light, is a must-visit destination for anyone interested in",-        " the head of state and head of government of the United States. The president is also the commander-in-chief of the armed forces. The president is elected by the",-    ]-    for i, output in enumerate(outputs):-        assert similar(output.outputs[0].text, expected_outputs[i])+    for i, res in enumerate(outputs):+        text = res.outputs[0].text.lower()+        if i == 0:+            assert "paris" in text+        else:+            assert "president" in text and "united states" in text

Additionally, if you adopt the above, drop the now-unusedsimilar import.

-from utils.util import similar
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and betweenb3973a0 and2a48811.

📒 Files selected for processing (4)
  • tensorrt_llm/_torch/models/modeling_llama.py (2 hunks)
  • tensorrt_llm/_torch/models/modeling_llama_min_latency.py (2 hunks)
  • tests/integration/test_lists/test-db/l0_dgx_b200.yml (1 hunks)
  • tests/unittest/_torch/multi_gpu_modeling/test_llama3.py (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • tensorrt_llm/_torch/models/modeling_llama_min_latency.py
  • tests/integration/test_lists/test-db/l0_dgx_b200.yml
  • tensorrt_llm/_torch/models/modeling_llama.py
🧰 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/_torch/multi_gpu_modeling/test_llama3.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/_torch/multi_gpu_modeling/test_llama3.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/_torch/multi_gpu_modeling/test_llama3.py
🧠 Learnings (3)
📚 Learning: 2025-07-28T17:06:08.621Z
Learnt from: moraxuPR: NVIDIA/TensorRT-LLM#6303File: tests/integration/test_lists/qa/examples_test_list.txt:494-494Timestamp: 2025-07-28T17:06:08.621ZLearning: In TensorRT-LLM testing, it's common to have both CLI flow tests (test_cli_flow.py) and PyTorch API tests (test_llm_api_pytorch.py) for the same model. These serve different purposes: CLI flow tests validate the traditional command-line workflow, while PyTorch API tests validate the newer LLM API backend. Both are legitimate and should coexist.

Applied to files:

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

Applied to files:

  • tests/unittest/_torch/multi_gpu_modeling/test_llama3.py
📚 Learning: 2025-08-06T13:58:07.506Z
Learnt from: galagamPR: NVIDIA/TensorRT-LLM#6487File: tests/unittest/_torch/auto_deploy/unit/singlegpu/test_ad_trtllm_bench.py:1-12Timestamp: 2025-08-06T13:58:07.506ZLearning: 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/_torch/multi_gpu_modeling/test_llama3.py
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Pre-commit Check
🔇 Additional comments (1)
tests/unittest/_torch/multi_gpu_modeling/test_llama3.py (1)

1-26:No action required — test is scheduled only on DGX B200
rg search shows the test only in tests/integration/test_lists/test-db/l0_dgx_b200.yml:18.

@tensorrt-cicd
Copy link
Collaborator

PR_Github #18791 [ run ] completed with stateSUCCESS
/LLM/release-1.0/L0_MergeRequest_PR pipeline #398 completed with status: 'FAILURE'

@Superjomn
Copy link
CollaboratorAuthor

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #18829 [ run ] triggered by Bot

@tensorrt-cicd
Copy link
Collaborator

PR_Github #18829 [ run ] completed with stateSUCCESS
/LLM/release-1.0/L0_MergeRequest_PR pipeline #400 completed with status: 'FAILURE'

@Superjomn
Copy link
CollaboratorAuthor

/bot run --disable-fail-fast

@tensorrt-cicd
Copy link
Collaborator

PR_Github #18844 [ run ] triggered by Bot

@tensorrt-cicd
Copy link
Collaborator

PR_Github #18844 [ run ] completed with stateSUCCESS
/LLM/release-1.0/L0_MergeRequest_PR pipeline #402 completed with status: 'FAILURE'

@Superjomn
Copy link
CollaboratorAuthor

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #18889 [ run ] triggered by Bot

@tensorrt-cicd
Copy link
Collaborator

PR_Github #18889 [ run ] completed with stateFAILURE
/LLM/release-1.0/L0_MergeRequest_PR pipeline #404 completed with status: 'FAILURE'

@Superjomn
Copy link
CollaboratorAuthor

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #18896 [ run ] triggered by Bot

Copy link
Contributor

@coderabbitaicoderabbitaibot 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

Caution

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

⚠️ Outside diff range comments (2)
tensorrt_llm/_torch/models/modeling_llama.py (2)

1-1:Add NVIDIA Apache-2.0 header (2025).

This source file is missing the required license header per 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.

561-568:Downgrade fusion op when input_scale is absent to avoid QUANT op with None scale.

Currently, if next_attn.qkv_proj lacks input_scale, scale becomes None while the fusion op may remain QUANT_* — risky/incorrect.

-                if self.next_attn is not None and (self.is_nvfp4-                                                   or self.is_fp8_quant):-                    scale = self.next_attn.qkv_proj.input_scale if hasattr(-                        self.next_attn.qkv_proj, 'input_scale') else None+                if self.next_attn is not None and (self.is_nvfp4+                                                   or self.is_fp8_quant):+                    if hasattr(self.next_attn.qkv_proj, 'input_scale'):+                        scale = self.next_attn.qkv_proj.input_scale+                    else:+                        # No per-layer input scale available for the next QKV (e.g., dummy Linear under TP+PP last PP stage)+                        self.post_feed_forward_fusion_op = AllReduceFusionOp.RESIDUAL_RMS_NORM+                        scale = None                 else:                     self.post_feed_forward_fusion_op = AllReduceFusionOp.RESIDUAL_RMS_NORM                     scale = None
♻️ Duplicate comments (3)
tests/unittest/_torch/multi_gpu_modeling/test_llama3.py (3)

1-5:Lazy-load TRT‑LLM; add pytest/torch; avoid heavy top‑level import.

Prevents collection-time failures and aligns with import style guidance. (Previously raised.)

-from utils.llm_data import llm_models_root-from utils.util import similar--from tensorrt_llm import LLM+import pytest+import torch+from utils.llm_data import llm_models_root

7-14:Guard for TRT‑LLM availability, GPUs, and model dir; then import and build.

Skip cleanly if environment cannot satisfy TP=2, PP=2 (needs 4 GPUs). (Previously raised.)

 def test_llama_3_3():     model_dir = llm_models_root(     ) / "llama-3.3-models" / "Llama-3.3-70B-Instruct-FP8"     tp = 2     pp = 2-    llm = LLM(model_dir, tensor_parallel_size=tp, pipeline_parallel_size=pp)+    try:+        import tensorrt_llm as trtllm+    except Exception as e:+        pytest.skip(f"tensorrt-llm unavailable: {e}")+    required = tp * pp+    if not torch.cuda.is_available() or torch.cuda.device_count() < required:+        found = torch.cuda.device_count() if torch.cuda.is_available() else 0+        pytest.skip(f"requires >= {required} GPUs; found {found}")+    if not model_dir.exists():+        pytest.skip(f"model dir not found: {model_dir}")++    llm = trtllm.LLM(+        model_dir,+        tensor_parallel_size=tp,+        pipeline_parallel_size=pp,+    )

1-26:Move TRT-LLM import into the test and add GPU/model checks.

Top-levelfrom tensorrt_llm import LLM found at tests/unittest/_torch/multi_gpu_modeling/test_llama3.py:4; no torch.cuda/pytest skip or model_dir.exists() check. Change required:

  • Move the tensorrt_llm import into test_llama_3_3() (lazy import) so collection doesn't trigger heavy runtime.
  • At the start of the test, perform runtime guards and skip when unmet (e.g., compute required_gpus = tp * pp; if not torch.cuda.is_available() or torch.cuda.device_count() < required_gpus: pytest.skip(...); if not model_dir.exists(): pytest.skip(...)).
🧹 Nitpick comments (3)
tensorrt_llm/_torch/models/modeling_llama.py (1)

561-565:Add brief inline context for hasattr guard.

Note that next_attn.qkv_proj can be a dummy Linear (skip_forward) on last PP rank so FP8QDQ monkey-patch doesn’t attach input_scale.

tests/unittest/_torch/multi_gpu_modeling/test_llama3.py (2)

21-26:Deflake assertions: avoid content that shifts over time; assert non‑empty outputs.

Use stable checks to reduce CI flakes in release pipeline.

-    expected_outputs = [-        " a city of romance, art, fashion, and cuisine. Paris, also known as the City of Light, is a must-visit destination for anyone interested in",-        " the head of state and head of government of the United States. The president is also the commander-in-chief of the armed forces. The president is elected by the",-    ]-    for i, output in enumerate(outputs):-        assert similar(output.outputs[0].text, expected_outputs[i])+    assert len(outputs) == len(prompts)+    for out in outputs:+        text = out.outputs[0].text+        assert isinstance(text, str) and len(text) > 0

7-26:Optional: keep a minimal, deterministic check.

If you prefer a content check, change the second prompt to a stable fact (e.g., math) and assert a short prefix.

-    prompts = [-        "The capital of France is",-        "The president of the United States is",-    ]+    prompts = [+        "The capital of France is",+        "The square root of 144 is",+    ]@@-    outputs = llm.generate(prompts)+    outputs = llm.generate(prompts)@@-    expected_outputs = [-        " a city of romance, art, fashion, and cuisine. Paris, also known as the City of Light, is a must-visit destination for anyone interested in",-        " the head of state and head of government of the United States. The president is also the commander-in-chief of the armed forces. The president is elected by the",-    ]-    for i, output in enumerate(outputs):-        assert similar(output.outputs[0].text, expected_outputs[i])+    assert outputs[0].outputs[0].text.lstrip().startswith("Paris")+    assert outputs[1].outputs[0].text.strip().startswith("12")
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between2a48811 and8ee015a.

📒 Files selected for processing (4)
  • tensorrt_llm/_torch/models/modeling_llama.py (2 hunks)
  • tensorrt_llm/_torch/models/modeling_llama_min_latency.py (2 hunks)
  • tests/integration/test_lists/test-db/l0_dgx_b200.yml (1 hunks)
  • tests/unittest/_torch/multi_gpu_modeling/test_llama3.py (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • tensorrt_llm/_torch/models/modeling_llama_min_latency.py
  • tests/integration/test_lists/test-db/l0_dgx_b200.yml
🧰 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:

  • tensorrt_llm/_torch/models/modeling_llama.py
  • tests/unittest/_torch/multi_gpu_modeling/test_llama3.py
**/*.py

📄 CodeRabbit inference engine (CODING_GUIDELINES.md)

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

Files:

  • tensorrt_llm/_torch/models/modeling_llama.py
  • tests/unittest/_torch/multi_gpu_modeling/test_llama3.py
**/*.{cpp,cxx,cc,h,hpp,hh,hxx,cu,cuh,py}

📄 CodeRabbit inference engine (CODING_GUIDELINES.md)

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

Files:

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

Applied to files:

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

Applied to files:

  • tests/unittest/_torch/multi_gpu_modeling/test_llama3.py
📚 Learning: 2025-08-06T13:58:07.506Z
Learnt from: galagamPR: NVIDIA/TensorRT-LLM#6487File: tests/unittest/_torch/auto_deploy/unit/singlegpu/test_ad_trtllm_bench.py:1-12Timestamp: 2025-08-06T13:58:07.506ZLearning: 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/_torch/multi_gpu_modeling/test_llama3.py
📚 Learning: 2025-08-29T14:07:45.863Z
Learnt from: EmmaQiaoChPR: NVIDIA/TensorRT-LLM#7370File: tests/unittest/trt/model_api/test_model_quantization.py:24-27Timestamp: 2025-08-29T14:07:45.863ZLearning: 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/_torch/multi_gpu_modeling/test_llama3.py
📚 Learning: 2025-08-26T09:49:04.956Z
Learnt from: pengbowang-nvPR: NVIDIA/TensorRT-LLM#7192File: tests/integration/test_lists/test-db/l0_dgx_b200.yml:56-72Timestamp: 2025-08-26T09:49:04.956ZLearning: In TensorRT-LLM test configuration files, the test scheduling system handles wildcard matching with special rules that prevent duplicate test execution even when the same tests appear in multiple yaml files with overlapping GPU wildcards (e.g., "*b200*" and "*gb200*").

Applied to files:

  • tests/unittest/_torch/multi_gpu_modeling/test_llama3.py
📚 Learning: 2025-08-11T20:09:24.389Z
Learnt from: achartierPR: NVIDIA/TensorRT-LLM#6763File: tests/integration/defs/triton_server/conftest.py:16-22Timestamp: 2025-08-11T20:09:24.389ZLearning: 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/_torch/multi_gpu_modeling/test_llama3.py
⏰ 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

@Superjomn
Copy link
CollaboratorAuthor

/bot run --stage-list "DGX_H100-4_GPUs-PyTorch-DeepSeek-2"

@Superjomn
Copy link
CollaboratorAuthor

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #18942 [ run ] triggered by Bot

@Superjomn
Copy link
CollaboratorAuthor

/bot run --stage-list "DGX_H100-4_GPUs-PyTorch-DeepSeek-2,GB200-4_GPUs-PyTorch-1"

@tensorrt-cicd
Copy link
Collaborator

PR_Github #18948 [ run ] triggered by Bot

@tensorrt-cicd
Copy link
Collaborator

PR_Github #18942 [ run ] completed with stateABORTED
LLM/release-1.0/L0_MergeRequest_PR #409(Blue Ocean) completed with status: ABORTED

Copy link
Contributor

@coderabbitaicoderabbitaibot 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

♻️ Duplicate comments (3)
tests/unittest/_torch/multi_gpu_modeling/test_llama3.py (3)

7-7:Follow‑up: potential consolidation with test_llm_api_pytorch

Per hyukn’s note, consider merging/parametrizing with TestLlama3_3_70BInstruct later. Fine to defer to a subsequent PR.


1-5:Lazy‑load TRT‑LLM; add pytest/torch; avoid top‑level heavy import

Importing LLM at module import time can explode before we can skip; also prefer module‑namespace import. Move TRT‑LLM import inside the test and add pytest/torch imports here.

-from utils.llm_data import llm_models_root-from utils.util import similar--from tensorrt_llm import LLM+import pytest+import torch+from utils.llm_data import llm_models_root+from utils.util import similar

7-13:Guard for TRT‑LLM availability, GPUs, and model dir; use module namespace

Skip cleanly when deps/resources are missing; import tensorrt_llm lazily; and use trtllm.LLM.

 def test_llama_3_3():     model_dir = llm_models_root(     ) / "llama-3.3-models" / "Llama-3.3-70B-Instruct-FP8"     tp = 2     pp = 2-    llm = LLM(model_dir, tensor_parallel_size=tp, pipeline_parallel_size=pp)+    # Lazy import so we can skip instead of erroring during collection+    try:+        import tensorrt_llm as trtllm+    except Exception as e:+        pytest.skip(f"tensorrt-llm unavailable: {e}")++    required = tp * pp+    if not torch.cuda.is_available() or torch.cuda.device_count() < required:+        found = torch.cuda.device_count() if torch.cuda.is_available() else 0+        pytest.skip(f"requires >= {required} GPUs; found {found}")+    if not model_dir.exists():+        pytest.skip(f"model dir not found: {model_dir}")++    llm = trtllm.LLM(model_dir, tensor_parallel_size=tp, pipeline_parallel_size=pp)
🧹 Nitpick comments (4)
tests/unittest/_torch/multi_gpu_modeling/test_llama3.py (4)

14-17:Use time‑insensitive prompts to avoid fragile assertions

“The president of the United States is” is time‑variant. Prefer stable facts.

-    prompts = [-        "The capital of France is",-        "The president of the United States is",-    ]+    prompts = [+        "The capital of France is",+        "The capital of Japan is",+    ]

19-19:Make decoding deterministic and cheaper

Set a small max token budget and disable sampling (or temperature=0) to stabilize CI and reduce memory.

-    outputs = llm.generate(prompts)+    # If API differs, use the repo's SamplingParams equivalent with temperature=0 and max_new_tokens≈16+    outputs = llm.generate(prompts, max_new_tokens=16, temperature=0.0)

If generate() doesn’t accept these kwargs, switch to your SamplingParams/GenerationConfig and pass it in. Please confirm the exact parameter names used in this repo.


21-26:Avoid brittle full‑text matches; assert key facts with diagnostics

Long expected blobs are unstable across model/builds. Check for essential substrings and add a length check plus helpful failure messages.

-    expected_outputs = [-        " a city of romance, art, fashion, and cuisine. Paris, also known as the City of Light, is a must-visit destination for anyone interested in",-        " the head of state and head of government of the United States. The president is also the commander-in-chief of the armed forces. The president is elected by the",-    ]-    for i, output in enumerate(outputs):-        assert similar(output.outputs[0].text, expected_outputs[i])+    expected_contains = ["Paris", "Tokyo"]+    assert len(outputs) == len(prompts)+    for i, out in enumerate(outputs):+        text = out.outputs[0].text+        assert expected_contains[i].lower() in text.lower(), (+            f"Output[{i}] missing '{expected_contains[i]}'. Got: {text[:160]!r}"+        )

26-26:Release resources explicitly (optional)

Free the session aggressively to reduce GPU memory pressure on CI runners.

-        assert similar(output.outputs[0].text, expected_outputs[i])+        ...+    # Optional explicit cleanup+    del llm
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between8ee015a and63e9c6b.

📒 Files selected for processing (4)
  • tensorrt_llm/_torch/models/modeling_llama.py (2 hunks)
  • tensorrt_llm/_torch/models/modeling_llama_min_latency.py (2 hunks)
  • tests/integration/test_lists/test-db/l0_dgx_b200.yml (1 hunks)
  • tests/unittest/_torch/multi_gpu_modeling/test_llama3.py (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • tests/integration/test_lists/test-db/l0_dgx_b200.yml
  • tensorrt_llm/_torch/models/modeling_llama.py
  • tensorrt_llm/_torch/models/modeling_llama_min_latency.py
🧰 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/_torch/multi_gpu_modeling/test_llama3.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/_torch/multi_gpu_modeling/test_llama3.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/_torch/multi_gpu_modeling/test_llama3.py
🧠 Learnings (6)
📚 Learning: 2025-07-28T17:06:08.621Z
Learnt from: moraxuPR: NVIDIA/TensorRT-LLM#6303File: tests/integration/test_lists/qa/examples_test_list.txt:494-494Timestamp: 2025-07-28T17:06:08.621ZLearning: In TensorRT-LLM testing, it's common to have both CLI flow tests (test_cli_flow.py) and PyTorch API tests (test_llm_api_pytorch.py) for the same model. These serve different purposes: CLI flow tests validate the traditional command-line workflow, while PyTorch API tests validate the newer LLM API backend. Both are legitimate and should coexist.

Applied to files:

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

Applied to files:

  • tests/unittest/_torch/multi_gpu_modeling/test_llama3.py
📚 Learning: 2025-08-06T13:58:07.506Z
Learnt from: galagamPR: NVIDIA/TensorRT-LLM#6487File: tests/unittest/_torch/auto_deploy/unit/singlegpu/test_ad_trtllm_bench.py:1-12Timestamp: 2025-08-06T13:58:07.506ZLearning: 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/_torch/multi_gpu_modeling/test_llama3.py
📚 Learning: 2025-08-29T14:07:45.863Z
Learnt from: EmmaQiaoChPR: NVIDIA/TensorRT-LLM#7370File: tests/unittest/trt/model_api/test_model_quantization.py:24-27Timestamp: 2025-08-29T14:07:45.863ZLearning: 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/_torch/multi_gpu_modeling/test_llama3.py
📚 Learning: 2025-08-26T09:49:04.956Z
Learnt from: pengbowang-nvPR: NVIDIA/TensorRT-LLM#7192File: tests/integration/test_lists/test-db/l0_dgx_b200.yml:56-72Timestamp: 2025-08-26T09:49:04.956ZLearning: In TensorRT-LLM test configuration files, the test scheduling system handles wildcard matching with special rules that prevent duplicate test execution even when the same tests appear in multiple yaml files with overlapping GPU wildcards (e.g., "*b200*" and "*gb200*").

Applied to files:

  • tests/unittest/_torch/multi_gpu_modeling/test_llama3.py
📚 Learning: 2025-08-11T20:09:24.389Z
Learnt from: achartierPR: NVIDIA/TensorRT-LLM#6763File: tests/integration/defs/triton_server/conftest.py:16-22Timestamp: 2025-08-11T20:09:24.389ZLearning: 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/_torch/multi_gpu_modeling/test_llama3.py
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Pre-commit Check
🔇 Additional comments (1)
tests/unittest/_torch/multi_gpu_modeling/test_llama3.py (1)

7-7:Optional: annotate as multi‑GPU heavy test

Repo search returned no GPU-related pytest markers; add an existing repo marker (e.g., @pytest.mark.requires_4gpus or @pytest.mark.slow) so CI/schedulers route this to multi‑GPU nodes. I can scan the repo and propose the exact decorator.

@tensorrt-cicd
Copy link
Collaborator

PR_Github #18948 [ run ] completed with stateSUCCESS
/LLM/release-1.0/L0_MergeRequest_PR pipeline #410(Partly Tested) completed with status: 'FAILURE'

Signed-off-by: Yan Chunwei <328693+Superjomn@users.noreply.github.com>add testSigned-off-by: Yan Chunwei <328693+Superjomn@users.noreply.github.com>upSigned-off-by: Yan Chunwei <328693+Superjomn@users.noreply.github.com>
@Superjomn
Copy link
CollaboratorAuthor

/bot run --stage-list "DGX_H100-4_GPUs-PyTorch-DeepSeek-2,GB200-4_GPUs-PyTorch-1"

@tensorrt-cicd
Copy link
Collaborator

PR_Github #18990 [ run ] triggered by Bot

@tensorrt-cicd
Copy link
Collaborator

PR_Github #18990 [ run ] completed with stateSUCCESS
/LLM/release-1.0/L0_MergeRequest_PR pipeline #411(Partly Tested) completed with status: 'SUCCESS'

@Superjomn
Copy link
CollaboratorAuthor

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #19008 [ run ] triggered by Bot

@tensorrt-cicd
Copy link
Collaborator

PR_Github #19008 [ run ] completed with stateSUCCESS
/LLM/release-1.0/L0_MergeRequest_PR pipeline #414 completed with status: 'SUCCESS'

@SuperjomnSuperjomn merged commit2f3e3ae intoNVIDIA:release/1.0Sep 17, 2025
5 checks passed
@SuperjomnSuperjomn deleted the fix-tp-pp-error-release branchSeptember 18, 2025 01:45
dominicshanshan pushed a commit to dominicshanshan/TensorRT-LLM that referenced this pull requestSep 23, 2025
Signed-off-by: Yan Chunwei <328693+Superjomn@users.noreply.github.com>
dominicshanshan pushed a commit to dominicshanshan/TensorRT-LLM that referenced this pull requestSep 23, 2025
Signed-off-by: Yan Chunwei <328693+Superjomn@users.noreply.github.com>Signed-off-by: Wangshanshan <30051912+dominicshanshan@users.noreply.github.com>
dominicshanshan pushed a commit to dominicshanshan/TensorRT-LLM that referenced this pull requestSep 23, 2025
Signed-off-by: Yan Chunwei <328693+Superjomn@users.noreply.github.com>Signed-off-by: Wangshanshan <30051912+dominicshanshan@users.noreply.github.com>
dominicshanshan pushed a commit to dominicshanshan/TensorRT-LLM that referenced this pull requestSep 24, 2025
Signed-off-by: Yan Chunwei <328693+Superjomn@users.noreply.github.com>Signed-off-by: Wangshanshan <30051912+dominicshanshan@users.noreply.github.com>
dominicshanshan pushed a commit to dominicshanshan/TensorRT-LLM that referenced this pull requestSep 24, 2025
Signed-off-by: Yan Chunwei <328693+Superjomn@users.noreply.github.com>Signed-off-by: Wangshanshan <30051912+dominicshanshan@users.noreply.github.com>
dominicshanshan pushed a commit to dominicshanshan/TensorRT-LLM that referenced this pull requestSep 24, 2025
Signed-off-by: Yan Chunwei <328693+Superjomn@users.noreply.github.com>Signed-off-by: Wangshanshan <30051912+dominicshanshan@users.noreply.github.com>
dominicshanshan pushed a commit to dominicshanshan/TensorRT-LLM that referenced this pull requestSep 24, 2025
Signed-off-by: Yan Chunwei <328693+Superjomn@users.noreply.github.com>Signed-off-by: Wangshanshan <30051912+dominicshanshan@users.noreply.github.com>
dominicshanshan pushed a commit to dominicshanshan/TensorRT-LLM that referenced this pull requestSep 24, 2025
Signed-off-by: Yan Chunwei <328693+Superjomn@users.noreply.github.com>Signed-off-by: Wangshanshan <30051912+dominicshanshan@users.noreply.github.com>
dominicshanshan pushed a commit to dominicshanshan/TensorRT-LLM that referenced this pull requestSep 24, 2025
Signed-off-by: Yan Chunwei <328693+Superjomn@users.noreply.github.com>Signed-off-by: Wangshanshan <30051912+dominicshanshan@users.noreply.github.com>
dominicshanshan pushed a commit to dominicshanshan/TensorRT-LLM that referenced this pull requestSep 24, 2025
Signed-off-by: Yan Chunwei <328693+Superjomn@users.noreply.github.com>Signed-off-by: Wangshanshan <30051912+dominicshanshan@users.noreply.github.com>
dominicshanshan pushed a commit to dominicshanshan/TensorRT-LLM that referenced this pull requestSep 25, 2025
Signed-off-by: Yan Chunwei <328693+Superjomn@users.noreply.github.com>Signed-off-by: Wangshanshan <30051912+dominicshanshan@users.noreply.github.com>
chzblych pushed a commit that referenced this pull requestSep 25, 2025
Signed-off-by: Yan Chunwei <328693+Superjomn@users.noreply.github.com>Signed-off-by: Wangshanshan <30051912+dominicshanshan@users.noreply.github.com>
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@coderabbitaicoderabbitai[bot]coderabbitai[bot] left review comments

@litaotjulitaotjulitaotju approved these changes

@hyuknhyuknhyukn approved these changes

Assignees

No one assigned

Labels

Release BlockerPRs that blocking the final release build or branching out the release branch

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@Superjomn@tensorrt-cicd@litaotju@hyukn

[8]ページ先頭

©2009-2025 Movatter.jp