Skip to content

[FlyDSL] [gfx1250] Optimize grouped MoE prefill and DSR1 EP tuning - #7726

Merged
coderfeli merged 59 commits into
mainfrom
dev/yadai_prefill_clean_v1
Nov 13, 2026
Merged

coderfeli merged 59 commits into
mainfrom
dev/yadai_prefill_clean_v1

Conversation

@yadaish

@yadaish yadaish commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Optimize gfx1250 FlyDSL grouped MoE prefill scheduling and add tuned DeepSeek-R1 and DeepSeek-V4.1 Flash configurations. The prefill path uses strict VGPR placement with FlyDSL 0.5, initializes accumulators while prologue tensor loads are outstanding, and schedules existing WMMAs around LDS prefetch and signal/wait regions to cover pipeline waits.

For DSR1 with 65 local experts, the measured EP4 GEMM1+GEMM2 sum falls by 18–27% at global raw tokens 16,384–32,768 versus the tested main revision. Separate 64-expert EP CSV alignment reduces the measured sum by 18–20% at raw tokens 16,384. These are sums of isolated local kernels, not end-to-end or communication-inclusive MoE speedups. Full stage data and exceptions are below.

Motivation

The existing prefill schedule leaves useful computation outside tensor/LDS wait regions, and legacy register-placement controls do not use FlyDSL 0.5's scheduling API. DSR1 also needs separate tuning for routed-only and shared-expert workloads, with EP configurations compared against the matching local workload rather than the same raw token count.

Changes

  • Use rocdl.experimental.sched_vgpr(..., soft=False) for strict consumer placement on supported 256×256×256 prefill tiles. Apply the occupancy attribute per kernel so ordinary tiles do not inherit the high-VGPR occupancy target.
  • Consolidate scheduling in HYPER_PARAMS: A4W4 prefill uses the 2×4 WMMA order, MMA groups of 2, DS groups of 3, KSL0 prefix/tail counts of 2/4, and KSL1 prefix/in-barrier counts of 4/4. Validate emitted WMMA ranges; the counts partition existing computation.
  • Move accumulator initialization before the prologue tensor wait, coordinate LDS register allocation and load interleaving, separate tensor-wait callbacks from signal/wait emission, and remove additional cluster-wide synchronization. Enable multicast early timeout through the prefill hyperparameters.
  • Add dedicated DSR1 and DSV4.1 Flash model CSVs, move DSR1 rows out of the generic CSV, and update the DSV4 Pro 16,384-token configuration. Tune DSR1 EP rows from non-EP candidates using source_token = actual_EP_raw_token // ep_world_size before EP CSV bucketing; retain existing settings when direct reuse does not improve performance.
  • Allow optional GEMM1 activation relocation into the separate quant/preshuffle kernel; preserve explicit GEMM stage selection when activation is moved. Add an A-preshuffle override. Normal measurements below keep GEMM1 activation and requantization fused.
  • Extend the existing grouped-GEMM test harness with shared experts, routing checks, and bandwidth accounting for active expert weights and the actual fused/unfused GEMM1 output representation.

Performance

