feat(moe): FlyDSL MegaMoE fused EP-MoE integration (mega_moe_v1 @8acf…#1666
Draft
JiaoliangYu wants to merge 1 commit into
Draft
feat(moe): FlyDSL MegaMoE fused EP-MoE integration (mega_moe_v1 @8acf…#1666JiaoliangYu wants to merge 1 commit into
JiaoliangYu wants to merge 1 commit into
Conversation
…56d) ATOM_USE_FLYDSL_FUSED=1 replaces the EP experts step (dispatch+gemm1+quant+ gemm2+combine) with FlyDSL MegaMoE. Adapted from PR yanbo/mega to the current mega_moe_v1 tip (post kernels refactor ROCm#807): - fp4_utils module removed -> import gemm_common_utils (e8m0_shuffle/ shuffle_scale_w4 live there now) - w1/w1_scale use shuffle_weight_w4/shuffle_scale_w4(gate_up=True, moe_gemm= True) to match the a8w4 INTERLEAVE(g1u1) gate_mode default; the generic shuffle_weight is the SEPARATED layout and mispairs gate/up in swiglu (gsm8k ~0.017) - stash layer._mega_local_E at build; do NOT infer expert count from the shuffled _mega_w1 shape (shuffle_weight_w4 + view(-1) breaks the old shape[0]//(2*inter) inference -> experts blows up -> ~76GB mori buffer -> shmem_malloc failed) - per-layer weight swap targets mega._s1_w1/_s1_w1_scale (fused stage-1 runtime pointers); forward_bf16 is aliased to forward - build MegaMoE and run forward under inference_mode(False)+no_grad so its persistent mori buffers are normal tensors (cudagraph capture does in-place .zero_() outside inference mode) - empty_cache after weight build; warmup/dummy token scatter Validated on DeepSeek-V4-Pro a8w4, 8x MI355X (gfx950), fused ON / EPLB OFF: gsm8k 3-shot flexible=strict=0.9424 (on par with mori/EPLB baseline ~0.95). Runtime env: ATOM_USE_FLYDSL=1 ATOM_USE_FLYDSL_FUSED=1 ATOM_FLYDSL_KERNELS_PATH=<FlyDSL mega_moe_v1>; launch with --max-num-batched-tokens 8192 (keeps mtpr<=8192; larger overflows a stage2 int32 kernel arg). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
🏷️ CI GuideRuns automatically on every eligible PR before approval:
Heavy model tests:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ATOM_USE_FLYDSL_FUSED=1 replaces the EP experts step (dispatch+gemm1+quant+ gemm2+combine) with FlyDSL MegaMoE. Adapted from PR yanbo/mega to the current mega_moe_v1 tip (post kernels refactor #807):
Validated on DeepSeek-V4-Pro a8w4, 8x MI355X (gfx950), fused ON / EPLB OFF: gsm8k 3-shot flexible=strict=0.9424 (on par with mori/EPLB baseline ~0.95).
Runtime env: ATOM_USE_FLYDSL=1 ATOM_USE_FLYDSL_FUSED=1 ATOM_FLYDSL_KERNELS_PATH=; launch with --max-num-batched-tokens 8192 (keeps mtpr<=8192; larger overflows a stage2 int32 kernel arg).
Motivation
Technical Details
Test Plan
Test Result
Submission Checklist