Skip to content

[Triton/Gluon] [Bench] Fix bench_moe_gemm_int8_smoothquant and bench_moe_gemm_a8w8_blockscale - #6071

Merged
azaidy merged 1 commit into
mainfrom
fix/moe-bench-int8-smoothquant-a8w8-blockscale
Oct 5, 2026
Merged

azaidy merged 1 commit into
mainfrom
fix/moe-bench-int8-smoothquant-a8w8-blockscale

Conversation

@zhanglx13

@zhanglx13 zhanglx13 commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

Two Triton MoE benchmarks crash on current main before they print any result:

Benchmark Error
bench_moe_gemm_int8_smoothquant.py TypeError: moe_gemm_int8_smoothquant() got an unexpected keyword argument 'add_residual'
bench_moe_gemm_a8w8_blockscale.py AssertionError: Activations (x) must be fp16 or bf16, got torch.float32

We found them in a weekly gfx950 Triton perf run, where both failed on every Triton wheel tested.

Technical Details

  • int8_smoothquant: [Triton] [ATOM] MXFP8 GEMM and A8W4 MOE optimization #3292 ("MXFP8 GEMM and A8W4 MOE optimization") renamed the add_residual argument of moe_gemm_int8_smoothquant to swiglu_add_residual, but the bench still passes add_residual=False in two calls. The flag means the same thing under both names: when set, SwiGLU returns s * (linear + 1) instead of s * linear. Rename the keyword.
  • a8w8_blockscale: the bench builds the routing GEMM inputs in fp32: xg = x.to(torch.float32), and wg with the default dtype. It passes them to gemm_a16w16, which asserts fp16/bf16 activations and weights since [Triton/Gluon] bf16 persistent gemm #4860. Build both in bf16, as bench_moe_gemm_a8w8.py and bench_moe_gemm_int8_smoothquant.py already do. bg stays 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 main at aaafddd and a Triton main wheel (triton-lang/triton@dd7167259f), using the arguments from the weekly run:

python3 bench_moe_gemm_int8_smoothquant.py --shape 7168 4096 --experts 256 8
python3 bench_moe_gemm_a8w8_blockscale.py  --shape 7168 4096 --experts 256 8 --M 1 2 4 8 16 32 64 128

Lint: ruff==0.16.0 check and black --check on both files.

Test Result

  • Before: both fail with the errors above.
  • After: both run to completion. int8_smoothquant covers batch 1–8192, a8w8_blockscale batch 1–128.
  • Lint: ruff and black pass.

--M caps 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.

@zhanglx13
zhanglx13 requested review from a team and a balanced review from Copilot October 2, 2026 00:09
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@github-actions github-actions Bot changed the title [Triton] [Bench] Fix bench_moe_gemm_int8_smoothquant and bench_moe_gemm_a8w8_blockscale [Triton/Gluon] [Bench] Fix bench_moe_gemm_int8_smoothquant and bench_moe_gemm_a8w8_blockscale Oct 2, 2026
@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

  • ✅ Pre-checks (submodule verification, code formatting)
  • ✅ Aiter op tests (gfx942 + gfx950)
  • ✅ Triton tests on MI35X (only when aiter/ops/triton/** or related paths are changed)

Extended tests (opt-in via labels):

Label Tests
ci:gfx1250-ffm-triton Run the five-shard gfx1250 FFM Triton test suite
ci:triton-300x Run an additional Triton test job on MI300X in PRs (added automatically when gfx942 configs change); main branch always runs both MI35X and MI300X
ci:triton-355 Run the full Triton test suite on MI35X, not only the tests the change affects
multigpu Aiter multi-GPU tests on the 8-GPU runner
ci:sglang SGLang integration tests: DeepSeek-R1-MXFP4 accuracy, Qwen 3.5 accuracy
ci:atom ATOM benchmark: DeepSeek-R1-0528, GPT-OSS-120B
ci:atom_full ATOM accuracy suite for PR and main models from ATOM models_accuracy.json
ci:vllm vLLM benchmark: GPT-OSS-120B, DeepSeek-R1-0528, Kimi-K2.5
ci:all All standard extended tests (excludes ci:atom_full)

Only add ci:atom_full for FlyDSL or Triton upgrades.
Add labels via the sidebar or gh pr edit 6071 --add-label <label>

One backend per PR:
A PR changes one kernel backend: [Triton/Gluon] (Triton and Gluon count as one), [HIP], [ASM], [CK], [OPUS] or [FlyDSL]. If the title ends up with two backend tags, split the PR -- as stacked pull requests when one part cannot merge without the other.

PR title tags & labels:
Component tags ([Triton/Gluon], [HIP], [CK], [ASM], ...) are added to the PR title and as PR labels automatically from the changed files and re-synced on every push — change-type tags like [fix]/[Perf], op tags like [MLA], and human labels (ci:*) are left untouched. Add the no-auto-title label to stop the title rewrites; labels stay in sync either way.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.
@zhanglx13
zhanglx13 force-pushed the fix/moe-bench-int8-smoothquant-a8w8-blockscale branch from c480a4e to a821a6d Compare October 2, 2026 00:23
@zufayu
zufayu requested review from a team and azaidy October 2, 2026 00:32

@azaidy azaidy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!

@azaidy
azaidy merged commit aed3058 into main Oct 5, 2026
@azaidy
azaidy deleted the fix/moe-bench-int8-smoothquant-a8w8-blockscale branch October 5, 2026 22:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants