Repository navigation
[FlyDSL] Use typed APIs in MoE routing and MX quantization - #6379
Conversation
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: |
main deleted this package's `vector` proxy in #6379 and moved its own descriptor builders onto `fx.Vector`, so the stage-1 kernel's nine `vector.from_elements(T.vec(n, T.i32), ...)` calls no longer import. The element type comes from the elements now, so the type argument goes with them. `TDM._i32` returns an `fx.Int32` in that same commit, which leaves the one raw `arith.shli` beside it mixing a typed operand into a raw op; `_tdm_group1_rows` reads its row count and shifts through `fx` instead, the way main's `tdm_group1_rows_4b` already does. Rebased onto main (65 commits) and re-measured: stage 1 is 209.4 us at tpr 1536 and 138.6 at 512, against 208.6-209.4 and 138.5 before the rebase, and logits stay identical to the default path at both. Co-Authored-By: Claude Opus 5 <[email protected]>
…after merging main The main merge broke both halves of this branch: - #6379 moved moe_fused_route_quant_scatter.py to the typed fx API and dropped its arith import, but the multidest token loop still built its block offset with arith.constant. Tracing the multidest copy raised NameError, so the EP4 MegaMoE path with a prequantized dispatch failed at its first call. Build it with fx.Uint32, as the rest of this kernel now does with bid/tid. - The tuned_grouped_fmoe.csv conflict was resolved to main's rows, which reverted gemm1 of the 8192 x 7168 x 2048, E=64/65, topk=-1 rows to m_warp=1, n_warp=4. Restore m_warp=4, n_warp=2.
main deleted this package's `vector` proxy in #6379 and moved its own descriptor builders onto `fx.Vector`, so the stage-1 kernel's nine `vector.from_elements(T.vec(n, T.i32), ...)` calls no longer import. The element type comes from the elements now, so the type argument goes with them. `TDM._i32` returns an `fx.Int32` in that same commit, which leaves the one raw `arith.shli` beside it mixing a typed operand into a raw op; `_tdm_group1_rows` reads its row count and shifts through `fx` instead, the way main's `tdm_group1_rows_4b` already does. Rebased onto main (65 commits) and re-measured: stage 1 is 209.4 us at tpr 1536 and 138.6 at 512, against 208.6-209.4 and 138.5 before the rebase, and logits stay identical to the default path at both. Co-Authored-By: Claude Opus 5 <[email protected]>
main deleted this package's `vector` proxy in #6379 and moved its own descriptor builders onto `fx.Vector`, so the stage-1 kernel's nine `vector.from_elements(T.vec(n, T.i32), ...)` calls no longer import. The element type comes from the elements now, so the type argument goes with them. `TDM._i32` returns an `fx.Int32` in that same commit, which leaves the one raw `arith.shli` beside it mixing a typed operand into a raw op; `_tdm_group1_rows` reads its row count and shifts through `fx` instead, the way main's `tdm_group1_rows_4b` already does. Rebased onto main (65 commits) and re-measured: stage 1 is 209.4 us at tpr 1536 and 138.6 at 512, against 208.6-209.4 and 138.5 before the rebase, and logits stay identical to the default path at both. Co-Authored-By: Claude Opus 5 <[email protected]>
Summary
fx.atomic_addfor global and LDS route counters in MoE routing, fused prefix sum, and quant scatter kernels.fxarithmetic, unsigned comparisons and shifts, selects, min/max, and casts in shared MX quantization helpers. The helpers retain their raw IR return contract and target-specificrocdl.cvt_scalef32_*operations.Validation
py_compile, andgit diff --checkpass across all five files.fx.Indexlauncher cast produced byte identical gfx1250 final ISA.i32andindexoffsets, including zero extension, logical high-word shift, and truncation.origin/mainfor all four E8M0 rounding modes across FP4 E2M1, FP8 E4M3, and FP8 E4M3 FNUZ, plus FP4 nibble conversion. Its native amax/scale path has byte identical final gfx1250 ISA.The gfx1250 checks are compile-only on this host.
TDM vector follow-up
TDM gather descriptor groups now use
fx.Vector.from_elements, and the direct MLIRvectorandrocdlimports are gone. With pinned FlyDSL 0.3.4.1, the descriptor probe's final ISA is byte identical to the previous PR head. Black, Ruff,compileall, andgit diff --checkpass.TDM vector follow-up (folded from closed #6391)
fx.Vector.from_elementsand remove the vendored MLIR vector dialect proxy.