Add an opt-in AutoEP non-MoE regional compile mode - #8380
Draft
yh0903 wants to merge 6 commits into
Draft
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: yh0903 <helloyu0903@gmail.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: yh0903 <helloyu0903@gmail.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: yh0903 <helloyu0903@gmail.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: yh0903 <helloyu0903@gmail.com>
…moe-regional-compile
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: yh0903 <helloyu0903@gmail.com>
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.
Summary
engine.compile(compile_mode="autoep_non_moe")mode that regionally compiles decoder blocks containing AutoEP layersAutoEPMoELayer.forwardas an explicit compiler-disabled graph break, so routing, token movement, expert compute, and AllToAll collectives remain eagermodel.layerstraversalThe default
engine.compile()behavior and the default eager AutoEP path are unchanged.Support boundary
This first version uses vanilla
torch.compile/Inductor with the standard AutoEPcommbackend, sequence and pipeline parallel sizes of one, and ZeRO stages 0, 1, and 2. Distributed performance and parity validation currently target ZeRO stage 1.DeepEP, DeepCompile, AutoEP+AutoTP folding, sequence or pipeline parallelism, ZeRO stage 3, optimizer or parameter offload, compiled autograd, DeepCompile schedules, and any
fullgraphordynamicvalue other thanFalseare rejected.Performance
Qwen3-30B-A3B, 48 layers, EP16, sequence length 1024, BF16, activation checkpointing enabled, fixed routing, 2x8 H100. Each allocation discarded one fixed warm arm and used two runs per variant.
Both allocations reduced peak allocated memory by 1.60 GiB and peak reserved memory by 2.01 GiB. The maximum paired loss differences were 0.00617 and 0.00194. All 16 ranks reported zero Dynamo counter changes in the measured window and exactly 2,880 eager AutoEP calls per compiled arm (
30 steps x 48 layers x forward/replay).An exact same-stack Nsight census explained the clean E2E improvement:
Compiled execution also removed 1.59 GiB of D2D traffic per captured step. These performance runs used the PR1+PR2+PR3 benchmark stack (#8326, #8331, and #8359) to isolate the remaining Transformer/runtime fragmentation. This PR is based directly on
masterand has no code dependency on those changes.Project rebaseline
This is context for the broader AutoEP optimization effort, not a merge gate for this PR. A same-allocation fixed-routing
discard + ABBA + BAABcomparison of the full #8326 + #8331 + #8359 + #8380 stack against Megatron Core measured:The current residual is 72.64 ms / AutoEP +8.9%. All four paired deltas favored Megatron and stayed within 66.55–77.19 ms; AutoEP used 1.30 GiB less allocated and 0.51 GiB less reserved memory.
A separate low-overhead outer CUDA-event trace placed the typical residual primarily in:
The AutoEP tail is not a measured-window recompilation. In both traced AutoEP arms, step 27's forward increased from a typical 266–271 ms to 678 ms while backward and optimizer remained near their medians. With only ten measured steps per arm, the reported p95 is the maximum sample; this deterministic forward-only spike is a follow-up investigation rather than evidence that regional compile regressed the typical path.
Testing Done
pre-commit run --filespassed for all five changed filesdynamic=None,fullgraph=None, DeepEP, sequence parallelism, and pipeline parallelism🤖 Generated with GitHub Copilot CLI