Repository navigation
[Triton/Gluon] [Bench] Fix bench_moe_gemm_int8_smoothquant and bench_moe_gemm_a8w8_blockscale - #6071
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
🏷️ 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.
Copilot review overview
🟢 Approval recommended
The focused benchmark fixes match the current operator signatures and dtype requirements.
Review effort: Balanced
Findings: None
What changed in this PR
Fixes two Triton MoE benchmarks to match current operator contracts.
Changes:
- Updates the renamed SwiGLU residual keyword.
- Uses BF16 routing inputs accepted by
gemm_a16w16.
| File | Description |
|---|---|
bench_moe_gemm_int8_smoothquant.py |
Uses swiglu_add_residual. |
bench_moe_gemm_a8w8_blockscale.py |
Creates routing activations and weights in BF16. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…mm_a8w8_blockscale Both benchmarks crash before printing a single result on current main. bench_moe_gemm_int8_smoothquant passes add_residual=False to moe_gemm_int8_smoothquant, but the MXFP8 GEMM and A8W4 MoE optimization (#3292) renamed that argument to swiglu_add_residual. The meaning is unchanged: both compute s * (linear + 1) when set. The call now fails with "unexpected keyword argument 'add_residual'". bench_moe_gemm_a8w8_blockscale builds the routing GEMM inputs in fp32 (xg = x.to(torch.float32), and wg with the default dtype) and passes them to gemm_a16w16. Since #4860, gemm_a16w16 asserts fp16/bf16 activations and weights. Build both in bf16, as bench_moe_gemm_a8w8 and bench_moe_gemm_int8_smoothquant already do.
c480a4e to
a821a6d
Compare
Motivation
Two Triton MoE benchmarks crash on current
mainbefore they print any result:bench_moe_gemm_int8_smoothquant.pyTypeError: moe_gemm_int8_smoothquant() got an unexpected keyword argument 'add_residual'bench_moe_gemm_a8w8_blockscale.pyAssertionError: Activations (x) must be fp16 or bf16, got torch.float32We found them in a weekly gfx950 Triton perf run, where both failed on every Triton wheel tested.
Technical Details
add_residualargument ofmoe_gemm_int8_smoothquanttoswiglu_add_residual, but the bench still passesadd_residual=Falsein two calls. The flag means the same thing under both names: when set, SwiGLU returnss * (linear + 1)instead ofs * linear. Rename the keyword.xg = x.to(torch.float32), andwgwith the default dtype. It passes them togemm_a16w16, which asserts fp16/bf16 activations and weights since [Triton/Gluon] bf16 persistent gemm #4860. Build both in bf16, asbench_moe_gemm_a8w8.pyandbench_moe_gemm_int8_smoothquant.pyalready do.bgstays fp32, as in those benches.Only the routing logits change. The benchmarked MoE GEMMs and their inputs are untouched.
Test Plan
On MI350X (gfx950), with
mainat aaafddd and a Triton main wheel (triton-lang/triton@dd7167259f), using the arguments from the weekly run:Lint:
ruff==0.16.0 checkandblack --checkon both files.Test Result
--Mcaps the blockscale sweep at 128 because larger batches hit an unrelated LDS out-of-resources error in its tuned gfx950 config. That issue is not changed here.