Method and provenance

  • Hardware: gfx1250, 256 CUs. FlyDSL 0.5.0; PyTorch 2.11.0+rocm10.1.0a20260811-bkc.20260820.
  • DSR1 shape: hidden dimension 7,168, intermediate dimension 2,048, A4W4 MXFP4, BF16 output, SiLU, no bias, balanced routing, seed 0.
  • Native isolated GEMM1/GEMM2 timing; warmup 5, 128 requested iterations. Each table entry is one native timing run, not a median across independent runs. No profiler timing is substituted.
  • Non-EP tokens T match EP4 global/raw tokens 4*T. Sweep: non-EP 1–16,384 and EP4 raw 4–65,536, powers of two. EP raw 32,768 and 65,536 share CSV bucket 32,768.
  • Constant and random initialization are both tested. Branch comparisons use the same harness and initializer within each mode. Across modes, non-EP random uses uniform representable FP4/auto scales, while EP uses Gaussian inputs and native quantization; shared output scaling also differs (non-EP 1.0, EP 0.1). EP/non-EP inputs are workload-matched, not bit-identical.
  • GEMM1 and GEMM2 are measured separately after local dispatch. Their sum excludes communication and other MoE stages; this does not measure distributed end-to-end throughput.
  • Main comparison: 73739369f6b26977dd69886ab0ad3235d91a4992 (fetched November 12, 2026) versus 625aa919726d1011095c412c347fa83764059dcd plus the measured CSV changes. PR head f423da9fa14693c6333df9532911b5a8ed9b8e26 has identical kernel/test sources; its 65-expert rows match that measurement and its full DSR1 CSV matches the final 64-expert validation snapshot.
  • Both branches use the same snapshot harness, with AITER/kernel import paths checked, but retain their respective tuning tables. Main has no matching 65-expert non-EP rows and falls back to default tiles. Non-EP gains include configuration coverage, not just kernel changes.

65 local experts: main versus this PR

Non-EP: 64 routed + 1 shared expert, top-k 9 including the shared expert. EP4: 256 global routed experts, routed top-k 8, shared_E=1, ep_mode=real, ep_fused=0.

All timings are microseconds. G1 / G2 lists the two stages separately. Positive reduction means a lower G1+G2 sum.

Mode Non-EP-equivalent T Raw tokens Init Main G1 / G2 (µs) PR G1 / G2 (µs) Sum reduction
EP4 4096 16384 const 184.19 / 155.19 138.34 / 127.30 +21.7%
EP4 4096 16384 random 205.46 / 163.88 162.40 / 140.33 +18.0%
EP4 8192 32768 const 444.35 / 270.37 272.01 / 248.36 +27.2%
EP4 8192 32768 random 479.70 / 285.23 305.91 / 253.82 +26.8%
EP4 16384 65536 const 857.80 / 539.23 598.74 / 490.81 +22.0%
EP4 16384 65536 random 925.11 / 568.28 598.46 / 511.14 +25.7%
Non-EP 4096 4096 const 330.52 / 185.48 131.04 / 113.09 +52.7%
Non-EP 4096 4096 random 361.61 / 204.01 154.77 / 123.12 +50.9%
Non-EP 8192 8192 const 642.68 / 348.32 250.64 / 214.93 +53.0%
Non-EP 8192 8192 random 721.20 / 395.87 292.35 / 238.15 +52.5%
Non-EP 16384 16384 const 1251.65 / 660.83 500.35 / 404.44 +52.7%
Non-EP 16384 16384 random 1479.13 / 789.17 606.58 / 466.74 +52.7%

Variability and regressions: At EP raw 65,536 constant, main GEMM1 was 857.80 µs initially and 1,140.72 µs on repeat; PR GEMM1 was 598.74 and 595.76 µs. The initial percentage is not a precise stable speedup. The random repeat measured main 944.76 / 570.83 µs and PR 601.47 / 514.02 µs. At small non-EP sizes, GEMM2 regresses at T=1/2 and GEMM1 regresses at T=4; EP GEMM2 is about 3–5% slower at raw 1,024/2,048. These changes do not improve every stage at every size.

