Skip to content

Conversation

@ruodil
Copy link
Collaborator

@ruodil ruodil commented Aug 22, 2025

add kv_cache in bench perf metric

Summary by CodeRabbit

  • Tests
    • Adds KV cache size to perf metrics and thresholds, enabling collection and alerting on KV cache size in bench runs.
    • Streamlines QA/perf cluster matrix: removes heavy combos, lowers request counts, refactors 4‑GPU/8+ GPU permutations, and adds lighter variants for broader coverage (llama/mistral/deepseek).
    • Updates full test matrix: swaps some bench tests for instruct variants, fixes FP8 flag syntax, relocates/adds mistral_small 24B variants with timeouts, and prunes select FP8 2‑GPU 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.

Details

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

kill

kill

Kill all running builds associated with pull request.

skip

skip --comment COMMENT

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

reuse-pipeline

reuse-pipeline

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 22, 2025

📝 Walkthrough

Walkthrough

Adds KV_CACHE_SIZE metric parsing, thresholds, and collection to perf/bench tests; and trims/reworks QA perf test matrices by removing heavy entries, adjusting parameters, renaming some tests, and fixing FP8 flag syntax.

Changes

Cohort / File(s) Summary of edits
Perf metrics test definitions
tests/integration/defs/perf/test_perf.py
Added PerfMetricType.KV_CACHE_SIZE to metric parsing/queries, BENCH_INFERENCE_METRICS, and PERF_METRIC_THRESHOLD; introduced regex parsing for KV cache size and threshold (-0.1, 50).
QA perf test matrices (cluster)
tests/integration/test_lists/qa/llm_perf_cluster.yml
Removed multiple heavy 2/4/8-GPU test entries, reduced request counts and workloads, replaced many 4-GPU combos with updated parameter sets (maxbs/maxnt/input_output_len/kv_frac/reqs), and pruned several 8-GPU entries.
QA perf test matrices (full)
tests/integration/test_lists/qa/llm_perf_full.yml
Removed some heavy mistral tests and reinserted alternate mistral variants elsewhere, corrected FP8 flag syntax (e.g., quant:fp8-tp:2tp:2), renamed several bench→instruct test entries, and adjusted other test parameters.

Sequence Diagram(s)

sequenceDiagram
  participant Log as Perf Log
  participant Parser as Perf Log Parser
  participant Metrics as Metrics Collector
  participant Bench as Bench Runner

  rect rgb(240,248,255)
  Log->>Parser: emit perf log lines (includes KV cache size)
  end

  rect rgb(245,255,240)
  Parser->>Metrics: parse metrics (max_tokens regex, KV cache regex)
  Metrics-->>Bench: expose KV_CACHE_SIZE in BENCH_INFERENCE_METRICS
  end

  rect rgb(255,249f0)
  Bench->>Metrics: collect metrics, validate thresholds (e.g., KV_CACHE_SIZE threshold)
  Metrics-->>Bench: threshold evaluatation result
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • StanleySun639
  • LarryXFly
  • zbpatel
  • yilin-void

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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
tests/integration/test_lists/qa/llm_perf_full.yml (1)

77-78: Non-FP8 tests placed under an FP8-gated block can be confusing.

These two Mistral-Small bfloat16 TIMEOUT cases live inside the “supports_fp8: true” block. It’s valid to gate heavy bfloat16 tests behind FP8-capable hardware, but the placement under a “FP8” section header can mislead future edits.

Consider moving them to a nearby non-FP8 block with an inline comment noting they’re intentionally gated to FP8-capable nodes, or add a brief comment here clarifying why they’re in this block.

📜 Review details

Configuration used: Path: .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 d94cc3f and e2b36c9.

