Repository navigation
[FlyDSL] feat(mega_moe): optimize fused stage1 and AOT bundles - #5001
Merged
Merged
Conversation
Contributor
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
PR title tags: |
GwilliamHu
force-pushed
the
megamoe_aot_pr_20260826
branch
from
August 31, 2026 21:01
4147bfb to
b2807e8
Compare
Add profile-bundled Stage1/Stage2 compilation, deterministic cache identity, and latest-FlyDSL-compatible AOT loading. Optimize compact dispatch publication and consumer scheduling while preserving fixed-slot behavior. Remove superseded dispatch paths, dead compile-time switches, unused helper arguments, and invariant config fields; add CPU protocol and bundle coverage.
GwilliamHu
force-pushed
the
megamoe_aot_pr_20260826
branch
from
September 1, 2026 09:18
727885e to
324a0ee
Compare
This reverts commit 324a0ee.
coderfeli
approved these changes
Sep 8, 2026
JiaoliangYu
approved these changes
Sep 8, 2026
1 task
1 task
coderfeli
pushed a commit
that referenced
this pull request
Sep 9, 2026
RolaoDenthu
added a commit
to RolaoDenthu/sglang
that referenced
this pull request
Nov 16, 2026
With SGLANG_AITER_MEGA_RANK_SYNC, an idle DP rank in a prefill step ran a fabricated one-token extend through the whole forward, and fed MegaMoE a fabricated row. Only the idle rank accounted for that row: it rewrote its global_num_tokens to [1] * N, while the busy ranks kept [N, 0, ...]. When those counts are DP-global, collectives outside the MoE that size their buffers from them disagree across ranks, so the DeepSeek-V4.1 Engram per-rank lookup hung in RCCL during warmup. aiter MegaMoEv2 already handles a rank with zero tokens (ROCm/aiter#5001): it quantizes zero rows and gives that rank the smallest bundle configuration, so the rank still joins the collective dispatch. CUDA MegaMoE likewise lets idle ranks enter with zero rows. So remove the fabrication. Idle ranks stay IDLE, every rank sees the real token counts, and an idle rank enters MegaMoEv2 with zero rows, with or without SGLANG_AITER_MEGA_RANK_SYNC.
RolaoDenthu
added a commit
to RolaoDenthu/sglang
that referenced
this pull request
Nov 30, 2026
With SGLANG_AITER_MEGA_RANK_SYNC, an idle DP rank in a prefill step ran a fabricated one-token extend through the whole forward, and fed MegaMoE a fabricated row. Only the idle rank accounted for that row: it rewrote its global_num_tokens to [1] * N, while the busy ranks kept [N, 0, ...]. When those counts are DP-global, collectives outside the MoE that size their buffers from them disagree across ranks, so the DeepSeek-V4.1 Engram per-rank lookup hung in RCCL during warmup. aiter MegaMoEv2 already handles a rank with zero tokens (ROCm/aiter#5001): it quantizes zero rows and gives that rank the smallest bundle configuration, so the rank still joins the collective dispatch. CUDA MegaMoE likewise lets idle ranks enter with zero rows. So remove the fabrication. Idle ranks stay IDLE, every rank sees the real token counts, and an idle rank enters MegaMoEv2 with zero rows, with or without SGLANG_AITER_MEGA_RANK_SYNC.
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.
Motivation
Improve DeepSeek-V4-Pro MegaMoE A8W4 end-to-end performance while reducing communication-buffer memory usage and preserving 8-GPU correctness across dynamic MTPR configurations.
Technical Details
Fuse activation quantization with dispatch preparation.
Overlap Stage1 communication and GEMM through finite producer dispatch, producer auto-retirement, and consumer tile scheduling.
Deduplicate common dispatch payloads.
Improve Stage2 scheduling and common-row processing.
Add DeepSeek-V4-Pro AOT bundles for EPR 48/52/56 and MTPR 8192/16384/32768.
Harden synchronization, cache/preload handling, and remove obsolete experimental paths.
Test Plan
Run 8-GPU correctness and CUDA Graph replay tests for:
Validate JIT and cross-process AOT execution.
Run DeepSeek-V4-Pro full-network benchmarks at concurrency 512/4096 and request rates 0.8/1.0.
Run Python compile, Black, Ruff, and diff checks.
• ## Test Result
Environment
rocm/atom-dev@sha256:a5cfa1ab503af6e0f55e0ed83cd7e999edbea6940a38dba44aaeee9a227589761e7659fde32eeaa0d9aa868c3e90847e5e46a51c065280213fb28f1b574b08333a1a05c05df2a1952.10.0+rocm7.2.4.git3d3aa833, HIP7.2.53211Full-network throughput
Correctness and stability
MTPR=MAX: 15/15 8-GPU CUDA Graph cases passed.MTPR=tokens: 15/15 cases passed.SGLang end-to-end performance
AgentX variable-length trace replay, concurrency 64
Workload:
inferencex-agentx-mvp, Weka/Claude-Code trajectories, 900-second profiling window, random seed 42.SGLang environment
1ce08ce230011be15ad52080d12ff96ce01a5306884cc79c8291b599b067b5edd0003d35b40691125853cf35377eb4e1433a075ce7a9d6fa0beed15d31cfb4a0286fc9f0cf25498d07f937640cd1295d0.3.22.10.0+rocm7.2.4.git3d3aa833/7.2.53211Submission Checklist