All 60 main/PR pairs, including small-token regressions
Mode Non-EP-equivalent T Raw tokens Init Main G1 / G2 (µs) PR G1 / G2 (µs) Sum reduction
EP4 1 4 const 17.82 / 6.26 17.87 / 6.32 -0.5%
EP4 1 4 random 19.01 / 6.46 18.94 / 6.49 +0.2%
EP4 2 8 const 23.95 / 9.91 16.65 / 10.35 +20.3%
EP4 2 8 random 24.39 / 10.15 17.11 / 10.64 +19.7%
EP4 4 16 const 32.72 / 21.60 32.82 / 21.38 +0.2%
EP4 4 16 random 33.47 / 21.47 33.52 / 22.45 -1.9%
EP4 8 32 const 75.51 / 30.84 62.63 / 29.12 +13.7%
EP4 8 32 random 78.00 / 32.87 64.50 / 30.74 +14.1%
EP4 16 64 const 76.58 / 30.85 63.25 / 27.09 +15.9%
EP4 16 64 random 78.41 / 32.23 64.44 / 28.21 +16.3%
EP4 32 128 const 76.63 / 31.45 63.05 / 27.23 +16.5%
EP4 32 128 random 78.42 / 33.03 64.76 / 28.05 +16.7%
EP4 64 256 const 77.72 / 32.47 62.59 / 27.88 +17.9%
EP4 64 256 random 80.16 / 33.37 64.73 / 28.72 +17.7%
EP4 128 512 const 77.30 / 32.24 64.14 / 29.63 +14.4%
EP4 128 512 random 79.83 / 33.83 66.27 / 30.53 +14.8%
EP4 256 1024 const 67.01 / 30.04 65.72 / 30.92 +0.4%
EP4 256 1024 random 69.27 / 31.12 68.27 / 32.59 -0.5%
EP4 512 2048 const 67.88 / 32.57 67.39 / 34.20 -1.1%
EP4 512 2048 random 71.84 / 34.99 71.88 / 36.79 -1.7%
EP4 1024 4096 const 108.67 / 55.91 97.10 / 57.31 +6.2%
EP4 1024 4096 random 115.73 / 60.42 108.52 / 62.12 +3.1%
EP4 2048 8192 const 98.13 / 78.80 88.15 / 68.68 +11.4%
EP4 2048 8192 random 112.46 / 82.73 104.72 / 72.61 +9.2%
EP4 4096 16384 const 184.19 / 155.19 138.34 / 127.30 +21.7%
EP4 4096 16384 random 205.46 / 163.88 162.40 / 140.33 +18.0%
EP4 8192 32768 const 444.35 / 270.37 272.01 / 248.36 +27.2%
EP4 8192 32768 random 479.70 / 285.23 305.91 / 253.82 +26.8%
EP4 16384 65536 const 857.80 / 539.23 598.74 / 490.81 +22.0%
EP4 16384 65536 random 925.11 / 568.28 598.46 / 511.14 +25.7%
Non-EP 1 1 const 17.77 / 6.06 14.64 / 9.51 -1.3%
Non-EP 1 1 random 18.36 / 6.32 14.92 / 9.68 +0.3%
Non-EP 2 2 const 23.46 / 8.39 16.59 / 10.38 +15.3%
Non-EP 2 2 random 24.07 / 8.64 17.16 / 10.67 +14.9%
Non-EP 4 4 const 31.30 / 16.10 36.71 / 14.48 -8.0%
Non-EP 4 4 random 32.89 / 16.90 38.06 / 15.23 -7.0%
Non-EP 8 8 const 74.67 / 30.31 61.78 / 26.23 +16.2%
Non-EP 8 8 random 77.92 / 32.17 63.71 / 27.42 +17.2%
Non-EP 16 16 const 74.77 / 30.35 62.18 / 26.38 +15.7%
Non-EP 16 16 random 78.27 / 31.86 64.86 / 27.92 +15.8%
Non-EP 32 32 const 75.42 / 30.63 61.79 / 26.72 +16.5%
Non-EP 32 32 random 78.49 / 32.33 64.65 / 28.04 +16.4%
Non-EP 64 64 const 76.51 / 31.37 62.43 / 27.06 +17.0%
Non-EP 64 64 random 79.89 / 33.22 65.55 / 29.03 +16.4%
Non-EP 128 128 const 77.50 / 33.91 62.80 / 27.56 +18.9%
Non-EP 128 128 random 81.74 / 35.50 65.65 / 29.79 +18.6%
Non-EP 256 256 const 78.56 / 33.51 65.38 / 28.93 +15.8%
Non-EP 256 256 random 82.70 / 35.61 68.05 / 31.26 +16.1%
Non-EP 512 512 const 79.01 / 35.71 66.80 / 32.40 +13.5%
Non-EP 512 512 random 83.90 / 38.82 70.98 / 35.96 +12.9%
Non-EP 1024 1024 const 112.67 / 56.66 105.83 / 57.86 +3.3%
Non-EP 1024 1024 random 111.05 / 58.18 107.45 / 59.89 +1.1%
Non-EP 2048 2048 const 180.86 / 99.58 86.79 / 60.54 +47.5%
Non-EP 2048 2048 random 199.93 / 109.90 97.67 / 65.66 +47.3%
Non-EP 4096 4096 const 330.52 / 185.48 131.04 / 113.09 +52.7%
Non-EP 4096 4096 random 361.61 / 204.01 154.77 / 123.12 +50.9%
Non-EP 8192 8192 const 642.68 / 348.32 250.64 / 214.93 +53.0%
Non-EP 8192 8192 random 721.20 / 395.87 292.35 / 238.15 +52.5%
Non-EP 16384 16384 const 1251.65 / 660.83 500.35 / 404.44 +52.7%
Non-EP 16384 16384 random 1479.13 / 789.17 606.58 / 466.74 +52.7%

