Repository navigation
[FlyDSL] Dev/yadai moe v1 - #6269
Conversation
Enable persistent execution with unquantized EP scatter and select its worker count from explicit fused tuning rows. Add the default configuration for the 8192-token bucket, hidden 7168, intermediate 2048, and 64 local experts, so no tuning environment variables are required. On the four-GPU run_mega workload, K2048 GEMM2 improves from 173.5 to 166.4 us and fused pipeline latency from 480.3 to 473.0 us per layer. Validated with rocprofv3, repeated measurements, and a passing 16-layer FP32-reference accuracy check using the default CSV configuration.
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: |
Keep the PR's grouped-MoE tuning columns and expert65/topk9 row while retaining main's removal of the duplicate 512-token config. Use main's upstream CK pin 96afae1d, which includes the same half_t intrinsics fix. Format the persistent-EP assertion with Black. Validation against pre-merge PR head ce2fdec, using FlyDSL 0.3.4.1: - Cross-compiled 92 gfx1250 MoE GEMM specializations on each version; all 92 final-assembly pairs are byte-identical (184 compilations). - Covered both stages, FP4/FP8, rolled drain, persistent workers, and unquantized/FP4/FP8 EP scatter. - Passed 22 config collision tests and 10 gfx950 routing checks, including eager/graph execution, expert-count boundaries, and preservation of the EP route counter. - Black, Ruff, Python parsing, and PR diff whitespace checks passed. No gfx1250 hardware was available for GEMM execution or performance tests.
… write-back - rolled_drain and persistent_workers2 get the value grouped_moe_gfx1250 reads a blank cell as (0), like the other columns the tuner does not set. - A written row takes the file's columns; only a missing key is added. Re-tuning a row of tuned_grouped_fmoe.csv no longer adds max_m and grouped_persistent_m, which #6269 dropped, blank in every other row. - A column without blank cells and without a known blank value stops the tuner before it times a candidate, and result_to_csv before it writes. - _csv_text writes an integral number in any notation as the integer.
* fix(moe-tuner): write grouped MoE tuning results back in place GroupedFmoeTuner.result_to_csv went through update_tunedf and a pandas round trip, which broke tuned_grouped_fmoe.csv in two ways: - The tuner keys on gate_mode, which the CSV does not have, so a re-tuned row was appended next to the old one, with a new gate_mode column, instead of replacing it. The lookup ignores gate_mode and takes the row with the lower us, so the stale row could still win. - pandas reads a column that has a blank cell as floats, so the other rows came back with "16.0" for 16. Read the file as text, match rows on the key columns the file has, replace a re-tuned row in place, and keep the other rows byte for byte. In a column without blank cells, a re-tuned row gets the value a blank cell means rather than a blank, so the config merge does not turn that column into floats. Signed-off-by: Jin Pan <[email protected]> * fix(moe-tuner): keep the grouped config's columns and filled cells on write-back - rolled_drain and persistent_workers2 get the value grouped_moe_gfx1250 reads a blank cell as (0), like the other columns the tuner does not set. - A written row takes the file's columns; only a missing key is added. Re-tuning a row of tuned_grouped_fmoe.csv no longer adds max_m and grouped_persistent_m, which #6269 dropped, blank in every other row. - A column without blank cells and without a known blank value stops the tuner before it times a candidate, and result_to_csv before it writes. - _csv_text writes an integral number in any notation as the integer. --------- Signed-off-by: Jin Pan <[email protected]>
Motivation
Improve gfx1250 FlyDSL grouped MoE execution for MXFP4 workloads by adding persistent scheduling that processes the live routing workload during graph replay. Add a configurable pipeline drain loop and update tuning configurations to support further performance tuning.
Strengthen expert-parallel (EP) validation by matching dispatch buffer sizing and activation quantization more closely to the runtime behavior.
Technical Details
Persistent grouped GEMM scheduling: Add independent worker counts for GEMM1 and GEMM2, configurable through tuning CSVs and environment overrides. Workers read the live device-side routing extent on each graph replay and iterate over populated tiles. Worker counts align with N-cluster geometry, and a barrier protects LDS reuse between tasks. Persistent
execution requires cluster_m=1 and supports unquantized EP scatter; quantized scatter retains the existing nonpersistent path.
Configurable pipeline drain: Add rolled_drain to select a runtime loop instead of fully unrolling the pipeline drain. Preserve fence and prefetch ordering, with the final prefetched tile handled separately to avoid a runtime branch that can cause VGPR spills.
Tuning configuration updates: Normalize the grouped MoE and Qwen3.5-397B CSV schemas, remove obsolete fields, populate stage-specific settings, and update selected configurations. Persistent scheduling remains opt-in; the committed CSV rows set both worker counts to zero.
More representative tests: Correct real-EP activation buffer sizing so top-k expands routing tensors rather than token storage. Add balanced routing and reproducible seeds, enable gfx1250 A4W4 EP coverage with a reference that models both MXFP4 activation quantization stages, and make numerical tolerance failures assert. Enable graph-based grouped GEMM
timing and increase EP benchmark iterations.
Implementation and test changes: PR diff.