Skip to content

[FlyDSL] Tune DSv4.1 EP8 A8W4 MegaMoE - #7127

Merged
coderfeli merged 7 commits into
mainfrom
ghu_dsv41
Nov 3, 2026
Merged

coderfeli merged 7 commits into
mainfrom
ghu_dsv41

Conversation

@GwilliamHu

@GwilliamHu GwilliamHu commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Motivation

Improve DSv4.1-Flash native MX A8W4 MegaMoE on gfx950/EP8: H5120, I2304, 384 experts, top-k 6.

Technical Details

  • Tune the target EP8 A8W4 profile across token/capacity buckets; leave other network/EP/dtype selector outcomes unchanged.
  • Parallelize prepare fanout/geometry reductions and hand finite next-epoch fanout work to a quant CTA only when residency is safe; preserve publication/acquire ordering.
  • Use public fx.copy with aligned Int32 views for the scoped final-K LDS load; tune existing Stage1/Stage2 parameters. No new public arguments, buffers, launches or wire formats.

Test Plan

  • Current head: 9,360 CPU selector/scope checks, all 16 MTPR bundle plans, Python syntax, Black, Ruff and diff checks passed. The main merge leaves the previously validated MegaMoE sources and AOT/test entry points byte-identical.
  • Historical final implementation 09ce86059: 73 paired reference/Graph/40×20-chain points, dynamic routes/unequal ranks, burst 2000, 32 production CPU AOT profiles and 37 GPU run-only points passed. GPU/whole-model tests were not rerun on this main-merge head; current CI is pending.

Native correctness entry point (no private helper scripts):

MORI_SHMEM_HEAP_SIZE=64G FLYDSL_RUNTIME_ENABLE_CACHE=0 \
python -m torch.distributed.run --standalone --nproc_per_node=8 \
  op_tests/multigpu_tests/test_mega_moe_v2.py \
  --network v41_flash --quant a8w4 --max-tok-per-rank 32768 \
  --bs-list 1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768 \
  --accuracy-max-bs 32768 --rtol 0.08 --iters 10

For equal capacity, run each TPR separately with identical --bs-list TPR and --max-tok-per-rank TPR (including 1/2/4/8).

Test Result

Environment: 8×MI355X/gfx950, ROCm 7.2.4, PyTorch 2.10.0, FlyDSL 0.4.0, MORI 1.2.4. Uniform routing, seed 123, BF16 input, native MX A8W4, CUDA Graph, 10 timed replays; 8-rank mean E2E, µs. Speedup (%) = (main / PR − 1) × 100% for the same workload (per-call speedup, not time reduction or a measured whole-model throughput gain); negative values are slower.

Version scope: these are the complete 32-point paired tuning measurements: frozen main 9b1dfee26497 versus the tested PR snapshot, before subsequent cleanup/address/32K tuning. They are not measurements of final PR head 5f3bde107 against current main. The later final-copy regression compares against the prior optimized PR, not main, and is not mixed into these tables. Differences below about 2% are not treated as established wins/regressions.

Uniform routing: MTPR = MAX = 32768

All points use the compact path.

TPR MTPR AITER main (µs) This PR (µs) Speedup (%)
1 32768 165.0 134.5 +22.68%
2 32768 183.8 162.0 +13.46%
4 32768 244.7 222.6 +9.93%
8 32768 275.0 251.1 +9.52%
16 32768 291.9 258.5 +12.92%
32 32768 325.6 277.0 +17.55%
64 32768 343.8 286.3 +20.08%
128 32768 369.0 298.1 +23.78%
256 32768 442.9 359.3 +23.27%
512 32768 510.9 461.0 +10.82%
1024 32768 644.5 622.6 +3.52%
2048 32768 1029.7 1014.2 +1.53%
4096 32768 1625.1 1555.9 +4.45%
8192 32768 2956.8 2752.5 +7.42%
16384 32768 5356.2 5164.6 +3.71%
32768 32768 10698.9 10158.3 +5.32%

Uniform routing: MTPR = TPR

TPR ≤128 uses fixed-slot; TPR ≥256 uses compact. Equal capacity does not mean every row is fixed-slot.

