Skip to content

[Triton] [ATOM] MXFP8 GEMM and A8W4 MOE optimization - #3292

Merged
k50112113 merged 35 commits into
mainfrom
shaoclee/alizaidy-dsv4-moe
Jun 3, 2026
Merged

k50112113 merged 35 commits into
mainfrom
shaoclee/alizaidy-dsv4-moe

Conversation

@k50112113

@k50112113 k50112113 commented May 20, 2026 •

Copy link
Copy Markdown
Contributor

This PR is co-authored by @azaidy and @k50112113

This PR includes:

  1. Added MXFP8 GEMM (non-shuffled and pre-shuffled), tunned with DSV4 shapes
  2. Added all other mxfp8 GEMM related kernels, including: dynamic_mxfp8_quant, fused_rms_mxfp8_quant, fused_dual_rms_mxfp8_quant, fused_flatten_mxfp8_quant.
  3. A8W4 MOE fused with activation and downcast between the 2 MOEs
  4. Optimized Topk and routing for the A8W4 MOE
  5. Fix fused_flatten_fp8_group_qaunt bug when N is not power of 2

@k50112113
k50112113 requested review from a team and azaidy May 20, 2026 21:39
@github-actions

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:triton-300x Run an additional Triton test job on MI300X in PRs; main branch always runs both MI35X and MI300X
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 3292 --add-label <label>

k50112113 added 5 commits May 21, 2026 10:22
* add fused_gemm_a16w16_copy_x, remove near-moe torch.to and torch.zeros kernels

* tunning

* revert fill(0) change
@k50112113
k50112113 force-pushed the shaoclee/alizaidy-dsv4-moe branch from bbaece4 to 7a0832e Compare May 21, 2026 16:01
@k50112113 k50112113 changed the title [Triton] [ATOM] A8W4 MOE and topk routing [Triton] [ATOM] MXFP8 GEMM and A8W4 MOE optimization May 21, 2026
cagrikymk
cagrikymk previously approved these changes May 26, 2026

@brunomazzottiamd brunomazzottiamd 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.

Shao, I'm publishing a partial review. I still need to check the kernels in aiter/ops/triton/_triton_kernels and the tests in op_tests/triton_tests. I've just checked the wrappers and the config files. I can review the rest tomorrow.

Comment thread aiter/ops/triton/moe/reduce.py Resolved
lburzawa
lburzawa previously approved these changes Jun 2, 2026

@brunomazzottiamd brunomazzottiamd 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.

Shao, I can't see anything wrong with this PR. Furthermore, I trust Lukasz a lot and he approved the PR!

However, I have some minor requests for you:

  • Standardize tl.dot form to acc = tl.dot(..., acc=acc).
  • Reason about fp16 test cases: Do we really need them or is it fine to keep just bf16 cases?
  • Try to avoid CPU assertions in unit tests, if possible.

I've left other comments as well, but I think they aren't blockers for merging. Address them at your own judgement.

@brunomazzottiamd brunomazzottiamd 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.

Approved! The comments from my previous review (#3292 (review)) should be addressed in a new PR.

@k50112113
k50112113 merged commit 5228838 into main Jun 3, 2026
62 checks passed
@k50112113
k50112113 deleted the shaoclee/alizaidy-dsv4-moe branch June 3, 2026 14:59
zhanglx13 added a commit that referenced this pull request Oct 2, 2026
…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.
azaidy pushed a commit that referenced this pull request Oct 5, 2026
…mm_a8w8_blockscale (#6071)

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

4 participants