Repository navigation
[spmd_types] add parallelism.spmd_backend config - #3466
Merged
Merged
Conversation
[ghstack-poisoned]
This was referenced May 31, 2026
[ghstack-poisoned]
pianpwk
marked this pull request as ready for review
June 1, 2026 20:18
pianpwk
requested review from
SherlockNoMad,
aditvenk,
fegin,
sanketpurandare,
tianyu-l,
wconstab,
wwwjn,
xmfan and
yiming0416
as code owners
June 1, 2026 20:18
This was referenced Jun 1, 2026
tianyu-l
approved these changes
Jun 2, 2026
|
|
||
| full_dtensor: bool = False | ||
| """Whether to use full DTensor mode.""" | ||
| spmd_backend: Literal["default", "full_dtensor", "spmd"] = "default" |
Contributor
There was a problem hiding this comment.
Suggested change
| spmd_backend: Literal["default", "full_dtensor", "spmd"] = "default" | |
| spmd_backend: Literal["default", "full_dtensor", "spmd_types"] = "default" |
|
|
||
| - "default": use the existing TorchTitan parallelism paths. | ||
| - "full_dtensor": use the existing full DTensor path. | ||
| - "spmd": use the new local-tensor SPMD path. |
Contributor
There was a problem hiding this comment.
just say spmd_types
it's not only about "local-tensor"
| """Choose the base RNG seed used for training""" | ||
|
|
||
| spmd_typechecking: bool = False | ||
| """Enable global SPMD type checking for the local-tensor SPMD backend.""" |
Contributor
There was a problem hiding this comment.
say something like
- only effective under spmd_backend=="spmd_types"
fegin
approved these changes
Jun 5, 2026
fegin
left a comment
Contributor
There was a problem hiding this comment.
LGTM, but I think we should consider to use StrEnum in the future.
[ghstack-poisoned]
This was referenced Jun 5, 2026
pianpwk
added a commit
that referenced
this pull request
Jun 5, 2026
Adds the spmd_types integration to titan part-by-part, starting from replacing the `torch.distributed.tensor.parallel.loss_parallel()` DTensor-based context manager with a manually written `_LossParallelCrossEntropy` custom autograd function. Written to support uneven sharding (on last rank), IGNORE_INDEX, verified bitwise against loss_parallel() in test cases. The PR adds spmd_types requirement to titan, as it includes typecheck_forward & testing. Not yet wired into the training path - the later stack will wire it for the spmd backend path, but likely leaves DTensor & plain-tensor on the loss_parallel() path for now. Stack from [ghstack](https://github.com/ezyang/ghstack/tree/0.12.0) (oldest at bottom): * #3551 * #3550 * #3278 * #3472 * #3468 * #3471 * #3253 * #3501 * #3466 * __->__ #3467
[ghstack-poisoned]
[ghstack-poisoned]
saforem2
added a commit
to saforem2/torchtitan
that referenced
this pull request
Jun 7, 2026
…tor still TODO Documents the 34-commit pull from upstream/main (27aa490..641b5f6, merge commit fb1c5a3, sitting in worktree ezpz-46th-47th-sync). Two structural refactors hit ezpz: - PR pytorch#3458 (RoPE refactor): REPLAYED in commit 02dd1e7, verified by importing + building all agpt + moe flavors under the torch 2.13 venv. Numerics smoke against baselines still pending. - PR pytorch#3269 (mixed-optimizer refactor): NOT YET STARTED. Affects OptimizersContainer.Config + 8 custom container subclasses in optimizer/containers.py + ~13 callsites in agpt/moe/competition config registries. Also documents that spmd_types==0.2.1 was installed into .venv (new upstream runtime dep from PR pytorch#3466/pytorch#3467/pytorch#3560) and notes the open follow-ups (replay PR pytorch#3269, smoke against baselines, audit RL). Doesn't update upstream-sync.md's "next-sync" reminder banner — this sync isn't complete yet (ezpz branch is not on the worktree HEAD).
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.
The initial thought for spmd_types + titan was to kill the legacy & full_dtensor paths at once. As managing that became harder (lots of bitwise configs, ongoing model/full_dtensor work), we settled on having it as a 3rd path in the short-term, under
parallelism.spmd_backend: Literal["default", "full_dtensor", "spmd"] = "default"This PR just adds the flag and modifies existing uses of
.full_dtensor, banning spmd backend until it's enabled.Stack from ghstack (oldest at bottom):