Repository navigation
[FlyDSL] [CI] [MoE] Enable AITER_FLYDSL_USE_HERD on gfx1250 and add a fused HERD selector for GPT-OSS - #6527
Conversation
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: |
|
Use command like |
…-kernel, dropping the per-call bias cast and standalone quant for GPT-OSS.
…d GEMM and decouple bias from the fused requant.
Fused drop (AITER_HERD_FUSED_DROP=1) runs in the gfx1250 grouped MoE route and prefix-sum kernel: one launch counts K+1 candidate popularity, drops the least popular candidate per token, renormalizes the kept K with the routed scaling factor, and writes topids_to_rows, psum and the gather weights. Router drop (AITER_HERD_FUSED_DROP=0) reuses the standalone finalize kernel and then takes the ordinary grouped MoE path.
dbb5795 to
82cc300
Compare
# Conflicts: # aiter/ops/flydsl/grouped_gemm_mxfp4.py # aiter/ops/flydsl/kernels/mxfp4_preshuffle_gfx1250_tdm.py # aiter/ops/topk.py
A4W4 and A8W4 rows for GPT-OSS TP1 (model_dim=3072, inter_dim=3072, E=128, K=4) on gfx1250, tokens 16..32768, taken from dev/yadai_gptoss_mi450_tuning (e74d504).
…nter The router now routes pad rows to expert -1 (num_valid_rows), and on the gfx1250 grouped TP path those ids reach moe_route unchanged. It indexed the per-expert counter through a raw pointer, so every -1 route did an atomic add on the int32 just before the counter allocation. The route now takes DROPPED_ROUTE_ROW instead, which the psum remap, the route-indexed quant and gather-reduce already skip. A test guards the counter with one extra leading element: before the fix it read 384 after a batch of 64 pad rows at top-6, now 0.
… fused HERD selector for GPT-OSS (#6527) * [FlyDSL][MoE] Support selectable router and fused HERD drop paths on gfx950 * [MoE] Update the fused_moe signature test for the HERD parameters * [FlyDSL][MoE] Fuse biased gfx1250 GEMM1 requant and read fp32 bias in-kernel, dropping the per-call bias cast and standalone quant for GPT-OSS. * [FlyDSL][MoE] Read bf16/fp32/fp16 bias natively in the gfx1250 grouped GEMM and decouple bias from the fused requant. * [FlyDSL][MoE] Support router and fused HERD drop paths on gfx1250 Fused drop (AITER_HERD_FUSED_DROP=1) runs in the gfx1250 grouped MoE route and prefix-sum kernel: one launch counts K+1 candidate popularity, drops the least popular candidate per token, renormalizes the kept K with the routed scaling factor, and writes topids_to_rows, psum and the gather weights. Router drop (AITER_HERD_FUSED_DROP=0) reuses the standalone finalize kernel and then takes the ordinary grouped MoE path. * [MoE][gfx1250] Add GPT-OSS gfx1250 tuned grouped MoE configs A4W4 and A8W4 rows for GPT-OSS TP1 (model_dim=3072, inter_dim=3072, E=128, K=4) on gfx1250, tokens 16..32768, taken from dev/yadai_gptoss_mi450_tuning (e74d504). * Fix gfx1250 MoE bias and constrain fused HERD routing * Keep original gfx1250 MoE bias epilogues * Delete docs/herd_pr_review_response.md * Keep automatic HERD topk routing on gfx950 * [FlyDSL][MoE] Keep -1 routes out of the gfx1250 TP route kernel's counter The router now routes pad rows to expert -1 (num_valid_rows), and on the gfx1250 grouped TP path those ids reach moe_route unchanged. It indexed the per-expert counter through a raw pointer, so every -1 route did an atomic add on the int32 just before the counter allocation. The route now takes DROPPED_ROUTE_ROW instead, which the psum remap, the route-indexed quant and gather-reduce already skip. A test guards the counter with one extra leading element: before the fix it read 384 after a batch of 64 pad rows at top-6, now 0. * [FlyDSL][MoE] Support ATOM valid token counts in HERD --------- Co-authored-by: yadaish <[email protected]>
… fused HERD selector for GPT-OSS (ROCm#6527) * [FlyDSL][MoE] Support selectable router and fused HERD drop paths on gfx950 * [MoE] Update the fused_moe signature test for the HERD parameters * [FlyDSL][MoE] Fuse biased gfx1250 GEMM1 requant and read fp32 bias in-kernel, dropping the per-call bias cast and standalone quant for GPT-OSS. * [FlyDSL][MoE] Read bf16/fp32/fp16 bias natively in the gfx1250 grouped GEMM and decouple bias from the fused requant. * [FlyDSL][MoE] Support router and fused HERD drop paths on gfx1250 Fused drop (AITER_HERD_FUSED_DROP=1) runs in the gfx1250 grouped MoE route and prefix-sum kernel: one launch counts K+1 candidate popularity, drops the least popular candidate per token, renormalizes the kept K with the routed scaling factor, and writes topids_to_rows, psum and the gather weights. Router drop (AITER_HERD_FUSED_DROP=0) reuses the standalone finalize kernel and then takes the ordinary grouped MoE path. * [MoE][gfx1250] Add GPT-OSS gfx1250 tuned grouped MoE configs A4W4 and A8W4 rows for GPT-OSS TP1 (model_dim=3072, inter_dim=3072, E=128, K=4) on gfx1250, tokens 16..32768, taken from dev/yadai_gptoss_mi450_tuning (e74d504). * Fix gfx1250 MoE bias and constrain fused HERD routing * Keep original gfx1250 MoE bias epilogues * Delete docs/herd_pr_review_response.md * Keep automatic HERD topk routing on gfx950 * [FlyDSL][MoE] Keep -1 routes out of the gfx1250 TP route kernel's counter The router now routes pad rows to expert -1 (num_valid_rows), and on the gfx1250 grouped TP path those ids reach moe_route unchanged. It indexed the per-expert counter through a raw pointer, so every -1 route did an atomic add on the int32 just before the counter allocation. The route now takes DROPPED_ROUTE_ROW instead, which the psum remap, the route-indexed quant and gather-reduce already skip. A test guards the counter with one extra leading element: before the fix it read 384 after a batch of 64 pad rows at top-6, now 0. * [FlyDSL][MoE] Support ATOM valid token counts in HERD --------- Co-authored-by: yadaish <[email protected]>
Summary
HERD selects K+1 candidate experts per token and drops the least batch-popular candidate, breaking ties by score and expert ID. This change supports performing the drop either in a standalone router finalize kernel or inside MoE token sorting on gfx950.
AITER_HERD_FUSED_DROP=1: fused drop, enabled by default.AITER_HERD_FUSED_DROP=0: standalone router drop.Both paths renormalize the retained K weights and preserve the routed scaling factor. GPT-OSS candidate softmax remains in the router. The fused path reuses the existing sorting buffer allocation.
Performance
End-to-end: DeepSeek-V4-Flash, TP1, gfx1250
Setup
f19778df4with the FlyDSL HERD patch; aitercguo/gfx1250_herd(266d1641c).--ignore-eos.AITER_FLYDSL_USE_HERD=1with the default fused drop (AITER_HERD_FUSED_DROP=1): Top-7 candidates, dropped to 6 inside the route/prefix-sum kernel.ATOM_USE_TRITON_MOE=1 ATOM_USE_TRITON_MOE_DECODE=1). HERD on =AITER_TRITON_USE_HERD=1.Throughput and latency (concurrency 64)
Accuracy: gsm8k (lm_eval local-completions, 3-shot, 65 concurrent requests, max_gen_toks 2048)
Notes
ATOM integration
Enabling the environment variable alone is insufficient. ATOM must allocate K+1 candidate outputs, select those candidates without dropping, and pass
herd_topkandherd_routed_scaling_factortofused_moe:Keep the model's existing activation, quantization, weight scales and layout arguments. Use this integration for renormalized decode routing; retain ordinary routing for hash layers, prefill and unsupported configurations.
The current fused path requires unmasked routes without fused shared experts or stage-1 route weighting.
Set
AITER_HERD_FUSED_DROPbefore CUDA graph capture and recapture when switching paths.Validation