Derive AutoEP rank splits from the per-expert count exchange - #8190
Open
yh0903 wants to merge 3 commits into
Open
Derive AutoEP rank splits from the per-expert count exchange#8190yh0903 wants to merge 3 commits into
yh0903 wants to merge 3 commits into
Conversation
yh0903
requested review from
hwchen2017,
loadams,
tjruwase and
tohtana
as code owners
July 29, 2026 05:19
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 58cfe55c7b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
yh0903
force-pushed
the
autoep-split-plan
branch
2 times, most recently
from
July 29, 2026 07:42
61004db to
aaf9f82
Compare
compute_split_plan ran two all-to-all exchanges over overlapping metadata: one on the [ep_size] per-rank totals to produce output_splits, and one on the [ep_size, E_local] per-expert count matrix to produce local_counts. Row s of the received matrix holds the per-local-expert counts sent by source rank s, so summing it over experts reproduces exactly what the first exchange returned. Drop the rank-total exchange and derive output_splits from the detailed one. Both split lists are now copied to the host through a single stacked .cpu() call rather than two. compute_split_plan_from_expert_indices shares the same helper instead of duplicating the logic. Signed-off-by: yh0903 <helloyu0903@gmail.com>
yh0903
force-pushed
the
autoep-split-plan
branch
from
July 29, 2026 18:10
aaf9f82 to
4bab09c
Compare
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.
Redundancy
compute_split_plan(deepspeed/module_inject/auto_ep_layer.py) runs two all-to-all exchanges over overlapping metadata:The second exchange already contains the first.
received_counts[s, e]is the number of tokens source rankssends to local experte, soelement-wise and exactly — the first exchange transmits a strict projection of what the second one transmits.
The planner also issued two separate
.cpu()calls, each of which is a device-to-host sync.Fix
Drop the rank-total exchange and derive
output_splitsfrom the detailed one:Per split-plan call this changes:
compute_split_plan_from_expert_indices(folded-TP path) now shares the same helper instead of duplicating the logic.Only metadata is affected. The dispatch/combine payload
_AllToAllVcalls are untouched.Measurements
EP=8 (2 nodes x 8 H100), 256 experts, 1024 tokens/rank, top_k=8, 50 trials, p50 of split-plan time per layer:
Collective time alone goes 0.120 ms -> 0.058 ms, consistent with halving the number of exchanges. The saving is flat across skew because what is removed is fixed per-call overhead, not payload-dependent work. For a 20-layer MoE model this is ~3.5 ms per forward pass.
Tests
tests/unit/v1/moe/test_autoep_unit.py::TestSplitPlanadds:output_splitsequal the per-rank totals, for every rank and three token distributions;SplitPlanfields are identical;compute_split_plan_from_expert_indicesproduces an identical plan for the same routing assignment.