📒 Files selected for processing (3)
  • tests/integration/defs/perf/test_perf.py (1 hunks)
  • tests/integration/test_lists/qa/llm_perf_cluster.yml (2 hunks)
  • tests/integration/test_lists/qa/llm_perf_full.yml (3 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/perf/test_perf.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/perf/test_perf.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/test_lists/qa/llm_perf_cluster.yml
  • tests/integration/test_lists/qa/llm_perf_full.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 (9)
tests/integration/defs/perf/test_perf.py (1)

324-329: No changes needed: bench-specific regex for KV_CACHE_SIZE already present

  • In tests/integration/defs/perf/test_perf.py, under BENCH_PERF_METRIC_LOG_QUERIES (around line 253), there is already an entry
    PerfMetricType.KV_CACHE_SIZE: re.compile(r".*Allocated ([\d\.]+) GiB for max tokens in paged KV cache.*"), so parsing won’t raise for KV_CACHE_SIZE.
  • Since the bench map includes this regex, there’s no runtime error—and the original suggestion to add it is no longer required.
tests/integration/test_lists/qa/llm_perf_full.yml (2)

182-184: Good fix: remove incompatible quant flag for PyTorch bench.

Dropping quant:fp8 from phi_3_mini_128k_instruct-bench-pytorch-float16-...-tp:2 aligns with validation (backend == "pytorch" forbids passing quantization).

If any other bench-pytorch-* entries still carry quant:*, we should strip them too to avoid parser assertions. Want me to sweep the list?


265-266: 8-GPU bfloat16 additions look fine; consider TIMEOUT safeguards.

The new 8-GPU llama_v3.3_70b_instruct-bench-pytorch-bfloat16-* entries mirror nearby patterns. Given similar heavy entries are annotated with TIMEOUT(...), evaluate whether these should also carry a timeout to keep pipelines responsive in worst-case queues.

Do these complete comfortably within your CI time budget on 8x GPUs? If not, add TIMEOUT(...) consistent with adjacent entries.

tests/integration/test_lists/qa/llm_perf_cluster.yml (6)

48-49: Reduced workload from 500 to 300 reqs: sensible matrix lightening.

This keeps coverage while cutting runtime/instability on the 24B cases.


67-68: 2-GPU counterpart workload reduction mirrors the 1-GPU change.

Consistent and pragmatic.


78-81: Explicit TIMEOUTs added to heavy DeepSeek R1-NVFP4 4-GPU runs.

Annotating the long-tail cases with TIMEOUT(120) is a good guardrail. Ensure your test harness interprets these TIMEOUT tags for scheduling/cancellation as intended across pipelines.

Can you confirm these TIMEOUT annotations are consumed by the generator/pipeline (and not just comments)?


86-87: Marking 405B FP4 20k-maxnt 4-GPU run as TIMEOUT is consistent with other heavy variants.

Prevents pipeline stalls on pathological workloads.

Double-check whether 120s is sufficient under current cluster load; bump if you’ve observed frequent near-timeouts.


90-91: Add reqs cap for 70B FP4 4-GPU 4096-maxnt and TIMEOUT for 20k-maxnt.

Balanced: you cap one and timebox the other.


94-96: Scout 17B FP4 4-GPU: new maxbs/maxnt variants plus TIMEOUT on 20k-maxnt.

Looks consistent with the refined 4-GPU matrix elsewhere.

@ruodil ruodil force-pushed the user/ruodil/org_cases branch from e2b36c9 to d05abc4 Compare August 22, 2025 10:06
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: 2

🧹 Nitpick comments (2)
tests/integration/test_lists/qa/llm_perf_cluster.yml (2)

67-67: 2-GPU variant still looks oversized for 24B @ maxbs:4096 and 20k max tokens.

Even with 2 GPUs, this is likely to hit memory/time ceilings. Consider tp:2 and/or reducing maxbs/reqs to hit the CI time budget more reliably.

-  - perf/test_perf.py::test_perf[mistral_small_v3.1_24b-bench-pytorch-bfloat16-maxbs:4096-maxnt:20000-input_output_len:20000,2000-reqs:300-con:200-gpus:2] TIMEOUT(120)
+  - perf/test_perf.py::test_perf[mistral_small_v3.1_24b-bench-pytorch-bfloat16-maxbs:1024-maxnt:20000-input_output_len:20000,2000-reqs:150-con:100-tp:2-gpus:2] TIMEOUT(120)

90-90: Consider adding tp:4 for consistency on 70B 4-GPU runs.

Not strictly required for 70B FP4 on 4 GPUs, but aligning with 8-GPU entries improves determinism and avoids accidental single-rank runs.

-  - perf/test_perf.py::test_perf[llama_v3.3_70b_instruct_fp4-bench-pytorch-float4-maxbs:1024-maxnt:4096-kv_frac:0.85-input_output_len:1000,1000-reqs:1000-gpus:4]
+  - perf/test_perf.py::test_perf[llama_v3.3_70b_instruct_fp4-bench-pytorch-float4-maxbs:1024-maxnt:4096-kv_frac:0.85-input_output_len:1000,1000-reqs:1000-tp:4-gpus:4]
📜 Review details

Configuration used: Path: .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 e2b36c9 and d05abc4.

📒 Files selected for processing (3)
  • tests/integration/defs/perf/test_perf.py (2 hunks)
  • tests/integration/test_lists/qa/llm_perf_cluster.yml (2 hunks)
  • tests/integration/test_lists/qa/llm_perf_full.yml (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • tests/integration/defs/perf/test_perf.py
  • tests/integration/test_lists/qa/llm_perf_full.yml
🧰 Additional context used
🧠 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/test_lists/qa/llm_perf_cluster.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 (4)
tests/integration/test_lists/qa/llm_perf_cluster.yml (4)

78-78: Good addition; ensure KV cache metric thresholds cover this new heavy DeepSeek config.

You added kv_frac and a tougher workload; please confirm BENCH_PERF_METRIC_THRESHOLD includes sensible bounds for KV_CACHE_SIZE so this won’t flake due to expected KV growth.

Would you like a quick pass to calibrate thresholds based on recent runs?


80-80: Throughput config may exceed 120s; double-check stage runtime budget.

maxbs:1000 + maxnt:5000 + reqs:2000 across ep:4/tp:4 is substantial. Validate that TIMEOUT(120) matches recent median+3σ runtime on the target cluster.

I can generate a preflight script to surface the slowest 10 tests by historic runtime and adjust TIMEOUTs accordingly.


91-91: Very heavy 70B config; validate feasibility or reduce scope.

4096×20k with kv_frac:0.85 is borderline even on 4 GPUs. Either add tp:4 and lower reqs or move to the ≥8 GPU section to avoid frequent OOM/timeouts.

-  - perf/test_perf.py::test_perf[llama_v3.3_70b_instruct_fp4-bench-pytorch-float4-maxbs:4096-maxnt:20000-kv_frac:0.85-input_output_len:20000,2000-reqs:200-gpus:4] TIMEOUT(120)
+  - perf/test_perf.py::test_perf[llama_v3.3_70b_instruct_fp4-bench-pytorch-float4-maxbs:4096-maxnt:20000-kv_frac:0.85-input_output_len:20000,2000-reqs:100-tp:4-gpus:4] TIMEOUT(120)

If you prefer to keep reqs, consider promoting this to the ≥8 GPU block with tp:8.


94-96: LGTM on adding Scout variants; good spread of input lengths and reqs.

These look like sensible mid-scale 4-GPU perf points for KV cache validation.

@LarryXFly LarryXFly merged commit b845eb7 into NVIDIA:main Aug 26, 2025
3 checks passed
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.

2 participants