[https://nvbugs/6127669][fix] Fix layer-wise benchmarks performance alignment test#16212
[https://nvbugs/6127669][fix] Fix layer-wise benchmarks performance alignment test#16212kaiyux wants to merge 3 commits into
Conversation
📝 WalkthroughWalkthroughLayer-wise profiling now uses explicit iteration windows, updated CUDA Graph tracing commands, aligned replay parameters, and corrected calibration shutdown ordering. ChangesLayer-wise profiling alignment
Estimated code review effort: 3 (Moderate) | ~25 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
examples/layer_wise_benchmarks/README.md (1)
310-324: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winAlign the documented KV-cache length with the replay window.
For the documented
--batch-size 32and replay range,sample_performance_alignment.sh:128computes2048 + 32 + 22 = 2102, while the README still says2090. Following these instructions produces a mismatched replay past length.Proposed fix
- --seq-len-kv-cache 2090 \ + --seq-len-kv-cache 2102 \🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@examples/layer_wise_benchmarks/README.md` around lines 310 - 324, Update the `--seq-len-kv-cache` argument explanation in the benchmark README from 2090 to 2102, matching the replay window calculation for batch size 32 described by `sample_performance_alignment.sh`.examples/layer_wise_benchmarks/sample_performance_alignment.sh (1)
1-3: 🔒 Security & Privacy | 🟡 Minor | ⚡ Quick winAdd the required NVIDIA license header.
This modified shell source has no NVIDIA Apache-2.0 copyright header. Keep the shebang first and add the standard 2026 header immediately after it.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@examples/layer_wise_benchmarks/sample_performance_alignment.sh` around lines 1 - 3, Add the standard NVIDIA Apache-2.0 copyright and license header immediately after the shebang in the shell script, preserving the shebang as the first line and keeping set -euo pipefail unchanged.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@examples/layer_wise_benchmarks/README.md`:
- Around line 310-324: Update the `--seq-len-kv-cache` argument explanation in
the benchmark README from 2090 to 2102, matching the replay window calculation
for batch size 32 described by `sample_performance_alignment.sh`.
In `@examples/layer_wise_benchmarks/sample_performance_alignment.sh`:
- Around line 1-3: Add the standard NVIDIA Apache-2.0 copyright and license
header immediately after the shebang in the shell script, preserving the shebang
as the first line and keeping set -euo pipefail unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: b0adf1ed-fcb7-496e-9c58-026ab44879d8
📒 Files selected for processing (5)
examples/layer_wise_benchmarks/README.mdexamples/layer_wise_benchmarks/parse_e2e.pyexamples/layer_wise_benchmarks/sample_performance_alignment.shtensorrt_llm/_torch/pyexecutor/py_executor.pytests/integration/test_lists/waives.txt
💤 Files with no reviewable changes (1)
- tests/integration/test_lists/waives.txt
…lignment test The test has been waived since it started failing on the B200 CI pool; several independent problems stacked up: - Recent nsys exports kernels launched by CUDA graphs that were instantiated before the capture range opened without runtime correlation (correlationId 0), which drops them from parse_e2e.py's RUNTIME join. The engine captures its CUDA graphs during warmup, before any "-c cudaProfilerApi" range can open, so trace the whole benchmark process instead and give parse_e2e.py explicit --start-iter/--stop-iter bounds for the analyzed window. - Draining the in-flight batch through progressively smaller CUDA graph batch sizes with nsys attached wedges the device stream: the executor hangs in SamplerEvent.synchronize() until the CI timeout kills the test. Size max_num_tokens so that all requests prefill (and therefore finish) at the same iteration; this removes the drain phase and also matches the steady-state assumption of the correlation methodology. - The replay window was off by one: the calibrator collects the TLLM_PROFILE_START_STOP iterations [start, stop), but Step 3 replayed up to the stop iteration, raising KeyError once the earlier steps were fixed. - The "[Executor] _forward_step" NVTX text gained a "ctx tokens" field (NVIDIA#14206) that parse_e2e.py's regex did not accept. - In PyExecutor, persist calibration data and synchronize before cudaProfilerStop(), so profiling tools that stop collecting or end the process when the capture range closes cannot lose the calibration file or end the capture with in-flight async copies. Verified on B200 (single GPU): sample_performance_alignment.sh completes all five steps, and test_performance_alignment[1] passes; remove its waive. Signed-off-by: Kaiyu Xie <26294424+kaiyux@users.noreply.github.com>
…U tests The failures no longer reproduce on the 26.04 stack. Verified on B200 (single GPU): - test_nemotron_gen_dep[1] (https://nvbugs/6162541): passes in 226 s. - test_qwen3_next_gen_tep[1] (https://nvbugs/6153575, split off as https://nvbugs/6250535): passes in 62 s. - test_deepseek_r1_ctx_dep[1] (https://nvbugs/6162541): the benchmark and parser pass when invoked directly. The pytest case itself stays skipped in-code until https://nvbugs/6337228 is resolved, so removing the waive is a no-op for CI today but lets the test run as soon as that skip is lifted. Signed-off-by: Kaiyu Xie <26294424+kaiyux@users.noreply.github.com>
Signed-off-by: Kaiyu Xie <26294424+kaiyux@users.noreply.github.com>
7e07ae9 to
0550083
Compare
|
@Tabrizian Since this touches the changes in #13744, can you help take a look? |
|
/bot run --disable-fail-fast |
|
PR_Github #58608 [ run ] triggered by Bot. Commit: |
Description
Fixes
unittest/tools/test_layer_wise_benchmarks.py::test_performance_alignment[1](https://nvbugs/6127669) and removes the stale waives of the other single-GPU layer-wise benchmark tests (https://nvbugs/6162541, https://nvbugs/6153575).test_performance_alignment[1]had several independent problems that stacked up on the 26.04 CI stack:SamplerEvent.synchronize()until the CI timeout kills the test (reproduced deterministically on B200 at the first batch-4 graph replay; the same workload passes without nsys).sample_performance_alignment.shnow sizesmax_num_tokensso that all requests prefill — and therefore finish — at the same iteration. This removes the drain phase entirely and also matches the steady-state batch assumption of the correlation methodology.correlationId = 0), soparse_e2e.py'sCUPTI_ACTIVITY_KIND_RUNTIMEjoin dropped all graph kernels (10 kernels/iter seen instead of ~915). The engine captures its CUDA graphs during warmup, before any-c cudaProfilerApicapture range can open, so Steps 1–2 now trace the whole benchmark process, andparse_e2e.pygets explicit--start-iter/--stop-iterbounds to select the analyzed window.TLLM_PROFILE_START_STOPiterations[start, stop), but Step 3 replayed up to the stop iteration, raisingKeyErroronce the earlier steps were fixed.[Executor] _forward_stepNVTX text gained a "ctx tokens" field ([None][chore] log KV cache utilization and context tokens per iter #14206) thatparse_e2e.py's regex did not accept; the segment is now matched optionally so both old and new traces parse.PyExecutor. Calibration data is now persisted and the device synchronized beforecudaProfilerStop(), so profiling tools that stop collecting (or end the process, e.g. nsys--capture-range-end=stop-shutdown) at the range close cannot lose the calibration file or end the capture with in-flight async copies.The waives of
test_nemotron_gen_dep[1],test_qwen3_next_gen_tep[1], andtest_deepseek_r1_ctx_dep[1]are removed as stale: the underlying failures no longer reproduce on the 26.04 stack.test_deepseek_r1_ctx_dep[1]remains skipped in-code pending https://nvbugs/6337228 (see #15497), so its waive removal is a no-op for CI today but lets the test run as soon as that skip is lifted.Test Coverage
Verified on B200 (single GPU) with the current CI container image:
unittest/tools/test_layer_wise_benchmarks.py::test_performance_alignment[1]passes in 281 s (previously hit the 2400 s timeout).unittest/tools/test_layer_wise_benchmarks.py::test_nemotron_gen_dep[1]passes in 226 s.unittest/tools/test_layer_wise_benchmarks.py::test_qwen3_next_gen_tep[1]passes in 62 s.test_deepseek_r1_ctx_dep[1]benchmark and parser pass when invoked directly (the pytest case is skipped in-code, see above).sample_performance_alignment.shcompletes all five steps end to end, includingparse_e2e.pyandcorrelation.py.PR Checklist
Please review the following before submitting your PR:
PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.
PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.
Test cases are provided for new code paths (see test instructions)
If PR introduces API changes, an appropriate PR label is added - either
api-compatibleorapi-breaking. Forapi-breaking, includeBREAKINGin the PR title.Any new dependencies have been scanned for license and vulnerabilities
CODEOWNERS updated if ownership changes
Documentation updated as needed
Update tava architecture diagram if there is a significant design change in PR.
The reviewers assigned automatically/manually are appropriate for the PR.
Please check this after reviewing the above items as appropriate for this PR.
GitHub Bot Help
To see a list of available CI bot commands, please comment
/bot help.🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Documentation
Tests