Repository navigation
[Triton/Gluon] : (MoE) Add RotatingBufferBench support - #6728
Conversation
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: |
There was a problem hiding this comment.
🟡 Changes recommended
Parser conflicts break existing benchmarks, and cache-rotation and total-measurement issues undermine the reported timings.
8 open issues
Include cross-rank combine in multi-GPU timing · New Correct and shorten MX8 requantization docstring · New Preserve dependent MLP dataflow in total timing · New Correct and shorten SmoothQuant requantization docstring · New Duplicate --backend argument registration · New Size cache pool from accessed expert weights · New Release sizing sample before pool allocation · New Capture complete pool rotations for requested cache size · New
What changed in this PR
This PR moves AITER’s MoE benchmarks to rotating input buffers and graph replay to reduce cache bias and CPU launch overhead.
Changes:
- Add shared buffer-pool and graph-timing helpers.
- Migrate MoE benchmarks to the new timing method.
- Update per-layer reports and benchmark arguments.
| File | Description |
|---|---|
op_tests/op_benchmarks/triton/utils/benchmark_utils.py |
Add rotating pools and graph timing. |
op_tests/op_benchmarks/triton/utils/argparse.py |
Add backend selection and argument overrides. |
op_tests/op_benchmarks/triton/bench_moe_wgrad.py |
Rotate gradients and inputs with fixed routing. |
op_tests/op_benchmarks/triton/bench_moe_situ_epilogue.py |
Use rotating-buffer graph timing. |
op_tests/op_benchmarks/triton/bench_moe_gemm_int8_smoothquant.py |
Add rotating inputs and per-layer reports. |
op_tests/op_benchmarks/triton/bench_moe_gemm_a8w8.py |
Migrate FP8/MXFP8 projection measurements. |
op_tests/op_benchmarks/triton/bench_moe_gemm_a8w8_blockscale.py |
Migrate blockscale projection measurements. |
op_tests/op_benchmarks/triton/bench_moe_gemm_a8w4_cudagraph.py |
Replace repeated weight-init runs with pools. |
op_tests/op_benchmarks/triton/bench_moe_gemm_a4w4_cudagraph.py |
Migrate single- and multi-GPU timing. |
op_tests/op_benchmarks/triton/bench_moe_gemm_a16w4.py |
Add rotating inputs and per-layer reports. |
Review effort: Balanced
8703243 to
4c5f007
Compare
4c5f007 to
c1e2321
Compare
c1e2321 to
52a9dff
Compare
WAITING ON AUTHORPR Self-ReviewRevision Waiting for the PR author. The readiness report will appear after the self-review answers are complete for this revision. Questions to answer in the PR description
Edit the Missing or invalid answers
Shadow mode reports what would block but keeps the status successful. Set |
Boss2002n
left a comment
There was a problem hiding this comment.
The move to RotatingBufferBench and the new cudagraph MoE benchmarks are good, but a few things must change before merge.
Must fix before merge
- The topk benchmark is gone (
bench_topk.py:1-14): the file is now a copy ofbench_moe_situ_epilogue.py, so no benchmark runs the Tritontopkop. Fix: restore it from main, then move its timing. - The MoE GEMM pools do not rotate (
bench_moe_gemm_a8w8_cudagraph.py:455-462): with the default--num-weight-inits 1, all 1000 calls read the same weights, and M=1 latencies are 15–33% lower than with 8 weight sets. Fix: size the pool from the bytes that one call reads. - The smoke test fails for the four new scripts (
bench_moe_gemm_a8w8_cudagraph.py:608-630): they need--shapeand--experts, but_CUSTOM_ARGShas no entry for them, so each one exits with code 2. Fix: add them with_MOE_SHAPE_ARGS.
Nice to fix
- Scatter in a16w4 layer 2, as the other five MoE benchmarks do, and name the blockscale log folder after the op (
bench_moe_gemm_a16w4_cudagraph.py:364-385). - Keep the pinned-expert check in a8w4, and check
ep >= 1before the division in a4w4 (bench_moe_gemm_a8w4_cudagraph.py:367). - Keep one input set for SonicMoE, which still times with
do_bench(bench_sonicmoe.py:64-71). - Get the scale layout from
shuffle_scale_moe(..., return_layout=True)(bench_moe_gemm_a8w8_cudagraph.py:175-188), and letgemm_a16w16load its own config (bench_moe_gemm_a8w8_blockscale_cudagraph.py:292-300). - Put the copied
compute_roofline,_both_fnandfp8_dtypein one module inutils/(bench_moe_gemm_a8w8_cudagraph.py:90-172). - Delete the unused
--repoption (bench_moe_gemm_a8w8_cudagraph.py:657-663), and cut the docstrings to one or two true sentences (:232-237). - Answer the eight Copilot comments; the one on
total, which gives GEMM2 a setup-time input, still holds in the four new files.
Merge order
Merge #7121 first, then rebase so that 83cf2b96 drops out; merged first, this PR breaks 35 benchmarks at import.
52a9dff to
831e5f7
Compare
|
Hi guys. Do you still see any blockers on this PR? Do you have a ETA for merging it? Thanks! FYI: @rahulbatra85 + @Boss2002n |
- pre-checks.yaml: pin black to 26.10.1 (the version that psf/black@stable installs now) with the action `version` input. - pre-checks.yaml: replace the deprecated -fail-on-error with -fail-level=any. For the github-check reporter (push to main), -fail-on-error maps to error level, and ruff reports every finding as WARNING, so the job never failed on main. - aiter/aot/flydsl/gemm.py: restore mode 100755 (lost in ROCm#7439). The file has a shebang, and ruff EXE001 reports it on main. - bench_models.py: fix ruff I001 (import order). ROCm#6728 added the bench_moe_gemm_a4w4 and bench_moe_gemm_a8w4 modules, so ruff now sorts their imports as first-party. Move only these 6 lines (ruff autofix). - CONTRIBUTE.md: install the CI versions (black 26.10.1, ruff 0.16.0). Refs ROCm#4423
- pre-checks.yaml: pin black to 26.10.1 (the version that psf/black@stable installs now) with the action `version` input. - pre-checks.yaml: replace the deprecated -fail-on-error with -fail-level=any. For the github-check reporter (push to main), -fail-on-error maps to error level, and ruff reports every finding as WARNING, so the job never failed on main. - aiter/aot/flydsl/gemm.py: restore mode 100755 (lost in #7439). The file has a shebang, and ruff EXE001 reports it on main. - bench_models.py: fix ruff I001 (import order). #6728 added the bench_moe_gemm_a4w4 and bench_moe_gemm_a8w4 modules, so ruff now sorts their imports as first-party. Move only these 6 lines (ruff autofix). - CONTRIBUTE.md: install the CI versions (black 26.10.1, ruff 0.16.0). Refs #4423

Motivation
triton.testing.do_bench approximates this by flushing L2 before each run. However, the flush can’t be placed inside a captured graph without being timed along with the kernel, and it adds gaps between launches. Rotating buffers avoid both problems.
Technical Details
Use rotating buffers and do_bench_aiter_triton() functions for MoE benchmarks