An additional non-EP T=1,024 constant repeat measured main 113.25 / 57.39 µs and PR 105.17 / 56.83 µs. Repeat observations are kept separate from the original sweep.

64 local routed experts: EP CSV tuning on this branch

This is a CSV-only before/after comparison on the same branch, not another main comparison. Non-EP uses 64 experts/top-k 8 and no shared expert; EP4 uses 256 global routed experts/top-k 8 and shared_E=0.

Direct non-EP-row reuse was evaluated using actual raw tokens divided by 4. Seven EP rows were added and three replaced. Existing settings were retained for raw 4, 2,048, 4,096 and the shared 32,768/65,536 bucket. Both large sizes were tested with both candidate source rows before retaining that shared bucket. The 65-expert, non-EP and ep_fused=1 rows were preserved during this tuning step.

EP raw tokens Non-EP T Init Non-EP G1 / G2 (µs) Original EP G1 / G2 (µs) Selected EP G1 / G2 (µs) Sum reduction CSV changed
8 2 const 16.01 / 10.25 23.11 / 7.62 15.82 / 10.29 +15.0% Yes
8 2 random 16.44 / 10.51 23.18 / 8.57 16.01 / 10.41 +16.8% Yes
1024 256 const 52.76 / 27.82 54.71 / 30.05 55.44 / 28.45 +1.0% Yes
1024 256 random 56.36 / 29.59 58.93 / 31.26 58.55 / 29.78 +2.1% Yes
8192 2048 const 74.46 / 54.82 83.82 / 65.10 77.43 / 61.99 +6.4% Yes
8192 2048 random 86.05 / 59.17 94.98 / 68.49 88.89 / 65.64 +5.5% Yes
16384 4096 const 118.20 / 102.89 130.92 / 171.32 125.20 / 117.66 +19.6% Yes
16384 4096 random 138.12 / 107.54 152.32 / 176.79 147.38 / 121.95 +18.2% Yes

At raw 1,024, interleaved repeats confirmed the modest GEMM2 improvement: 30.24→28.53 µs constant and 31.48→29.67 µs random, with GEMM1 unchanged. At raw 8, the lower total includes a GEMM2 regression; both stage timings are shown above.

All 30 final 64-expert validation points
EP raw tokens Non-EP T Init Non-EP G1 / G2 (µs) Original EP G1 / G2 (µs) Selected EP G1 / G2 (µs) Sum reduction CSV changed
4 1 const 14.36 / 9.41 16.96 / 6.31 17.11 / 6.32 -0.7% No
4 1 random 14.56 / 9.54 16.54 / 6.54 16.85 / 6.51 -1.2% No
8 2 const 16.01 / 10.25 23.11 / 7.62 15.82 / 10.29 +15.0% Yes
8 2 random 16.44 / 10.51 23.18 / 8.57 16.01 / 10.41 +16.8% Yes
16 4 const 25.25 / 14.10 30.91 / 14.73 25.88 / 14.11 +12.4% Yes
16 4 random 26.86 / 14.97 33.43 / 15.27 27.17 / 14.46 +14.5% Yes
32 8 const 49.77 / 25.85 57.25 / 30.42 51.96 / 26.41 +10.6% Yes
32 8 random 54.13 / 27.71 59.62 / 32.02 53.63 / 27.20 +11.8% Yes
64 16 const 50.17 / 26.03 57.34 / 30.26 52.16 / 26.59 +10.1% Yes
64 16 random 54.26 / 27.64 60.12 / 31.85 53.76 / 27.41 +11.7% Yes
128 32 const 50.17 / 26.18 57.08 / 30.67 51.45 / 26.76 +10.9% Yes
128 32 random 54.58 / 27.80 59.82 / 31.83 54.15 / 27.49 +10.9% Yes
256 64 const 50.84 / 26.30 57.87 / 31.19 53.01 / 26.88 +10.3% Yes
256 64 random 54.68 / 28.09 59.79 / 32.77 53.88 / 27.64 +11.9% Yes
512 128 const 51.27 / 26.73 57.75 / 31.44 53.66 / 28.00 +8.4% Yes
512 128 random 54.70 / 27.98 61.02 / 32.44 56.50 / 28.79 +8.7% Yes
1024 256 const 52.76 / 27.82 54.71 / 30.05 55.44 / 28.45 +1.0% Yes
1024 256 random 56.36 / 29.59 58.93 / 31.26 58.55 / 29.78 +2.1% Yes
2048 512 const 55.28 / 30.90 56.77 / 31.88 57.78 / 32.19 -1.5% No
2048 512 random 60.30 / 33.56 61.91 / 33.89 62.28 / 34.39 -0.9% No
4096 1024 const 93.04 / 53.69 84.32 / 54.05 83.84 / 53.85 +0.5% No
4096 1024 random 103.22 / 59.57 92.30 / 57.39 91.80 / 56.87 +0.7% No
8192 2048 const 74.46 / 54.82 83.82 / 65.10 77.43 / 61.99 +6.4% Yes
8192 2048 random 86.05 / 59.17 94.98 / 68.49 88.89 / 65.64 +5.5% Yes
16384 4096 const 118.20 / 102.89 130.92 / 171.32 125.20 / 117.66 +19.6% Yes
16384 4096 random 138.12 / 107.54 152.32 / 176.79 147.38 / 121.95 +18.2% Yes
32768 8192 const 230.11 / 196.08 244.03 / 224.36 244.85 / 224.54 -0.2% No
32768 8192 random 255.92 / 207.04 275.01 / 229.33 274.40 / 229.00 +0.2% No
65536 16384 const 451.89 / 363.11 477.97 / 446.93 531.90 / 444.27 -5.5% No
65536 16384 random 520.06 / 408.71 542.93 / 466.31 528.32 / 457.30 +2.3% No

Rows marked “No” use identical before/after settings; their differences are run-to-run variation. In particular, raw 65,536 constant GEMM1 varied from 477.97 to 531.90 µs without a configuration change.

Testing

  • Unit tests added or updated
  • Performance benchmarks run
  • Tested on MI250X
  • Tested on MI300X

All 60 main/PR comparison pairs and three repeat pairs passed the numerical checks. All 30 final 64-expert EP token/initialization cases passed after consolidating the selected CSV. Validation uses the native harness numerical checks, including logits_diff < 0.01.

Reproduction settings:

export AITER_CONFIG_GROUPED_FMOE=aiter/configs/model_configs/dsr1_tuned_grouped_fmoe.csv
export AITER_FLYDSL_DISABLE_GEMM1_ACT=0
export AITER_FLYDSL_DISABLE_GEMM1_REQUANT=0
export AITER_MOE_EXPERT_BALANCE=true
export AITER_EP_KERNEL_BENCH=1

Non-EP entry point: op_tests/flydsl_tests/test_flydsl_grouped_gemm.py, --scenario kernel --data-format a4w4 --experts 65 --shared-experts 1 --topk 9 --model-dim 7168 --inter-dim 2048 --act silu --no-bias --balanced-routing --warmup 5 --iters 128 --seed 0 --no-check-aot-cache --data-init constant uniform --scale-init constant auto, sweeping the tokens listed above. Use experts 64, shared experts 0 and top-k 8 for the routed-only workload.

EP entry point: op_tests/test_moe_ep.py::test_fmoe_ep_mxfp4('a4w4_mxfp4', 4*T, 7168, 2048, 256, 8, shared_E=1, ep=4, ep_mode='real', const_init=0.5 or None), with native run_perftest set to warmup 5 / iterations 128; use shared_E=0 for 64 local experts. The paired driver snapshots the harness for both revisions and selects each revision's own CSV.

The final-head data above covers DSR1 A4W4 with fused GEMM1 activation/requantization on gfx1250. DSV4 Pro/Flash, A8W4, optional activation relocation, other activations, and other architectures were not rerun in this final comparison. No distributed communication validation is claimed.

Documentation

  • Docstrings updated
  • User guide updated
  • Performance guide updated

The kernel comments explain the scheduling sequence and instruction budgets; wrapper/test documentation describes activation relocation and shared-expert semantics.

Dependencies

  • No new third-party dependencies added

Uses the existing FlyDSL dependency; measurements use 0.5.0. Strict prefill placement is gated on availability of rocdl.experimental.sched_vgpr.

Breaking Changes

The Python call additions are optional, but experimental environment controls change: per-field IGLP overrides, AITER_FLYDSL_EXPLICIT_VGPR_PARTITION, LDS_SOA_LOAD_INTERLEAVE, AITER_FLYDSL_FORCE_1X4_CLUSTER, and AITER_FLYDSL_DISABLE_CLUSTER_SYNC are removed from this kernel. Use HYPER_PARAMS for instruction scheduling and CSV fields for launch/layout tuning. AITER_FLYDSL_PLANAR_LDS and AITER_FLYDSL_INTERLEAVED_LDS_LOAD remain; the latter explicitly overrides the CSV, including when set to zero. DSR1 configurations now live in aiter/configs/model_configs/dsr1_tuned_grouped_fmoe.csv; callers explicitly selecting the old generic CSV should select the model CSV for these rows.

PR Self-Review

Reviewed revision

f423da9fa14693c6333df9532911b5a8ed9b8e26. The description and performance provenance were checked against this head; this is not a claim of exhaustive independent code review.

Behavior and intent

The optimized prefill schedule partitions existing WMMAs into prefix, signal/wait coverage and ordinary IGLP regions, while strict consumer VGPR placement controls the operand layout. CSV tuning selects launch parameters for the actual local workload, and shared-expert accounting prevents overstating active weight traffic. The intent is to reduce local compute latency without treating EP raw tokens as non-EP local tokens.

Validation and unverified scope

See the workload, revision, numerical-check and measurement details above. Tables preserve slower cases and variable samples. No final-state claim is made for MI250X/MI300X, distributed communication, or workload/features outside the listed DSR1 sweep.

PR-specific question

No automated path-specific self-review question was present when this description was updated.

Changed op tests

op_tests/flydsl_tests/test_flydsl_grouped_gemm.py: adds shared-expert CLI/routing support, checks that shared outputs have unit weight without changing routed normalization, and verifies active-expert byte accounting across A4W4/A8W4 and fused/unfused output modes. These cases cover shared routing and metrics that the previous routed-only harness did not exercise.

yadaish and others added 30 commits October 15, 2026 11:14
# Conflicts:
#	aiter/configs/tuned_grouped_fmoe.csv
Rename the benchmark to reproduce.sh and pin the validated zero-input configuration. Include standalone activation/quantization dependencies and tests so the script does not rely on stashed implementation changes. Preserve unrelated work in stash. GPU timing was not rerun for this commit.
Use normal WMMA order with operand B reuse and precomputed payload LDS bases. Initialize accumulators before the prologue TDM wait and select WPT1 for the conc16384 tuned configuration.

