Repository navigation
[spmd_types] fix MoE sequence-sharded combine - #3664
Merged
Merged
Conversation
[ghstack-poisoned]
This was referenced Jun 13, 2026
[ghstack-poisoned]
This was referenced Jun 15, 2026
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
submartingales
pushed a commit
to botcanlearn/torchtitan-upstream
that referenced
this pull request
Jun 16, 2026
ghstack-source-id: 8cb1e19 Pull Request resolved: pytorch/torchtitan#3664
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
pianpwk
added a commit
that referenced
this pull request
Jun 26, 2026
[ghstack-poisoned]
pianpwk
added a commit
that referenced
this pull request
Jun 26, 2026
`set_current_spmd_mesh(sparse_mesh)` transitions for MoE region, spmd.all_to_all switch, plus mesh reinterprets, assert_type, mutate_type Stack from [ghstack](https://github.com/ezyang/ghstack/tree/0.12.0) (oldest at bottom): * #3740 * #3690 * #3673 * #3655 * #3741 * #3664 * __->__ #3654
submartingales
pushed a commit
to botcanlearn/torchtitan-upstream
that referenced
this pull request
Jun 26, 2026
Teach MoE combine to derive its padded token count from local batch size and local sequence length, and make the spmd_types dense-SP path use the already-local sequence length instead of recomputing from a global shape. Test Plan: - PYTHONPATH=/data/users/pianpwk/full_spmd_types_torchtitan/pytorch:/data/users/pianpwk/full_spmd_types_torchtitan/tt4_spmd_types/torchtitan:/data/users/pianpwk/spmd_types /home/pianpwk/.conda/envs/full_spmd_tt/bin/python -m py_compile torchtitan/models/common/moe.py torchtitan/models/common/moe_sharding.py torchtitan/models/common/token_dispatcher.py torchtitan/models/gpt_oss/moe.py - git diff --check -- torchtitan/models/common/moe.py torchtitan/models/common/moe_sharding.py torchtitan/models/common/token_dispatcher.py torchtitan/models/gpt_oss/moe.py - spmd_types Qwen3 MoE 8-GPU sweep with --debug.spmd_typechecking, SP on/off, CP on/off, FSDP, plus SP-off/CP-off inference-simulation config; all passed with activation-checkpoint:none Pull Request resolved: pytorch/torchtitan#3664 ghstack-source-id: 0f5618e
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.
Fix spmd_types SP-padding support, by requiring evenly sharded seq-dim for MoE input activations, calculating post-combine output size based on local tensor shapes.
Raises in trainer for MoE + uneven seq-dim sharding.
Stack from ghstack (oldest at bottom):