Repository navigation
[spmd_types] MoE sparse mesh transitions - #3654
Merged
Merged
Conversation
[ghstack-poisoned]
This was referenced Jun 13, 2026
[ghstack-poisoned]
This was referenced Jun 15, 2026
[ghstack-poisoned]
[ghstack-poisoned]
pianpwk
marked this pull request as ready for review
June 15, 2026 20:15
pianpwk
requested review from
fegin,
tianyu-l,
wconstab and
wwwjn
as code owners
June 15, 2026 20:15
[ghstack-poisoned]
[ghstack-poisoned]
tianyu-l
approved these changes
Jun 25, 2026
Comment on lines
+323
to
+324
| num_local_tokens_per_expert_E = spmd.reinterpret_mesh( | ||
| num_local_tokens_per_expert_E, spmd.current_mesh() |
Contributor
There was a problem hiding this comment.
is this no-op in erasure mode?
|
|
||
| with torch.no_grad(): | ||
| if use_spmd_types: | ||
| num_local_tokens_per_expert_EP_e = ( |
Contributor
There was a problem hiding this comment.
Technically this naming is breaking convention, which is "a single letter means one tensor dim; among multiple letters there's no _".
If we don't want to introduce another letter just for "EP", this temporary violation sounds fine. But please comment explicitly.
| num_local_tokens_per_expert_EP_e = ( | ||
| num_local_tokens_per_expert_E.view(ep_size, -1) | ||
| ) | ||
| num_global_tokens_per_local_expert_EP_e = spmd.all_to_all( |
Contributor
There was a problem hiding this comment.
I guess the if-else is because DTensor doesn't support spmd collectives?
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
submartingales
pushed a commit
to botcanlearn/torchtitan-upstream
that referenced
this pull request
Jun 26, 2026
ghstack-source-id: 35c0ab8 Pull Request resolved: pytorch/torchtitan#3654
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.
set_current_spmd_mesh(sparse_mesh)transitions for MoE region, plus mesh reinterpret at transition points, 1 assert_type re-annotation, 1 mutate_type for grouped_mmStack from ghstack (oldest at bottom):