Repository navigation
[FlyDSL] [Perf] Extend MegaMoE internode to EP32 A8W4 and tune the single-kernel pipeline - #8082
Conversation
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: Reviews: |
WAITING ON AUTHORPR Self-ReviewRevision 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
Edit the Missing or invalid answers
Shadow mode reports what would block but keeps the status successful. Set |
2e7bdf2 to
85db65e
Compare
Extend MegaMoE dispatch, reduction and return credits to four logical nodes using separate local and bounded rail windows. Support virtual 4x4 through CROSSNODE/WORLD peers, and bind separate-window SDMA to the local DevComm. Size inverse maps, counters and scratch spans from the actual topology; keep RAIL requests disjoint from the SDMA signal epoch. Include AITER PR #7542 K3 A8W4 tuning and masked EP changes. Restore the historical Stage1 BM128 M16 schedule after the M32 addition did not show an overall gain. Retain historical epilogue/quant and Stage2 M16 changes, EP32 input addressing, and version the restored Stage1 cache identity. Document physical 4x8 and virtual 4x4 launch configurations and the MORI b80cbe4 dependency patch. The M32 version plus the scratch fix completed the physical EP32 K3 numerical sweep; its TPR4096 timing anomaly remains unresolved. The restored M16 schedule has not been rerun on EP32. Validation: full base-diff Black 26.10.1, repository Ruff 0.16.0, Python/shell parsing, whitespace and CK dependency checks, and pytest 8.3.4 CPU pre-checks (117 passed). Nine single-GPU M16 cases match the historical payload and scales byte for byte. Physical EP16 M16 passed 20 K3 cases plus three targeted repeats: 368 fused and 161 independent Small-op checks, with the existing 0.05 relL2 threshold.
Support BM96 GEMM1 tile groups and overlap GEMM2 activation DMA with staged weight and scale preloads. Pass the generation through the single-kernel handoff, invalidate L2 once per XCD, and limit node-reduce workers. Separate Stage1 sealing from credit returns and defer Stage2 credits until parity-slot reuse. Select the pipeline and communication geometry through scoped A8W4 tuning rows. Signed-off-by: james-huang09 <[email protected]>
Move per-GPU GMM1 intermediates into private device storage, align local CCO allocations for pooled communicators, and support stock MORI window registration while retaining compatibility with the optional local-only API. Extend the unrolled GEMM2 pipeline to FP4, select remote fan-out by arrival, and allow GMM1-skipping CTAs to prepare the SDMA plan. Make quantization and topology explicit in tuning and respect the selected split-local setting. Key experimental modes in the compile caches, validate their parameters, and adapt the existing buffer-address probe for private storage.
Improve dispatch/GEMM1 and GEMM2/reduce/combine scheduling with relaxed handoff, early SDMA planning and parallel/deferred credit exchange. Keep GMM1 intermediates in private device storage and use stock MORI window registration for communication buffers. Consolidate device helpers and select tile geometry, fanout, local splitting, communication paths and return chunks through the EP16 A4W4/A8W4 and EP32 A8W4 tuning table. Extend the existing internode test with real EP16/EP32 launch support, MORI V2LL reference and small-op paths, replay correctness checks, and global minimum and mean-of-rank-means over the last 20 timed replays. Signed-off-by: james-huang09 <[email protected]>
Reuse existing GEMM, scale, address and synchronization helpers and remove unreachable Stage1 and Stage2 paths. Preserve the active pipeline while simplifying tile sealing, credit handling and SDMA token-ready reduction. Size receive storage from the explicit receive-route limit or the full routing bound. Select bounded rail windows and an owned local communicator above TPR 1024, including cleanup and xGMI fallback when SDMA is unavailable. Validate architecture, weight storage, routing tensors, activation options and launch devices before execution, including FlyDSL-wrapped streams. Update the existing internode test to size its CCO pool for the new capacity rules and use multiple windows for larger token capacities. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Signed-off-by: james-huang09 <[email protected]>
Prepare the A8W4 small-op gate/up W1 layout from the same quantized weights used by MegaMoE internode and reuse its A16W4 W2 layout. Keep the extra W1 tensors optional and create them only for the A8W4 small-op path, removing the test_wide_ep_moe weight helper dependency.
Remove the optional two-launch host branch and its environment switch. Keep group-ready enabled and reserve independent Stage1 and Stage2 QP contexts using the existing single-kernel configuration. Drop stale timing and profiling results from comments while retaining the technical rationale, and clarify the standalone Stage2 helper docs.
4254ff0 to
bd6bdd1
Compare
Summary
Extend MegaMoE internode to physical four-node EP32 and improve the A8W4 dispatch, GEMM, and combine pipeline on MI355X. The operator can run Stage1 and Stage2 in one persistent kernel, overlap GEMM2 activation DMA with weight and scale preloads. The host interface now validates its inputs up front, reads the caller's weights in place, and sizes its receive storage from an explicit limit or the full routing bound.
Motivation
Small-token expert-parallel workloads spend a substantial part of their latency on communication, readiness polling, and the transition between GEMM stages. The Stage1/Stage2 handoff reloads generation state and repeatedly invalidates cache lines. This change reduces that work while retaining per-group readiness and parity-slot protection.
Changes
Pipeline:
g-2before reusing the same parity slot.Performance
Hardware: MI355X (
gfx950), two physical nodes with eight GPUs each (EP16). Workload: Kimi K3, hidden 3584, intermediate 3072, 896 experts, TopK 16, A8W4, SiTUv2 (beta=4,linear_beta=25), seed 781.The table reports complete-forward GPU Event latency, including input quantization, dispatch, expert MLP, and combine. After 10 warmup replays, 40 timed replays are recorded. For each rank, take the minimum of its 40 samples, then average those minima across the 16 ranks:
mean(rank min). Values are in microseconds.EP16 (2 nodes) — K3
EP16 (2 nodes) — dsv4.1
EP32 (4 nodes) — K3
These results use the submitted EP16 A8W4 tuning CSV. All buckets use the single-kernel path; intra-node transport is xGMI through TPR 1024 and SDMA from TPR 2048. The sweep covers 20 cases (10 token counts × random/EPLB), with all 320 aggregate checks passing.
MegaMoE validation:
Entry:
op_tests/multigpu_tests/test_megamoe_internode.py, launched withtorchrunon two (EP16) or four (EP32) physical MI355X (gfx950) nodes, eight workers per node.Routing: all numbers below use the
eplbfixture: deterministic routing where every rank receives the same number of routes (TPR × TopK) and every local expert the same load. The test's default is--fixtures eplb,random, so pass--fixtures eplbexplicitly to reproduce the tables. This PR targets balanced routing; therandomfixture (rank-balanced, one hot expert per rank) was spot-checked at EP16 K3 A8W4 TPR 128 (MegaMoE 366 µs vs small-op 400 µs, accuracy passed). Skewed-load fixtures (hot-rank0,zipf-*,rank-mixed-skew,permuted) are not tuned in this PR.Command (per node;
$NN= 2 or 4):