Repository navigation
Add expert-parallel all-to-all comm transport - #725
Merged
Merged
Conversation
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Adds `nn/moe/v2/comm.py`: the autograd-aware all-to-all dispatch/combine transport for no-sync expert parallelism. Provides the dispatch/combine autograd ops for the symmetric-memory "VDev" path and the row-wise (incl. row-wise FP8) path, built on the symmetric-memory and MXFP8/scaled-grouped-mm kernels. Operates on plain tensors + process groups + symmetric-memory buffers. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Use the builtin `tuple` annotation instead of `typing.Tuple`. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Exercises _RowwiseCombineWeightedAutograd and _RowwiseCombineWeightedFP8Autograd on CPU with the symmetric-memory kernels monkeypatched out, checking lifetime-lease release and that the combine backward returns grads for the routing probabilities. Ported from the dev branch; the bf16 combine call is updated to the current forward() signature (expert_out_aliases_symm_expert_out + pre/post barriers). Co-authored-by: Tianhua Tao <[email protected]> Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
AkshitaB
force-pushed
the
akshitab/moe-v2-ep-comm
branch
from
June 29, 2026 21:39
1b688eb to
158a195
Compare
Each comm autograd Function returns a long positional gradient tuple (one entry per forward input, mostly None). Annotate every slot with its forward-input name and route the tuple through a shared _check_input_grads() guard that asserts the count matches and that a non-None gradient only lands on an input that requires one — catching the silent-misalignment class of bug the bare tuples invite. Also fixes _CombineVDevAutograd.backward, which returned 10 gradients for 9 forward inputs. PyTorch silently ignores extra trailing None gradients (it only errors on too-few), so this was latent; the count guard now makes it correct and explicit. A TODO(autograd-grads) on the helper points at the deeper cleanups (a name-keyed gradient builder, and collapsing the non-differentiable forward config args) for the EP consolidation. Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
Remove the 7 unused env-gated debug helpers and ~190 lines of commented-out debug-print/sync call sites that traced the rowwise symmetric-memory all-to-all. Replace them with one clearly-labeled commented hook at the combine_get site plus a one-line note on the OLMO_ROWWISE_DEBUG_PRINT env switch, so the tracing technique (routing-map dump + torch.cuda.synchronize to localize async RMA faults) is still discoverable without shipping the dead bulk. Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
Cover the comm failure modes that are exercisable in one process: routing-map validation (malformed src_ranks/probs shapes and negative nblocks are rejected before the kernel) and the hand-written rowwise SwiGLU forward/backward math (vs a reference and autograd), alongside the existing lifetime-lease / grad-probs tests. The cross-rank barrier/race and scatter modes are inherently multi-process and are covered end-to-end by the EP-vs-no-EP parity test. Co-authored-by: Tianhua Tao <[email protected]> Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
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.
Adds
nn/moe/v2/comm.py: the autograd-aware all-to-all dispatch/combine transport used by no-sync expert parallelism.It provides the dispatch/combine
torch.autograd.Functions for two transports:_DispatchVDevAutograd/_CombineVDevAutograd), and_DispatchRowwise*/_RowwiseCombineWeighted*),built on the symmetric-memory and MXFP8 / scaled-grouped-mm kernels. Everything operates on plain tensors, process groups, and symmetric-memory buffers — there is no dependency on the MoE block or model.
Depends only on
olmo_core.kernels.*(already present) and torch; the kernel extensions load lazily, so the module imports on CPU. The all-to-all ops require multiple GPUs + symmetric memory to exercise, so correctness tests run on GPU hardware and are added with the GPU test pass.🤖 Generated with Claude Code