TPR MTPR AITER main (µs) This PR (µs) Speedup (%)
1 1 87.9 86.7 +1.38%
2 2 98.9 99.5 -0.60%
4 4 134.4 133.1 +0.98%
8 8 166.9 168.2 -0.77%
16 16 216.3 203.6 +6.24%
32 32 231.8 216.4 +7.12%
64 64 237.0 238.6 -0.67%
128 128 251.9 236.8 +6.38%
256 256 430.2 361.7 +18.94%
512 512 503.9 452.9 +11.26%
1024 1024 664.3 632.6 +5.01%
2048 2048 1027.5 1010.8 +1.65%
4096 4096 1613.2 1517.8 +6.29%
8192 8192 2918.9 2718.4 +7.38%
16384 16384 5303.1 5129.2 +3.39%
32768 32768 10674.5 10108.6 +5.60%

Later, separate 32K tuning measured 10691.8 → 9997.3 µs on uniform routing (+6.95% performance improvement). The previously reported skewed-routing time reductions correspond to approximately +3.14% performance improvement for one-rank hotspots, +14.85% for Zipf 1.5 and +17.76% for rank-balanced paired hotspots (converted from the rounded original percentages). These later measurements are not substituted into the earlier full-scan rows. No universal 20% performance improvement or whole-model speedup is claimed.

Required PR self-review and current-head validation scope

PR Self-Review

Reviewed revision

5f3bde1078b80d80b7aaf6c39914f77d8cedc2eb

Behavior and intent

Tune native A8W4 DSv4.1-Flash EP8 using the existing prepare, dispatch/GEMM1, GEMM2 and combine architecture. Preserve quantization order, protocol, public interface and unsupported-workload fallbacks. Main 8fd893402 is merged without changing the previously validated MegaMoE implementation.

Validation and unverified scope

Current-head CPU validation passed: 9,360 comparisons, 7,980 unchanged non-target outcomes, 1,240 identically rejected outcomes, 16 bundle plans, Python syntax, Black and Ruff. Historical GPU/AOT tests above identify their tested implementation; current-head GPU and whole-model performance remain unverified, and current CI is pending. Native MegaMoE tests are still skipped by the generic CI driver. Upstream #7290's updated timing table is included: a splitter dry-run places top-k in shard 0 and GEMM/concat-cache in shard 2 instead of packing all three into shard 4; actual new-run completion remains unverified.

PR-specific question

The tuning selector matches exactly (experts_per_rank=48, model_dim=5120, inter_dim=2304, world_size=8, a_dtype='fp8'). CPU comparisons cover ten model/EPR geometries, EP2/4/8, FP8/FP4, all token/capacity buckets and boundary inputs. All non-target selections, P2P quantization modes and payload-chunk wire fields remain unchanged.

Changed op tests

op_tests/multigpu_tests/test_mega_moe_v2.py adds the DSv4.1-Flash model geometry and valid paired-fanout routes for top-k 6. Existing V4-Pro/GLM/R1/K3 profiles do not exercise this geometry; the old paired fixture assumed a larger top-k. Reuse the canonical runner instead of adding an experimental test file.

@github-actions

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

  • ✅ Pre-checks (submodule verification, code formatting)
  • ✅ Aiter op tests (gfx942 + gfx950)
  • ✅ Triton tests on MI35X (only when aiter/ops/triton/** or related paths are changed)

Extended tests (opt-in via labels):

Label Tests
ci:gfx1250-ffm-triton Run the five-shard gfx1250 FFM Triton test suite
ci:triton-300x Run an additional Triton test job on MI300X in PRs (added automatically when gfx942 configs change); main branch always runs both MI35X and MI300X
ci:triton-355 Run the full Triton test suite on MI35X, not only the tests the change affects
ci:windows Windows JIT op smoke test on the gfx1201 ROCm runner
ci:multi-gpu Aiter multi-GPU tests on the 8-GPU runner
ci:sglang SGLang integration tests: DeepSeek-R1-MXFP4 accuracy, Qwen 3.5 accuracy
ci:atom ATOM benchmark: DeepSeek-R1-0528, GPT-OSS-120B
ci:atom_full ATOM accuracy suite for PR and main models from ATOM models_accuracy.json
ci:vllm vLLM benchmark: DeepSeek-V4-Pro, MiniMax-M3-MXFP4
ci:all All standard extended tests (excludes ci:atom_full)

Only add ci:atom_full for FlyDSL or Triton upgrades.
Add labels via the sidebar or gh pr edit 7127 --add-label <label>

One backend per PR:
A PR changes one kernel backend: [Triton/Gluon] (Triton and Gluon count as one), [HIP], [ASM], [CK], [OPUS] or [FlyDSL]. If the title ends up with two backend tags, split the PR -- as stacked pull requests when one part cannot merge without the other.

PR title tags & labels:
Component tags ([Triton/Gluon], [HIP], [CK], [ASM], ...) are added to the PR title and as PR labels automatically from the changed files and re-synced on every push — change-type tags like [fix]/[Perf], op tags like [MLA], and human labels (ci:*) are left untouched. Add the no-auto-title label to stop the title rewrites; labels stay in sync either way.

@GwilliamHu GwilliamHu added the ci:multi-gpu Trigger multi-GPU op tests on PR label Oct 29, 2026
@GwilliamHu
GwilliamHu marked this pull request as ready for review October 29, 2026 05:18
@GwilliamHu
GwilliamHu requested a review from a team October 29, 2026 05:18
@aiter-bot

aiter-bot commented Oct 29, 2026 •

Copy link
Copy Markdown

READY FOR HUMAN REVIEW

PR Self-Review

Revision 5f3bde1078b8 · mode shadow

Author self-review accepted. Readiness report:

Author answers

  • PASS — current-SHA answers are present and structurally specific
Show the author's self-review answers

Behavior and intent

Tune native A8W4 DSv4.1-Flash EP8 using the existing prepare, dispatch/GEMM1, GEMM2 and combine architecture. Preserve quantization order, protocol, public interface and unsupported-workload fallbacks. Main `8fd893402` is merged without changing the previously validated MegaMoE implementation.

Validation and unverified scope

Current-head CPU validation passed: 9,360 comparisons, 7,980 unchanged non-target outcomes, 1,240 identically rejected outcomes, 16 bundle plans, Python syntax, Black and Ruff. Historical GPU/AOT tests above identify their tested implementation; current-head GPU and whole-model performance remain unverified, and current CI is pending. Native MegaMoE tests are still skipped by the generic CI driver. Upstream #7290's updated timing table is included: a splitter dry-run places top-k in shard 0 and GEMM/concat-cache in shard 2 instead of packing all three into shard 4; actual new-run completion remains unverified.

PR-specific question

The tuning selector matches exactly `(experts_per_rank=48, model_dim=5120, inter_dim=2304, world_size=8, a_dtype='fp8')`. CPU comparisons cover ten model/EPR geometries, EP2/4/8, FP8/FP4, all token/capacity buckets and boundary inputs. All non-target selections, P2P quantization modes and payload-chunk wire fields remain unchanged.

Changed op tests

`op_tests/multigpu_tests/test_mega_moe_v2.py` adds the DSv4.1-Flash model geometry and valid paired-fanout routes for top-k 6. Existing V4-Pro/GLM/R1/K3 profiles do not exercise this geometry; the old paired fixture assumed a larger top-k. Reuse the canonical runner instead of adding an experimental test file.

</details>

PR state

  • PASS — pull request is marked ready for review

Copilot findings

  • PASS — no active Copilot finding lacks a substantive author reply
  • ADVISORY — Copilot did not review the current head SHA

Code and op-test hygiene

  • PASS — no committed artifact or conflict marker detected

Required CI

  • PASS — Black: passed
  • PASS — Ruff: passed
  • PASS — Repository dependency: passed
  • PASS — Aiter Test Gate: passed

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

@coderfeli
coderfeli merged commit 6d8c8e9 into main Nov 3, 2026
@coderfeli
coderfeli deleted the ghu_dsv41 branch November 3, 2026 03:24
shantipriya-amd pushed a commit to shantipriya-amd/aiter that referenced this pull request Nov 18, 2026
* [FlyDSL] Tune DSv4.1 EP8 A8W4 MegaMoE

* [FlyDSL] Preserve compile-time staging in prepare lint checks

* [FlyDSL] Replace DSv4.1 final LDS inline asm with typed copy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:multi-gpu Trigger multi-GPU op tests on PR FlyDSL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants