KEMBAR78
[TRTLLM-7048][feat] add benchmark TRT flow test for MIG by xinhe-nv · Pull Request #6884 · NVIDIA/TensorRT-LLM · GitHub
Skip to content

Conversation

@xinhe-nv
Copy link
Collaborator

@xinhe-nv xinhe-nv commented Aug 14, 2025

Summary by CodeRabbit

  • New Features

    • Benchmarks accept configurable concurrency and num_requests; benchmark run returns parsed results (throughput, latency).
  • Performance/Benchmarking

    • Benchmark invocation now captures output and includes concurrency/num_requests flags for scaling analysis.
  • Tests

    • New MIG concurrency test runs multiple concurrency levels (e.g., 1, 32, 64, 128) validating throughput growth and positive latency; test scaffolding updated.
  • Security/Privacy

    • Redacted hard-coded prompt content in tests.

Description

Test Coverage

GitHub Bot Help

/bot [-h] ['run', 'kill', 'skip', 'reuse-pipeline'] ...

Provide a user friendly way for developers to interact with a Jenkins server.

Run /bot [-h|--help] to print this help message.

See details below for each supported subcommand.

run [--reuse-test (optional)pipeline-id --disable-fail-fast --skip-test --stage-list "A10-PyTorch-1, xxx" --gpu-type "A30, H100_PCIe" --test-backend "pytorch, cpp" --add-multi-gpu-test --only-multi-gpu-test --disable-multi-gpu-test --post-merge --extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx" --detailed-log --debug(experimental)]

Launch build/test pipelines. All previously running jobs will be killed.

--reuse-test (optional)pipeline-id (OPTIONAL) : Allow the new pipeline to reuse build artifacts and skip successful test stages from a specified pipeline or the last pipeline if no pipeline-id is indicated. If the Git commit ID has changed, this option will be always ignored. The DEFAULT behavior of the bot is to reuse build artifacts and successful test results from the last pipeline.

--disable-reuse-test (OPTIONAL) : Explicitly prevent the pipeline from reusing build artifacts and skipping successful test stages from a previous pipeline. Ensure that all builds and tests are run regardless of previous successes.

--disable-fail-fast (OPTIONAL) : Disable fail fast on build/tests/infra failures.

--skip-test (OPTIONAL) : Skip all test stages, but still run build stages, package stages and sanity check stages. Note: Does NOT update GitHub check status.

--stage-list "A10-PyTorch-1, xxx" (OPTIONAL) : Only run the specified test stages. Examples: "A10-PyTorch-1, xxx". Note: Does NOT update GitHub check status.

--gpu-type "A30, H100_PCIe" (OPTIONAL) : Only run the test stages on the specified GPU types. Examples: "A30, H100_PCIe". Note: Does NOT update GitHub check status.

--test-backend "pytorch, cpp" (OPTIONAL) : Skip test stages which don't match the specified backends. Only support [pytorch, cpp, tensorrt, triton]. Examples: "pytorch, cpp" (does not run test stages with tensorrt or triton backend). Note: Does NOT update GitHub pipeline status.

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

--disable-multi-gpu-test (OPTIONAL) : Disable the multi-GPU tests. Note: Does NOT update GitHub check status.

--add-multi-gpu-test (OPTIONAL) : Force run the multi-GPU tests in addition to running L0 pre-merge pipeline.

--post-merge (OPTIONAL) : Run the L0 post-merge pipeline instead of the ordinary L0 pre-merge pipeline.

--extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx" (OPTIONAL) : Run the ordinary L0 pre-merge pipeline and specified test stages. Examples: --extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx".

--detailed-log (OPTIONAL) : Enable flushing out all logs to the Jenkins console. This will significantly increase the log volume and may slow down the job.

--debug (OPTIONAL) : Experimental feature. Enable access to the CI container for debugging purpose. Note: Specify exactly one stage in the stage-list parameter to access the appropriate container environment. Note: Does NOT update GitHub check status.

For guidance on mapping tests to stage names, see docs/source/reference/ci-overview.md
and the scripts/test_to_stage_mapping.py helper.

kill

kill

Kill all running builds associated with pull request.

skip

skip --comment COMMENT

Skip testing for latest commit on pull request. --comment "Reason for skipping build/test" is required. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break.

reuse-pipeline

reuse-pipeline

Reuse a previous pipeline to validate current commit. This action will also kill all currently running builds associated with the pull request. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break.

@xinhe-nv xinhe-nv requested a review from LarryXFly August 14, 2025 05:52
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 14, 2025

📝 Walkthrough

Walkthrough

BenchRunner in the integration tests gained optional concurrency and num_requests parameters, uses them during dataset preparation and benchmark invocation, captures and parses benchmark stdout to return metrics, call returns the parsed results, and a new MIG-mode test runs throughput checks across multiple concurrency levels asserting throughput growth and positive latency.

Changes

Cohort / File(s) Summary of changes
BenchRunner enhancements, parsing, and MIG test
tests/integration/defs/test_e2e.py
- Added concurrency: Optional[int] and num_requests: int to BenchRunner.__init__ and stored on the instance.
- __call__ now returns the result of run_bench().
- prepare_dataset uses self.num_requests instead of a hard-coded value.
- run_bench appends --concurrency and --num_requests flags when provided, captures benchmark stdout via check_output, and returns parsed results via parse_benchmark_output.
- Added parse_benchmark_output(self, output) to extract concurrency, num_requests, throughput, and latency from CLI output.
- Added test_trtllm_bench_mig_launch to run throughput tests across multiple concurrency levels (1,32,64,128) in MIG mode, aggregate results, print a summary, and assert throughput growth and positive latency.

Sequence Diagram(s)

sequenceDiagram
  participant Test as MIG Concurrency Test
  participant BR as BenchRunner
  participant DS as prepare_dataset
  participant RB as run_bench
  participant PB as parse_benchmark_output

  Test->>BR: instantiate(concurrency, num_requests, ...)
  Test->>BR: __call__()
  BR->>DS: prepare_dataset(num_requests)
  DS-->>BR: dataset ready
  BR->>RB: run_bench(concurrency, num_requests)
  RB-->>BR: stdout (benchmark output)
  BR->>PB: parse_benchmark_output(output)
  PB-->>BR: {concurrency, num_requests, throughput, latency}
  BR-->>Test: results
  Test->>Test: assert throughput trend, latency > 0
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~18 minutes

Possibly related PRs

Suggested reviewers

  • venkywonka
  • EmmaQiaoCh
  • LarryXFly
  • 2ez4bz

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @coderabbitai title anywhere in the PR title to generate the title automatically.

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@xinhe-nv xinhe-nv marked this pull request as ready for review August 14, 2025 05:53
@xinhe-nv xinhe-nv requested a review from a team as a code owner August 14, 2025 05:53
@xinhe-nv
Copy link
Collaborator Author

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #15231 [ run ] triggered by Bot

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🔭 Outside diff range comments (1)
tests/integration/defs/test_e2e.py (1)

411-411: Remove the hard-coded sensitive test data.

Line 411 contains a hard-coded message with mathematical expressions and prompts that appear to be test data. This should be externalized to a configuration file or test data repository for better maintainability and security.

Replace the hard-coded message with a reference to external test data:

-    message = r"<|begin▁of▁sentence|><|User|>The operation $\otimes$ is defined for all nonzero numbers by $a \otimes b = \frac{a^{2}}{b}$. Determine $[(1 \otimes 2) \otimes 3] - [1 \otimes (2 \otimes 3)]$. Let's think step by step and output the final answer within \boxed{}.<|Assistant|>"
+    # Load test message from external configuration
+    message = load_test_message("qwen_math_operation_test")
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between b88dae4 and d3ee1fd.

📒 Files selected for processing (1)
  • tests/integration/defs/test_e2e.py (5 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.py

📄 CodeRabbit Inference Engine (CODING_GUIDELINES.md)

**/*.py: Python code must target Python 3.8+
Python indentation: 4 spaces, no tabs
Maintain module namespace in imports (from package.subpackage import foo; then use foo.SomeClass())
Python file names use snake_case
Python class names use PascalCase
Python functions/methods and local variables use snake_case; variables starting with a number get k_ prefix (e.g., k_99th_percentile)
Global variables use G_ prefixed UPPER_SNAKE_CASE (e.g., G_MY_GLOBAL)
Constants use UPPER_SNAKE_CASE in Python
Avoid shadowing variables from outer scopes in Python
Initialize all externally visible members of a Python class in init
Prefer docstrings for interfaces used outside a file; comments for local code
Use Google-style docstrings for classes and functions (Sphinx-parsable)
Document attributes/variables inline with short docstrings
Avoid reflection when simple alternatives exist (e.g., prefer explicit parameters over dict(**locals()))
In try/except, catch the narrowest exceptions possible
For duck-typing with try/except, keep try body minimal and put logic in else

Files:

  • tests/integration/defs/test_e2e.py
**/*.{cpp,cxx,cc,cu,h,hpp,hxx,hh,cuh,py}

📄 CodeRabbit Inference Engine (CODING_GUIDELINES.md)

Prepend NVIDIA copyright header (current year) to all source files

Files:

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

Applied to files:

  • tests/integration/defs/test_e2e.py
🪛 Ruff (0.12.2)
tests/integration/defs/test_e2e.py

590-590: Do not use bare except

(E722)


596-596: Do not use bare except

(E722)


629-629: First line should end with a period, question mark, or exclamation point

Add closing punctuation

(D415)

🔇 Additional comments (5)
tests/integration/defs/test_e2e.py (5)

452-454: LGTM - Constructor signature properly extended.

The new optional parameters concurrency and num_requests are correctly added with appropriate defaults and type hints.


479-480: LGTM - Instance variables properly initialized.

The new instance variables are correctly stored for later use in the benchmark execution.


486-486: LGTM - Return value now properly captured.

The method now returns the benchmark results instead of discarding them, enabling result processing and validation.


509-509: LGTM - Dynamic dataset size configuration.

Using self.num_requests instead of a hard-coded value makes the dataset generation configurable.


563-571: LGTM - Enhanced benchmark execution with parameter support.

The conditional addition of concurrency and num_requests parameters and the switch from check_call to check_output properly enables result capture and processing.

Comment on lines 622 to 685
@pytest.mark.parametrize("model_name", ["meta/Meta-Llama-3.1-8B"],
ids=["llama3_1-8b"])
@pytest.mark.parametrize("model_subdir", ["llama-3.1-model/Meta-Llama-3.1-8B"],
ids=["llama_v3_1"])
@pytest.mark.parametrize("use_pytorch_backend", [False], ids=["trt_backend"])
def test_trtllm_bench_mig_launch(llm_root, llm_venv, model_name, model_subdir,
use_pytorch_backend):
"run bench mark in MIG mode, check if the throughput is increasing by concurrency"
skip_engine_build = False
results = {}
concurrency_list = [1, 32, 64, 128]

for concurrency in concurrency_list:
num_requests = concurrency * 10
runner = BenchRunner(llm_root=llm_root,
llm_venv=llm_venv,
model_name=model_name,
model_subdir=model_subdir,
streaming=False,
use_pytorch_backend=use_pytorch_backend,
use_mpirun=False,
tp_size=1,
concurrency=concurrency,
num_requests=num_requests,
skip_engine_build=skip_engine_build)

output = runner()
results[concurrency] = output

print(f"\n=== Benchmark Results Comparison ===")
print(f"Model: {model_name}")
print(f"Backend: {'PyTorch' if use_pytorch_backend else 'TensorRT'}")
print(
f"{'Concurrency':<15} {'Throughput':<15} {'Latency':<15} {'Num Requests':<15}"
)
print("-" * 60)

for idx, val in enumerate(concurrency_list):
if hasattr(results[val], 'get'):
throughput = float(results[val].get('throughput', 0))
latency = float(results[val].get('latency', 0))
num_requests = int(results[val].get('num_requests', 0))
assert throughput > 0, f"Throughput is 0 for concurrency {concurrency}"
assert latency > 0, f"Latency is 0 for concurrency {concurrency}"
print(
f"{concurrency:<15} {throughput:<15} {latency:<15} {num_requests:<15}"
)
if idx > 0:
assert throughput > float(
results[concurrency_list[idx - 1]].get('throughput', 0)
) * 1.3, f"Throughput is not increasing for concurrency {concurrency_list[idx]}"

Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Fix docstring format and improve test logic.

The test function docstring on line 629 should end with proper punctuation. Additionally, consider improving the assertion logic for better test reliability.

Fix the docstring and improve assertions:

-    "run bench mark in MIG mode, check if the throughput is increasing by concurrency"
+    """Run benchmark in MIG mode, check if the throughput is increasing by concurrency."""

Also consider making the throughput increase assertion more robust:

                 assert throughput > float(
                     results[concurrency_list[idx - 1]].get('throughput', 0)
-                ) * 1.3, f"Throughput is not increasing for concurrency {concurrency_list[idx]}"
+                ) * 1.2, f"Expected throughput increase from {concurrency_list[idx-1]} to {concurrency_list[idx]}, but got {prev_throughput} -> {throughput}"

The 1.3x factor seems quite aggressive and might cause flaky tests. Consider a more conservative factor like 1.2x or make it configurable.

Committable suggestion skipped: line range outside the PR's diff.

🧰 Tools
🪛 Ruff (0.12.2)

629-629: First line should end with a period, question mark, or exclamation point

Add closing punctuation

(D415)

🤖 Prompt for AI Agents
In tests/integration/defs/test_e2e.py around lines 622-673, the function
docstring should end with proper punctuation and the test assertions are
brittle: update the docstring to end with a period; change every use of the
undefined/outer "concurrency" variable inside the final loop to the loop
variable "val" (for both assertion messages and print outputs); ensure numeric
parsing uses safe defaults already present but add a guard so the throughput
comparison only runs if previous_throughput > 0 (fail with a clear message
otherwise); and relax the growth requirement from 1.3x to a more conservative
1.2x (or make this factor a small configurable constant at the top of the test)
with clearer assertion messages when the increase expectation is not met.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (3)
tests/integration/defs/test_e2e.py (3)

633-633: Fix function docstring formatting and wording.

Use a proper docstring with closing punctuation; also “benchmark” is one word.

-    "run bench mark in MIG mode, check if the throughput is increasing by concurrency"
+    """Run benchmark in MIG mode; check that throughput increases with concurrency."""

573-601: Parse numeric throughput/latency values; current string parsing will break downstream.

parse_benchmark_output currently stores raw strings (likely with units), but the MIG test converts them to float, which will raise ValueError when units are present. Parse and store numeric floats.

     def parse_benchmark_output(self, output):
         """Parse the benchmark output to extract key metrics."""
         result = {
             'concurrency': self.concurrency,
             'num_requests': self.num_requests,
-            'throughput': 0,
-            'latency': 0
+            'throughput': 0.0,
+            'latency': 0.0
         }
 
         lines = output.split('\n')
         for line in lines:
             line = line.strip()
             if 'total token throughput' in line.lower(
             ) and 'tokens/sec' in line.lower():
                 try:
-                    throughput = line.split(":")[1].strip()
-                    result['throughput'] = throughput
-                except (IndexError, ValueError) as e:
-                    print(f"Failed to parse throughput from line: {line}. Error: {e}")
+                    throughput_str = line.split(":", 1)[1].strip()
+                    m = re.search(r'([-+]?\d*\.?\d+)', throughput_str)
+                    if m:
+                        result['throughput'] = float(m.group(1))
+                except (IndexError, ValueError) as e:
+                    print(f"Failed to parse throughput from line: {line}. Error: {e}")
                     pass
             elif 'total latency' in line.lower() and 'ms' in line.lower():
                 try:
-                    latency = line.split(":")[1].strip()
-                    result['latency'] = latency
-                except (IndexError, ValueError) as e:
-                    print(f"Failed to parse latency from line: {line}. Error: {e}")
+                    latency_str = line.split(":", 1)[1].strip()
+                    m = re.search(r'([-+]?\d*\.?\d+)', latency_str)
+                    if m:
+                        result['latency'] = float(m.group(1))
+                except (IndexError, ValueError) as e:
+                    print(f"Failed to parse latency from line: {line}. Error: {e}")
                     pass
 
         return result

678-679: Relax growth factor and wrap long assert message (E501).

  1. The 1.3x requirement is aggressive and may be flaky; use 1.2x (or make it a constant).
  2. The assert line exceeds 120 chars; wrap with parentheses.
-            prev_throughput = float(results[concurrency_list[idx - 1]].get('throughput', 0))
-            assert throughput > prev_throughput * 1.3, f"Throughput is not increasing for concurrency {concurrency_list[idx]}"
+            prev_throughput = float(
+                results[concurrency_list[idx - 1]].get('throughput', 0)
+            )
+            growth_factor = 1.2
+            assert throughput > prev_throughput * growth_factor, (
+                f"Expected >= {growth_factor}x throughput increase from "
+                f"{concurrency_list[idx-1]} to {concurrency_list[idx]}: "
+                f"{prev_throughput} -> {throughput}"
+            )
🧹 Nitpick comments (1)
tests/integration/defs/test_e2e.py (1)

563-567: Use explicit None checks for CLI options to avoid dropping 0-values.

Truthiness checks will skip valid zero-values (e.g., concurrency=0). Prefer explicit is not None.

-        if self.concurrency:
-            benchmark_cmd += f" --concurrency {self.concurrency}"
-        if self.num_requests:
-            benchmark_cmd += f" --num_requests {self.num_requests}"
+        if self.concurrency is not None:
+            benchmark_cmd += f" --concurrency {self.concurrency}"
+        if self.num_requests is not None:
+            benchmark_cmd += f" --num_requests {self.num_requests}"
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between d3ee1fd and 4080006.

📒 Files selected for processing (1)
  • tests/integration/defs/test_e2e.py (5 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.py

📄 CodeRabbit Inference Engine (CODING_GUIDELINES.md)

**/*.py: Python code must target Python 3.8+
Python indentation: 4 spaces, no tabs
Maintain module namespace in imports (from package.subpackage import foo; then use foo.SomeClass())
Python file names use snake_case
Python class names use PascalCase
Python functions/methods and local variables use snake_case; variables starting with a number get k_ prefix (e.g., k_99th_percentile)
Global variables use G_ prefixed UPPER_SNAKE_CASE (e.g., G_MY_GLOBAL)
Constants use UPPER_SNAKE_CASE in Python
Avoid shadowing variables from outer scopes in Python
Initialize all externally visible members of a Python class in init
Prefer docstrings for interfaces used outside a file; comments for local code
Use Google-style docstrings for classes and functions (Sphinx-parsable)
Document attributes/variables inline with short docstrings
Avoid reflection when simple alternatives exist (e.g., prefer explicit parameters over dict(**locals()))
In try/except, catch the narrowest exceptions possible
For duck-typing with try/except, keep try body minimal and put logic in else

Files:

  • tests/integration/defs/test_e2e.py
**/*.{cpp,cxx,cc,cu,h,hpp,hxx,hh,cuh,py}

📄 CodeRabbit Inference Engine (CODING_GUIDELINES.md)

Prepend NVIDIA copyright header (current year) to all source files

Files:

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

Applied to files:

  • tests/integration/defs/test_e2e.py
🪛 Ruff (0.12.2)
tests/integration/defs/test_e2e.py

664-664: SyntaxError: Expected an indented block after for statement


679-679: Line too long (126 > 120)

(E501)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Pre-commit Check
🔇 Additional comments (5)
tests/integration/defs/test_e2e.py (5)

452-455: Constructor extension (concurrency/num_requests) looks good.

The added knobs are sensible and well-scoped for benchmarking scenarios.

Also applies to: 479-481


486-486: Good: call now returns the benchmark results.

This enables callers/tests to consume metrics directly.


509-509: Good: dataset size parameterized via self.num_requests.

Keeps dataset generation consistent with the run config.


568-571: Capturing benchmark stdout and returning parsed metrics: LGTM.

Assuming parsing is robust (see next comment), this is the right direction.


624-631: MIG-mode test scaffolding is reasonable.

Skip markers and parametrization look aligned with resource requirements.

@xinhe-nv
Copy link
Collaborator Author

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #15242 [ run ] triggered by Bot

@tensorrt-cicd
Copy link
Collaborator

PR_Github #15231 [ run ] completed with state ABORTED

@xinhe-nv
Copy link
Collaborator Author

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #15269 [ run ] triggered by Bot

@tensorrt-cicd
Copy link
Collaborator

PR_Github #15269 [ run ] completed with state SUCCESS
/LLM/release-1.0/L0_MergeRequest_PR pipeline #112 completed with status: 'SUCCESS'
Pipeline passed with automatic retried tests. Check the rerun report for details.

@xinhe-nv xinhe-nv enabled auto-merge (squash) August 14, 2025 12:35
xinhe-nv and others added 4 commits August 15, 2025 13:57
Signed-off-by: Xin He (SW-GPU) <200704525+xinhe-nv@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Signed-off-by: xinhe-nv <200704525+xinhe-nv@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Signed-off-by: xinhe-nv <200704525+xinhe-nv@users.noreply.github.com>
Signed-off-by: Xin He (SW-GPU) <200704525+xinhe-nv@users.noreply.github.com>
@LarryXFly LarryXFly disabled auto-merge August 15, 2025 06:00
@LarryXFly LarryXFly merged commit c03ea1b into NVIDIA:release/1.0 Aug 15, 2025
5 checks passed
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (3)
tests/integration/defs/test_e2e.py (3)

635-635: Fix docstring punctuation and wording.

End the docstring with a period and use “benchmark” as one word. D415 flagged the missing punctuation.

Apply this diff:

-    "run bench mark in MIG mode, check if the throughput is increasing by concurrency"
+    """Run benchmark in MIG mode, check if the throughput increases with concurrency."""

681-685: Relax growth factor and wrap long assertion message (E501).

1.3x may be too aggressive and can flake depending on scheduling/noise; 1.2x is more conservative. Also wrap the assertion string to satisfy the 120-column limit.

Apply this diff:

-        if idx > 0:
-            prev_throughput = float(results[concurrency_list[idx - 1]].get(
-                'throughput', 0))
-            assert throughput > prev_throughput * 1.3, f"Throughput is not increasing for concurrency {concurrency_list[idx]}"
+        if idx > 0:
+            prev_throughput = float(
+                results[concurrency_list[idx - 1]].get('throughput', 0)
+            )
+            assert throughput > prev_throughput * 1.2, (
+                f"Expected throughput increase from {concurrency_list[idx - 1]} "
+                f"to {concurrency_list[idx]}: {prev_throughput} -> {throughput}"
+            )

575-603: Parse numeric throughput/latency; return floats instead of raw strings.

The parser currently stores raw substrings (e.g., “123 tokens/sec”), which will cause float(...) conversion errors downstream. Extract the numeric portion and return floats. Also split only once on “:” to avoid surprises.

Apply this diff:

-    def parse_benchmark_output(self, output):
-        """Parse the benchmark output to extract key metrics."""
-        result = {
-            'concurrency': self.concurrency,
-            'num_requests': self.num_requests,
-            'throughput': 0,
-            'latency': 0
-        }
-
-        lines = output.split('\n')
-        for line in lines:
-            line = line.strip()
-            if 'total token throughput' in line.lower(
-            ) and 'tokens/sec' in line.lower():
-                try:
-                    throughput = line.split(":")[1].strip()
-                    result['throughput'] = throughput
-                except (IndexError, ValueError) as e:
-                    print(
-                        f"Failed to parse throughput from line: {line}. Error: {e}"
-                    )
-            elif 'total latency' in line.lower() and 'ms' in line.lower():
-                try:
-                    latency = line.split(":")[1].strip()
-                    result['latency'] = latency
-                except (IndexError, ValueError) as e:
-                    print(
-                        f"Failed to parse latency from line: {line}. Error: {e}"
-                    )
-
-        return result
+    def parse_benchmark_output(self, output: str):
+        """Parse benchmark stdout to extract numeric metrics.
+
+        Returns:
+            dict: {
+                'concurrency': Optional[int],
+                'num_requests': int,
+                'throughput': float,  # tokens/sec
+                'latency': float,     # ms
+            }
+        """
+        result = {
+            'concurrency': self.concurrency,
+            'num_requests': self.num_requests,
+            'throughput': 0.0,
+            'latency': 0.0,
+        }
+
+        lines = output.split('\n')
+        for line in lines:
+            s = line.strip()
+            low = s.lower()
+            if 'total token throughput' in low and 'tokens/sec' in low:
+                try:
+                    payload = s.split(":", 1)[1].strip()
+                    m = re.search(r'([-+]?\d*\.?\d+)', payload)
+                    if m:
+                        result['throughput'] = float(m.group(1))
+                except (IndexError, ValueError) as e:
+                    print(f"Failed to parse throughput from line: {s}. Error: {e}")
+            elif 'total latency' in low and 'ms' in low:
+                try:
+                    payload = s.split(":", 1)[1].strip()
+                    m = re.search(r'([-+]?\d*\.?\d+)', payload)
+                    if m:
+                        result['latency'] = float(m.group(1))
+                except (IndexError, ValueError) as e:
+                    print(f"Failed to parse latency from line: {s}. Error: {e}")
+
+        return result

Note: This also preserves your targeted exception handling introduced here. Nice improvement over the previous bare except.

🧹 Nitpick comments (2)
tests/integration/defs/test_e2e.py (2)

452-455: New BenchRunner parameters look good; please document them.

Adding concurrency and num_requests is a clean extension and aligns with the new MIG-flow test usage. Consider adding a short Google-style docstring for __init__ to document these params and their semantics (e.g., whether 0 is meaningful) for future readers.


563-567: Use explicit None-checks to avoid silently skipping zero values.

Truthiness checks will skip 0, which could be a valid explicit input in some scenarios. Prefer explicit None-checks.

Apply this diff:

-        if self.concurrency:
-            benchmark_cmd += f" --concurrency {self.concurrency}"
-        if self.num_requests:
-            benchmark_cmd += f" --num_requests {self.num_requests}"
+        if self.concurrency is not None:
+            benchmark_cmd += f" --concurrency {self.concurrency}"
+        if self.num_requests is not None:
+            benchmark_cmd += f" --num_requests {self.num_requests}"
📜 Review details

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

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 4080006 and 0b34cd9.

📒 Files selected for processing (1)
  • tests/integration/defs/test_e2e.py (5 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.py

📄 CodeRabbit Inference Engine (CODING_GUIDELINES.md)

**/*.py: Python code must target Python 3.8+
Python indentation: 4 spaces, no tabs
Maintain module namespace in imports (from package.subpackage import foo; then use foo.SomeClass())
Python file names use snake_case
Python class names use PascalCase
Python functions/methods and local variables use snake_case; variables starting with a number get k_ prefix (e.g., k_99th_percentile)
Global variables use G_ prefixed UPPER_SNAKE_CASE (e.g., G_MY_GLOBAL)
Constants use UPPER_SNAKE_CASE in Python
Avoid shadowing variables from outer scopes in Python
Initialize all externally visible members of a Python class in init
Prefer docstrings for interfaces used outside a file; comments for local code
Use Google-style docstrings for classes and functions (Sphinx-parsable)
Document attributes/variables inline with short docstrings
Avoid reflection when simple alternatives exist (e.g., prefer explicit parameters over dict(**locals()))
In try/except, catch the narrowest exceptions possible
For duck-typing with try/except, keep try body minimal and put logic in else

Files:

  • tests/integration/defs/test_e2e.py
**/*.{cpp,cxx,cc,cu,h,hpp,hxx,hh,cuh,py}

📄 CodeRabbit Inference Engine (CODING_GUIDELINES.md)

Prepend NVIDIA copyright header (current year) to all source files

Files:

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

Applied to files:

  • tests/integration/defs/test_e2e.py
🪛 Ruff (0.12.2)
tests/integration/defs/test_e2e.py

635-635: First line should end with a period, question mark, or exclamation point

Add closing punctuation

(D415)


684-684: Line too long (126 > 120)

(E501)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Pre-commit Check
🔇 Additional comments (5)
tests/integration/defs/test_e2e.py (5)

479-481: State captured correctly for concurrency and num_requests.

Persisting these values on the instance enables the new parsing/printing logic. No issues here.


486-486: Good change: return parsed benchmark results from call.

Returning the parsed metrics makes the runner composable and simplifies the test logic that aggregates results.


494-510: Using num_requests from the constructor is correct.

Passing --num-requests from self.num_requests ensures dataset size matches concurrency-driven test scenarios. Looks good.


568-572: Good: capture stdout and return parsed metrics.

Switching to check_output and returning the parsed metrics enables robust assertions without scraping temp files.


590-599: Nice: replaced bare except with targeted exception handling.

Catching IndexError/ValueError is the right choice here and prevents masking unrelated failures.

@xinhe-nv xinhe-nv deleted the mig_test branch August 21, 2025 03:16
dominicshanshan pushed a commit to dominicshanshan/TensorRT-LLM that referenced this pull request Aug 22, 2025
Signed-off-by: Xin He (SW-GPU) <200704525+xinhe-nv@users.noreply.github.com>
Signed-off-by: xinhe-nv <200704525+xinhe-nv@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
dominicshanshan pushed a commit to dominicshanshan/TensorRT-LLM that referenced this pull request Aug 22, 2025
Signed-off-by: Xin He (SW-GPU) <200704525+xinhe-nv@users.noreply.github.com>
Signed-off-by: xinhe-nv <200704525+xinhe-nv@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@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 request Aug 22, 2025
Signed-off-by: Xin He (SW-GPU) <200704525+xinhe-nv@users.noreply.github.com>
Signed-off-by: xinhe-nv <200704525+xinhe-nv@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@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 request Aug 23, 2025
Signed-off-by: Xin He (SW-GPU) <200704525+xinhe-nv@users.noreply.github.com>
Signed-off-by: xinhe-nv <200704525+xinhe-nv@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@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 request Aug 24, 2025
Signed-off-by: Xin He (SW-GPU) <200704525+xinhe-nv@users.noreply.github.com>
Signed-off-by: xinhe-nv <200704525+xinhe-nv@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@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 request Aug 25, 2025
Signed-off-by: Xin He (SW-GPU) <200704525+xinhe-nv@users.noreply.github.com>
Signed-off-by: xinhe-nv <200704525+xinhe-nv@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@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 request Aug 25, 2025
Signed-off-by: Xin He (SW-GPU) <200704525+xinhe-nv@users.noreply.github.com>
Signed-off-by: xinhe-nv <200704525+xinhe-nv@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@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 request Aug 25, 2025
Signed-off-by: Xin He (SW-GPU) <200704525+xinhe-nv@users.noreply.github.com>
Signed-off-by: xinhe-nv <200704525+xinhe-nv@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@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 request Aug 26, 2025
Signed-off-by: Xin He (SW-GPU) <200704525+xinhe-nv@users.noreply.github.com>
Signed-off-by: xinhe-nv <200704525+xinhe-nv@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@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 request Aug 27, 2025
Signed-off-by: Xin He (SW-GPU) <200704525+xinhe-nv@users.noreply.github.com>
Signed-off-by: xinhe-nv <200704525+xinhe-nv@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@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 request Aug 27, 2025
Signed-off-by: Xin He (SW-GPU) <200704525+xinhe-nv@users.noreply.github.com>
Signed-off-by: xinhe-nv <200704525+xinhe-nv@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@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 request Aug 27, 2025
Signed-off-by: Xin He (SW-GPU) <200704525+xinhe-nv@users.noreply.github.com>
Signed-off-by: xinhe-nv <200704525+xinhe-nv@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@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 request Aug 27, 2025
Signed-off-by: Xin He (SW-GPU) <200704525+xinhe-nv@users.noreply.github.com>
Signed-off-by: xinhe-nv <200704525+xinhe-nv@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@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 request Aug 28, 2025
Signed-off-by: Xin He (SW-GPU) <200704525+xinhe-nv@users.noreply.github.com>
Signed-off-by: xinhe-nv <200704525+xinhe-nv@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@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 request Aug 28, 2025
Signed-off-by: Xin He (SW-GPU) <200704525+xinhe-nv@users.noreply.github.com>
Signed-off-by: xinhe-nv <200704525+xinhe-nv@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@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 request Aug 28, 2025
Signed-off-by: Xin He (SW-GPU) <200704525+xinhe-nv@users.noreply.github.com>
Signed-off-by: xinhe-nv <200704525+xinhe-nv@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@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 request Aug 28, 2025
Signed-off-by: Xin He (SW-GPU) <200704525+xinhe-nv@users.noreply.github.com>
Signed-off-by: xinhe-nv <200704525+xinhe-nv@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@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 request Aug 28, 2025
Signed-off-by: Xin He (SW-GPU) <200704525+xinhe-nv@users.noreply.github.com>
Signed-off-by: xinhe-nv <200704525+xinhe-nv@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@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 request Aug 28, 2025
Signed-off-by: Xin He (SW-GPU) <200704525+xinhe-nv@users.noreply.github.com>
Signed-off-by: xinhe-nv <200704525+xinhe-nv@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@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 request Aug 29, 2025
Signed-off-by: Xin He (SW-GPU) <200704525+xinhe-nv@users.noreply.github.com>
Signed-off-by: xinhe-nv <200704525+xinhe-nv@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@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 request Aug 29, 2025
Signed-off-by: Xin He (SW-GPU) <200704525+xinhe-nv@users.noreply.github.com>
Signed-off-by: xinhe-nv <200704525+xinhe-nv@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@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 request Aug 29, 2025
Signed-off-by: Xin He (SW-GPU) <200704525+xinhe-nv@users.noreply.github.com>
Signed-off-by: xinhe-nv <200704525+xinhe-nv@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@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 request Aug 29, 2025
Signed-off-by: Xin He (SW-GPU) <200704525+xinhe-nv@users.noreply.github.com>
Signed-off-by: xinhe-nv <200704525+xinhe-nv@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@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 request Aug 29, 2025
Signed-off-by: Xin He (SW-GPU) <200704525+xinhe-nv@users.noreply.github.com>
Signed-off-by: xinhe-nv <200704525+xinhe-nv@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@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 request Aug 30, 2025
Signed-off-by: Xin He (SW-GPU) <200704525+xinhe-nv@users.noreply.github.com>
Signed-off-by: xinhe-nv <200704525+xinhe-nv@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Signed-off-by: Wangshanshan <30051912+dominicshanshan@users.noreply.github.com>
joyang-nv pushed a commit that referenced this pull request Sep 1, 2025
Signed-off-by: Xin He (SW-GPU) <200704525+xinhe-nv@users.noreply.github.com>
Signed-off-by: xinhe-nv <200704525+xinhe-nv@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Signed-off-by: Wangshanshan <30051912+dominicshanshan@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants