moe rebase and refactor - #4394
Conversation
Co-authored-by: zanzhang <zanzhang@amd.com> Co-authored-by: lalala-sh <Jiaxing.Wen@amd.com> Co-authored-by: XingerZhu <233663585+XingerZhu@users.noreply.github.com> Co-authored-by: Felix Li <felix.li@amd.com> Co-authored-by: yanboshao <yashao@amd.com>
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
|
There was a problem hiding this comment.
Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit
ruff
Do not perform function call fx.Stream in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable
Do not perform function call fx.Stream in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable
Import block is un-sorted or un-formatted
aiter/aiter/ops/flydsl/kernels/mxfp4_preshuffle_gfx1250_tdm.py
Lines 6 to 29 in cafce66
Local variable SA_SUPERS is assigned to but never used
Unnecessary dict() call (rewrite as a literal)
Local variable N_ELEM is assigned to but never used
Use a single if statement instead of nested if statements
aiter/aiter/ops/flydsl/kernels/mxfp4_preshuffle_gfx1250_tdm.py
Lines 467 to 468 in cafce66
Use X | None for type annotations
aiter/aiter/ops/flydsl/moe_kernels.py
Line 1760 in cafce66
Use X | None for type annotations
aiter/aiter/ops/flydsl/moe_kernels.py
Line 1761 in cafce66
Use X | None for type annotations
aiter/aiter/ops/flydsl/moe_kernels.py
Line 1762 in cafce66
Use X | None for type annotations
aiter/aiter/ops/flydsl/moe_kernels.py
Line 1763 in cafce66
Use X | None for type annotations
aiter/aiter/ops/flydsl/moe_kernels.py
Line 1764 in cafce66
Use X | None for type annotations
aiter/aiter/ops/flydsl/moe_kernels.py
Line 1765 in cafce66
Use X | None for type annotations
aiter/aiter/ops/flydsl/moe_kernels.py
Line 1766 in cafce66
Use X | None for type annotations
aiter/aiter/ops/flydsl/moe_kernels.py
Lines 1896 to 1898 in cafce66
Use X | None for type annotations
aiter/aiter/ops/flydsl/moe_kernels.py
Line 1899 in cafce66
Use X | None for type annotations
aiter/aiter/ops/flydsl/moe_kernels.py
Line 1900 in cafce66
Use X | None for type annotations
aiter/aiter/ops/flydsl/moe_kernels.py
Line 1901 in cafce66
Use X | None for type annotations
aiter/aiter/ops/flydsl/moe_kernels.py
Line 1902 in cafce66
Use X | None for type annotations
aiter/aiter/ops/flydsl/moe_kernels.py
Line 2281 in cafce66
Use X | None for type annotations
aiter/aiter/ops/flydsl/moe_kernels.py
Line 2282 in cafce66
Use X | None for type annotations
aiter/aiter/ops/flydsl/moe_kernels.py
Line 2283 in cafce66
Replace the low-level MLIR/scf/ArithValue construction with flydsl expr if/select, SharedAllocator struct for the double-buffered scan, and _lds_load/_lds_store helpers. Behaviour unchanged. Co-authored-by: Cursor <cursoragent@cursor.com>
…_port_rebase # Conflicts: # aiter/aot/flydsl/grouped_moe.py # aiter/ops/flydsl/grouped_moe_gfx1250.py # aiter/ops/flydsl/kernels/gemm_common_gfx1250.py # aiter/ops/flydsl/kernels/gemm_mxscale_gfx1250.py # aiter/ops/flydsl/kernels/kernels_common.py # aiter/ops/flydsl/kernels/moe_contiguous_psum.py # aiter/ops/flydsl/kernels/moe_fused_route_quant_scatter.py # aiter/ops/flydsl/kernels/moe_gather_reduce.py # aiter/ops/flydsl/kernels/moe_grouped_gemm_mxscale_gfx1250.py # aiter/ops/flydsl/kernels/moe_route_maps.py # aiter/ops/flydsl/moe_kernels.py # op_tests/test_flydsl_grouped_gemm_gfx1250.py # op_tests/test_moe_ep.py
…er into dev/450ep_felix_tdm_port_rebase
…er into dev/450ep_felix_tdm_port_rebase
…dispatch Wire the branch's ep_scatter (combine_mode="scatter_fused") feature onto main's post-#4394 dispatch, whose grouped_moe/fused_moe were reorganized (entry grouped_gemm_gfx1250_a8w4 -> _grouped_a8w4_tdm_moe) relative to the pre-rebase branch. The kernel + launcher layer already carries the feature after the rebase (mxfp4_preshuffle_gfx1250_tdm ep_p2p_write epilogue + batched_gemm_mxfp4 flydsl_grouped_gemm_a8w4_masked ep_* / arg_ep_rowmap forwarding); this commit adds only the dispatch-layer wiring that the "keep main's grouped_moe/fused_moe" rebase strategy deferred: grouped_moe_gfx1250.py - add _get_compiled_contiguous_psum_remap_ep / _get_compiled_ep_rowmap / build_ep_rowmap helpers (compile the ep remap + ep_rowmap kernels that our kept moe_contiguous_psum.py already provides) - contiguous_psum_remap: add ep= branch (fused ep_rowmap build in the remap) - _grouped_a8w4_tdm_moe: ep_* params; build ep_rowmap + _ep_remap; pass ep=_ep_remap to contiguous_psum_remap; build _ep_gemm2_kwargs; pass **_ep_gemm2_kwargs to the gemm2 flydsl_grouped_gemm_a8w4_masked; ep_scatter early-return (combine reads comb_inp, no gather-reduce) - grouped_gemm_gfx1250_a8w4: ep_* params forwarded to _grouped_a8w4_tdm_moe fused_moe.py - fused_moe / fused_moe_ / _fused_moe_impl: ep_* params threaded down to the grouped_gemm_gfx1250_a8w4 call Co-authored-by: yanboshao <yashao@amd.com> Co-authored-by: Cursor <cursoragent@cursor.com>
The rebase-onto-main merge naively unioned old-schema (38-col) rows with new main's 36-col schema, inflating the file to 257 rows: it resurrected 83 rows inherited from the pre-#4394 main that new main had dropped, and (because the 38<->36 column shift misaligned the shape key) failed to dedup, keeping 49 re-benchmark duplicates (config identical to a main row, only us/tflops/bw differ) plus 26 same-shape re-tunes. Reduce to new main's 71 rows verbatim + only the 28 rows whose full config key (gfx..max_m) is genuinely absent from main (new token/act/dtype coverage of the same DeepSeek-family shapes). Drops 158 rows; keeps every shape validated on gfx1250 (deferring to main's tuning on all overlapping shapes).
Motivation
Technical Details
Test Plan
Test Result
Submission Checklist