[None][chore] Refine AlltoAll benchmark scripts.#11649
Conversation
…t judgment. Add random seed to input. Signed-off-by: Bo Li <[email protected]>
Signed-off-by: Bo Li <[email protected]>
📝 WalkthroughWalkthroughIntroduces deterministic routing capability to the benchmark via a Changes
Sequence Diagram(s)sequenceDiagram
participant CLI as CLI / Main
participant MPI as MPI Pool
participant Worker as Worker Process
participant GPU as GPU Kernel
CLI->>CLI: parse_args (random_seed, perfect_router)
CLI->>MPI: spawn workers with _WORKER_ENV
MPI->>Worker: execute_benchmark_single
Worker->>Worker: seed RNG per rank
alt perfect_router enabled
Worker->>Worker: _make_inputs (deterministic schedule)
Note over Worker: Balance tokens across<br/>ranks & experts
else
Worker->>Worker: _make_inputs (random routing)
Note over Worker: Random expert selection
end
Worker->>GPU: dispatch kernel (hidden_states)
GPU-->>Worker: dispatch results
Worker->>GPU: combine kernel (outputs)
GPU-->>Worker: combine results
Worker->>Worker: _find_scope (categorize kernels)
Note over Worker: Containment-based<br/>scope detection
Worker->>MPI: allgather kernel timings
MPI->>Worker: merged per-rank data
Worker->>Worker: aggregate & sort timings
Worker-->>CLI: return benchmark metrics
CLI->>CLI: assemble output (dispatch/combine/other kernels)
CLI->>CLI: write JSON with per-rank breakdown
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
tests/microbenchmarks/bench_moe_comm.py (1)
651-653: Consider naming convention for module-level constant.Per the coding guidelines, global variables should use upper snake_case with prefix
G_(e.g.,G_WORKER_ENV). However, the leading underscore indicates this is module-private, which is also a valid Python convention. This is a minor stylistic point.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/microbenchmarks/bench_moe_comm.py` around lines 651 - 653, The module-level constant _WORKER_ENV should follow the project's naming convention for globals; rename _WORKER_ENV to G_WORKER_ENV and update every usage/reference in the module (e.g., any tests or functions that read _WORKER_ENV) to the new name, ensuring imports/exports and any module-private intent remain correct; keep the dictionary contents unchanged and run tests to verify no references were missed.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@tests/microbenchmarks/bench_moe_comm.py`:
- Line 887: The code calls os.makedirs(os.path.dirname(args.output_file),
exist_ok=True) which fails when args.output_file has no directory component;
update the logic to first compute dirpath = os.path.dirname(args.output_file)
and only call os.makedirs(dirpath, exist_ok=True) if dirpath is non-empty (e.g.,
if dirpath: os.makedirs(...)); reference args.output_file and the os.makedirs
call to locate the change.
---
Nitpick comments:
In `@tests/microbenchmarks/bench_moe_comm.py`:
- Around line 651-653: The module-level constant _WORKER_ENV should follow the
project's naming convention for globals; rename _WORKER_ENV to G_WORKER_ENV and
update every usage/reference in the module (e.g., any tests or functions that
read _WORKER_ENV) to the new name, ensuring imports/exports and any
module-private intent remain correct; keep the dictionary contents unchanged and
run tests to verify no references were missed.
Signed-off-by: Bo Li <[email protected]>
Signed-off-by: Bo Li <[email protected]>
Signed-off-by: Bo Li <[email protected]>
…beginning. Signed-off-by: Bo Li <[email protected]>
Signed-off-by: Bo Li <[email protected]>
…lose to timed iters. Signed-off-by: Bo Li <[email protected]>
Signed-off-by: Bo Li <[email protected]>
Signed-off-by: Bo Li <[email protected]>
|
/bot run --disable-fail-fast |
|
PR_Github #37892 [ run ] triggered by Bot. Commit: |
|
PR_Github #37892 [ run ] completed with state
|
Signed-off-by: Bo Li <[email protected]>
Signed-off-by: Bo Li <[email protected]>
Signed-off-by: Bo Li <[email protected]>
Signed-off-by: Bo Li <[email protected]>
|
/bot run --disable-fail-fast |
|
PR_Github #38465 [ run ] triggered by Bot. Commit: |
|
/bot kill |
Signed-off-by: Bo Li <[email protected]>
aef4d60 to
d3b9192
Compare
|
PR_Github #38467 [ kill ] triggered by Bot. Commit: |
Signed-off-by: Bo Li <[email protected]>
|
PR_Github #38465 [ run ] completed with state |
|
/bot run --disable-fail-fast |
|
PR_Github #38467 [ kill ] completed with state |
tburt-nv
left a comment
There was a problem hiding this comment.
Licenses look good
cxxfilt==0.3.0
BSD-2 license: https://github.com/afq984/python-cxxfilt/blob/v0.3.0/LICENSE
NVIDIA dependencies:
cuda-bindings==13.1.1
cuda-pathfinder==1.4.1
cupti-python==13.0.1
nvidia-cuda-cupti==13.1.115
Co-authored-by: tburt-nv <[email protected]> Signed-off-by: Bo Li <[email protected]>
|
/bot run --disable-fail-fast |
|
PR_Github #38469 [ run ] triggered by Bot. Commit: |
|
PR_Github #38471 [ run ] triggered by Bot. Commit: |
|
PR_Github #38469 [ run ] completed with state |
|
PR_Github #38471 [ run ] completed with state
|
|
/bot run --disable-fail-fast --reuse-test |
|
PR_Github #38532 [ run ] triggered by Bot. Commit: |
|
PR_Github #38532 [ run ] completed with state |
Signed-off-by: Bo Li <[email protected]>
Signed-off-by: Bo Li <[email protected]>
Summary by CodeRabbit
--perfect_routeroption for deterministic expert routing across ranks.--random_seedCLI argument to control reproducibility of inputs.Description
Test Coverage
PR Checklist
Please review the following before submitting your PR:
PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.
PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.
Test cases are provided for new code paths (see test instructions)
Any new dependencies have been scanned for license and vulnerabilities
CODEOWNERS updated if ownership changes
Documentation updated as needed
Update tava architecture diagram if there is a significant design change in PR.
The reviewers assigned automatically/manually are appropriate for the PR.
Please check this after reviewing the above items as appropriate for this PR.
GitHub Bot Help
/bot [-h] ['run', 'kill', 'skip', 'reuse-pipeline'] ...Provide a user friendly way for developers to interact with a Jenkins server.
Run
/bot [-h|--help]to print this help message.See details below for each supported subcommand.
Details
run [--reuse-test (optional)pipeline-id --disable-fail-fast --skip-test --stage-list "A10-PyTorch-1, xxx" --gpu-type "A30, H100_PCIe" --test-backend "pytorch, cpp" --add-multi-gpu-test --only-multi-gpu-test --disable-multi-gpu-test --post-merge --extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx" --detailed-log --debug(experimental)]Launch build/test pipelines. All previously running jobs will be killed.
--reuse-test (optional)pipeline-id(OPTIONAL) : Allow the new pipeline to reuse build artifacts and skip successful test stages from a specified pipeline or the last pipeline if no pipeline-id is indicated. If the Git commit ID has changed, this option will be always ignored. The DEFAULT behavior of the bot is to reuse build artifacts and successful test results from the last pipeline.--disable-reuse-test(OPTIONAL) : Explicitly prevent the pipeline from reusing build artifacts and skipping successful test stages from a previous pipeline. Ensure that all builds and tests are run regardless of previous successes.--disable-fail-fast(OPTIONAL) : Disable fail fast on build/tests/infra failures.--skip-test(OPTIONAL) : Skip all test stages, but still run build stages, package stages and sanity check stages. Note: Does NOT update GitHub check status.--stage-list "A10-PyTorch-1, xxx"(OPTIONAL) : Only run the specified test stages. Examples: "A10-PyTorch-1, xxx". Note: Does NOT update GitHub check status.--gpu-type "A30, H100_PCIe"(OPTIONAL) : Only run the test stages on the specified GPU types. Examples: "A30, H100_PCIe". Note: Does NOT update GitHub check status.--test-backend "pytorch, cpp"(OPTIONAL) : Skip test stages which don't match the specified backends. Only support [pytorch, cpp, tensorrt, triton]. Examples: "pytorch, cpp" (does not run test stages with tensorrt or triton backend). Note: Does NOT update GitHub pipeline status.--only-multi-gpu-test(OPTIONAL) : Only run the multi-GPU tests. Note: Does NOT update GitHub check status.--disable-multi-gpu-test(OPTIONAL) : Disable the multi-GPU tests. Note: Does NOT update GitHub check status.--add-multi-gpu-test(OPTIONAL) : Force run the multi-GPU tests in addition to running L0 pre-merge pipeline.--post-merge(OPTIONAL) : Run the L0 post-merge pipeline instead of the ordinary L0 pre-merge pipeline.--extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx"(OPTIONAL) : Run the ordinary L0 pre-merge pipeline and specified test stages. Examples: --extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx".--detailed-log(OPTIONAL) : Enable flushing out all logs to the Jenkins console. This will significantly increase the log volume and may slow down the job.--debug(OPTIONAL) : Experimental feature. Enable access to the CI container for debugging purpose. Note: Specify exactly one stage in thestage-listparameter 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.mdand the
scripts/test_to_stage_mapping.pyhelper.kill
killKill all running builds associated with pull request.
skip
skip --comment COMMENTSkip 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-pipelineReuse 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.