Include the local benchmark scripts and the reproducer iteration update.
@aiter-bot

aiter-bot commented Nov 12, 2026 •

Copy link
Copy Markdown

WAITING ON AUTHOR

PR Self-Review

Revision cec6a266d91c · mode shadow

Waiting for the PR author. The readiness report will appear after the self-review answers are complete for this revision.

Questions to answer in the PR description

  1. What behavior does this PR change, and why is the existing behavior insufficient?
  2. What did you validate, and what remains unverified? Include commands, hardware/configuration and results.
  3. Which exact workload keys consume these configuration changes, and what evidence shows that unrelated shapes keep their previous selection?
  4. For every changed op_tests/ file, what behavior does it cover and why is it not redundant? Write None if no op test changed.

Edit the PR Self-Review section in the PR description. Include the current revision SHA; this comment refreshes automatically.

Missing or invalid answers

  • FAIL — Reviewed revision must contain at least the first 7 characters of the current head SHA
  • FAIL — PR-specific question is too short to show concrete reasoning (12 units; need 14)
  • FAIL — validation answer must name a command, result, or evidence link
  • FAIL — validation answer must explicitly state what remains unverified (or say none with a reason)

Shadow mode reports what would block but keeps the status successful. Set AITER_PR_SELF_REVIEW_MODE=enforce only after reviewing real false positives.

yadaish and others added 4 commits November 12, 2026 14:56
…or 1-1024 tokens

The single 16x256x256 four-wave as-prologue row left gemm1 at ~16 TB/s for decode-sized
batches (three workgroup rounds, extra round at 4 tokens, and a 64-row tile that doubled
weight reads at 1024 tokens). Re-swept tiles and knobs for this shape on gfx1250:
narrower gemm1 tiles (tile_n 64/128) with deeper buffering for 1-32 tokens, as-prologue
kept only at 64 and 256 tokens where it measures faster, and 128x256 tiles at 1024 tokens.

gemm1+gemm2 vs the previous rows (test_flydsl_grouped_gemm, constant + uniform init):
1 tok 1.81x, 2 1.11x, 4 1.25x, 8-256 1.12-1.16x, 512 1.08x, 1024 1.38x; >= 2048 unchanged.

@coderfeli coderfeli left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@coderfeli
coderfeli merged commit 06ad898 into main Nov 13, 2026
@coderfeli
coderfeli deleted the dev/yadai_prefill_clean_v1 branch November 13, 2026 00:32
@zufayu
zufayu requested review from aoli26 and coderfeli November 13, 2026 01:31
@yadaish
yadaish restored the dev/yadai_prefill_clean_v1 branch November 13, 2026 04:33
Boss2002n pushed a commit that referenced this pull request Nov 13, 2026
#7726 adds gemm_stage and replaces IGLP_PARAMS with HYPER_PARAMS. Keep
that, and keep this branch's m_align guard that forces cluster_m to 1 so
a padding skip cannot deadlock the M-cluster barrier.

Co-authored-by: Cursor <[email protected]>
vpietila-amd pushed a commit that referenced this pull request Nov 13, 2026
…7726)

* Optimize FlyDSL grouped MoE kernels

---------

Co-authored-by: JiaoliangYu <[email protected]>
Co-authored-by: lalala-sh <[email protected]>
JiaoliangYu added a commit to JiaoliangYu/aiter that referenced this pull request Nov 16, 2026
…d=1 row

