Skip to content

[FusedMoE] Ergo: gate-only ReLU² MXFP4 experts with per-expert output RMSNorm (H8192 I4096 E32 top8) - #30

Open
andyluo7 wants to merge 1 commit into
Inferact:mainfrom
andyluo7:pr-ergo-relu2-norm-experts
Open

andyluo7 wants to merge 1 commit into
Inferact:mainfrom
andyluo7:pr-ergo-relu2-norm-experts

Conversation

@andyluo7

@andyluo7 andyluo7 commented Dec 2, 2026

Copy link
Copy Markdown

Summary

A new FlyDSL kernel package, moe/mxfp4_relu2_norm_h8192_i4096_e32_top8. It holds the routed experts of one expert-parallel rank of Amazon Ergo: 256 experts, top 8, 32 local experts, H 8192, I 4096, MXFP4 weights.

Ergo's experts differ from the other MoE entries in two ways:

  • Gate-only ReLU² experts. There is no up projection: act = relu(x @ w1.T)^2.
  • Per-expert output RMSNorm. Each expert's output row is RMS-normalized with that expert's own scale before the weighted top-k sum.

What it does. Two launches: the sort, then GEMM1 + GEMM2 + combine.

  • GEMM1. MXFP8 activations x MXFP4 weights on the gfx950 scaled MFMA. ReLU² is computed in fp32, then requantized to MXFP8 in the epilogue.
  • GEMM2. Unweighted bf16 slots.
  • Combine. Normalizes each slot over its whole 8192-wide row (bf16(y * rsqrt(mean(y^2) + eps) * scale[e])). It then sums the 8 route-weighted slots in slot order, in fp32, with one rounding.

Weights and determinism. Weights are read in AITER's shuffle_weight_a16w4 / shuffle_scale_a16w4 layouts (gate_up=False), so a serving stack's AITER-shuffled MXFP4 tensors work without a copy. There are no output atomics, and runs are bitwise repeatable.

Origin. Adapted from moe/mxfp4_h5120_i2304_e48_top6. Changes: gate-only GEMM1 with ReLU², an unweighted GEMM2, and the normalizing combine. The tile table is swept per token count (sweep_dispatch.py).

Performance

Setup: one MI350X, one TP8 + EP8 rank (about one route in eight is local), bf16 tokens, graph replay, median µs per call.

T tokens 1 8 16 64 128 256 448 576 1024
uniform 31.7 58.4 78.2 182.2 198.9 211.4 231.2 246.7 292.0
skewed 14.0 44.8 50.0 133.4 172.5 245.8 224.4 248.8 288.7

From T 64, most of the 1 GB of local expert weights is read once per call, so the kernel is bound by the HBM weight stream.

End to end. In vLLM (Ergo on 8x MI350X, TP8 + EP8, DSpark speculative decoding) this entry replaces the ROCm MoE path's per-route stages and the separate per-expert-norm finalize. Output throughput went up 7–13% at 1 to 256 concurrent requests, and GSM8K stayed at 97.5%.

Tests

python3 -m pytest tests/moe/mxfp4_relu2_norm_h8192_i4096_e32_top8 -q
python3 benchmarks/moe/mxfp4_relu2_norm_h8192_i4096_e32_top8/benchmark_experts.py
python3 benchmarks/moe/mxfp4_relu2_norm_h8192_i4096_e32_top8/sweep_dispatch.py

The tests check the following on MI350X:

  • GEMM1 against the reference.
  • The experts at every dispatch tier, with uniform, skewed and all-local routing: cosine >= 0.99999, and two runs are bitwise equal.
  • The slots and the combine, bf16 input, and tokens with no local route, which must give exact zeros.
  • The entry's first call with an out= buffer (as vLLM calls it): it warms up every tier and nothing compiles afterwards.

A follow-up PR adds the fused expert-parallel layer for the same experts. It uses this entry as its staged baseline.

🤖 Generated with Claude Code

…192 I4096 E32 top8

`moe/mxfp4_relu2_norm_h8192_i4096_e32_top8`: one expert-parallel rank's routed
experts of Amazon Ergo (256 experts, top 8, 32 local): MXFP8 x MXFP4 gate-only
GEMM1 with ReLU² and MXFP8 requant in the epilogue, an unweighted GEMM2, and a
combine that RMS-normalizes each slot with its expert's scale before the
route-weighted sum in slot order. One launch after the sort; no output
atomics. Adapted from moe/mxfp4_h5120_i2304_e48_top6.

Co-Authored-By: Claude <noreply@anthropic.com>
andyluo7 added a commit to andyluo7/ergo that referenced this pull request Dec 2, 2026
- Dockerfile: amd-kernels at 1a3889b (andyluo7/amd-kernels pr-ergo-fused-ep,
  Inferact/amd-kernels#30 and #31), with the fused EP tile table swept for
  Ergo's shapes.
- DP8+EP8 with FUSED_EP=1: 186 / 5,627 / 12,432 / 17,459 tok/s at
  1 / 64 / 256 / 512 concurrent requests (+5-7% from 64 over the previous
  tiles), GSM8K 97.6%.

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant