[DTensor] single-dim strategy validation infra#172990
Closed
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/172990
Note: Links to docs will display an error until the docs builds have been completed. ✅ You can merge normally! (5 Unrelated Failures)As of commit f5bc08e with merge base 0f84569 ( FLAKY - The following jobs failed but were likely due to flakiness present on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
wconstab
approved these changes
Jan 24, 2026
Contributor
wconstab
left a comment
There was a problem hiding this comment.
Generally sgtm. I also started working on a design for this, including the full enumeration and also testing existing non single dim rules. Let's discuss next week, could land this first and then extend
Contributor
Author
|
@pytorchbot merge |
Collaborator
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
riccardofelluga
pushed a commit
to riccardofelluga/pytorch
that referenced
this pull request
Jan 27, 2026
For any proposed (op, sample inputs, sharding prop rule: i.e. input -> output placements), you can rule out if this is a valid sharding prop rule with: 1. Run the op on full_tensor inputs, to get the reference full_tensor output 2. Get the local_tensor inputs, according to the input placements 3. Run the local op 4. Redistribute local outputs to Replicate, according to the output placements 5. Check full_tensor shapes & numerics against reference This runs this validation against OpInfo entries for aten ops with registered single-dim rules, enumerating all the strategies and replacing ShardPlaceholder -> Shard. A future extension could be: by exhaustively enumerating all single-dim strategies on R/S/P, we could check if any prop rules are potentially missing. However this can see false positives (e.g. Partial with zero tensors), so likely that shouldn't be a hard error, and maybe shouldn't be a "test". checked by turning on single-dim rules in - mm: https://github.com/pytorch/pytorch/blob/578744826f3011dcb14c0e437e709d7110559367/torch/distributed/tensor/_ops/_matrix_ops.py#L353 - pointwise ops: https://github.com/pytorch/pytorch/blob/578744826f3011dcb14c0e437e709d7110559367/torch/distributed/tensor/_ops/_pointwise_ops.py#L837-L839 - cat: https://github.com/pytorch/pytorch/blob/578744826f3011dcb14c0e437e709d7110559367/torch/distributed/tensor/_ops/_tensor_ops.py#L828 Pull Request resolved: pytorch#172990 Approved by: https://github.com/wconstab
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.
For any proposed (op, sample inputs, sharding prop rule: i.e. input -> output placements), you can rule out if this is a valid sharding prop rule with:
This runs this validation against OpInfo entries for aten ops with registered single-dim rules, enumerating all the strategies and replacing ShardPlaceholder -> Shard.
A future extension could be: by exhaustively enumerating all single-dim strategies on R/S/P, we could check if any prop rules are potentially missing. However this can see false positives (e.g. Partial with zero tensors), so likely that shouldn't be a hard error, and maybe shouldn't be a "test".
checked by turning on single-dim rules in
pytorch/torch/distributed/tensor/_ops/_matrix_ops.py
Line 353 in 5787448
pytorch/torch/distributed/tensor/_ops/_pointwise_ops.py
Lines 837 to 839 in 5787448
pytorch/torch/distributed/tensor/_ops/_tensor_ops.py
Line 828 in 5787448