Replace the ep_fused=1 token=32768 row from ROCm#7726 (hand-set 128x256x256,
w1x4, no measurement) with a measured one: 256x256x256 w2x2, 4/4 buffers,
cluster_n 4, waves 2/1, prefetch, LDS SoA interleave, A preshuffle.
4-GPU EP4 MegaMoE layer (12288 tokens/rank): 2361 -> 1994.5 us, bit-identical.
amirumoAMD added a commit that referenced this pull request Nov 16, 2026
Resolve conflicts with main's grouped-MoE rework (#7726), the tiled TDM
atom interface (#7655), the FlyDSL 0.5 bump (#7600) and the shared-expert
byte model in the grouped GEMM test.

- tdm kernel: keep main's HYPER_PARAMS scheduler, tiled TDM loads and
  k_step WMMA ordering; reapply ds_first_n (now overriding
  ds_first_group), mma_prio, N-partitioned LDS loads, resident-B skip,
  split-K offsets and the per-feature kernel-name tags on top.
- grouped_gemm_mxfp4: main's gemm_stage and m_align cluster handling,
  then decode static M.
- grouped_moe_gfx1250: keep both new helpers and both sets of gemm1
  kwargs.
- tuned_grouped_fmoe.csv: drop the DSR1 rows main moved to
  model_configs/, take main's 96-expert 16384-token update, keep the
  Kimi K2 a8w4 rows.
- moe_contiguous_psum: drop the HERD import main removed.
- test: main's byte model plus the AITER_MOE_NUM_EXPERT_ACTIVATED cap.
@andyluo7

Copy link
Copy Markdown
Contributor

The tuned grouped MXFP4 MoE rows added here make gfx1250 build module_moe_mxfp4_aux, whose moe_sort_quant.cuh uses gfx9-only DPP row broadcasts, so 36 gfx1250 FlyDSL MoE AOT replays fail since this merge. Details and repro in #8133.

JiaoliangYu added a commit that referenced this pull request Nov 23, 2026
…rows (#8002) (#8262)

* [FlyDSL] [gfx1250] [MoE] DeepSeek-R1 EP4 MegaMoE grouped FMoE rows: ep_fused=1 buckets and tuned 8192

MegaMoE looks the grouped GEMM up with ep_fused=1 (GEMM2 does the EP
scatter). For DeepSeek-R1 EP4 (model_dim 7168, inter_dim 2048, 65 experts
per rank, topk -1) the table had ep_fused=1 rows only for tokens 1024, 2048,
4096 and 32768, and the ep_fused=0 rows do not serve the fused path, so the
other buckets missed and kept the caller's default tile.

- tokens 8..512 and 16384: the existing ep_fused=0 rows, with ep_fused=1.
- token 8192: the ep_fused=0 row's tiles with persistent_workers2=512
  (233.57 us).

* [FlyDSL] [gfx1250] [MoE] DeepSeek-R1 EP4 MegaMoE: tuned 32768 ep_fused=1 row

Replace the ep_fused=1 token=32768 row from #7726 (hand-set 128x256x256,
w1x4, no measurement) with a measured one: 256x256x256 w2x2, 4/4 buffers,
cluster_n 4, waves 2/1, prefetch, LDS SoA interleave, A preshuffle.
4-GPU EP4 MegaMoE layer (12288 tokens/rank): 2361 -> 1994.5 us, bit-identical.

* Update fused-EP config tests and initialize the CPU allreduce fixture

---------

Co-authored-by: [email protected] <[email protected]>
zufayu pushed a commit that referenced this pull request Nov 25, 2026
…le exceeds the VGPR partition (#8540)

256x256x256 grouped MoE tiles pin each k128 prefetch slot to 128 VGPRs
(v256-v511) and the accumulators to 512 (from v512) whenever FlyDSL
exposes sched_vgpr. Wave grids that need more, such as a4w4 1x4 (160 per
slot) or a8w4 2x2 (192), hit `assert slot_width <= 128` in make_rmem_slot.
Tuned rows from #7726 select them, so 36 gfx1250 FlyDSL MoE AOT replay
jobs fail and run_aot() aborts.

Enable the explicit partition only when the tile fits, using the same
arithmetic as the assertion; otherwise keep compiler allocation, as every
non-prefill tile does. Tiles that fit build exactly as before.

Add an a4w4 1x4 regression test. a8w4 on these tiles is tracked in #8539.

Co-authored-by: Claude <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants