[DTensor] Document redistribute_costs#158495
Closed
wconstab wants to merge 6 commits intogh/wconstab/430/basefrom
Closed
[DTensor] Document redistribute_costs#158495wconstab wants to merge 6 commits intogh/wconstab/430/basefrom
wconstab wants to merge 6 commits intogh/wconstab/430/basefrom
Conversation
[ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/158495
Note: Links to docs will display an error until the docs builds have been completed. ✅ You can merge normally! (1 Unrelated Failure)As of commit 87b7510 with merge base 900fba4 ( UNSTABLE - The following job is marked as unstable, possibly due to flakiness on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
cc H-Huang awgu wanchaol fegin fduwjj wz337 d4l3k [ghstack-poisoned]
cc H-Huang awgu wanchaol fegin fduwjj wz337 d4l3k [ghstack-poisoned]
cc H-Huang awgu wanchaol fegin fduwjj wz337 d4l3k [ghstack-poisoned]
zpcore
reviewed
Jul 17, 2025
Comment on lines
+103
to
+104
| 0.0, # cost of redistributing tensor_a from 'Replicate()' | ||
| K, # cost of redistributing tensor_a from 'Shard(0)' |
Member
There was a problem hiding this comment.
What about:
0.0, # cost of redistributing tensor_a from Replicate() -> Replicate()
K, # cost of redistributing tensor_a from 'Shard(0)' -> Replicate()
cc H-Huang awgu wanchaol fegin fduwjj wz337 d4l3k [ghstack-poisoned]
[ghstack-poisoned]
Contributor
Author
|
@pytorchbot merge -i |
Collaborator
Merge startedYour change will be merged while ignoring the following 1 checks: pull / cuda12.8-py3.10-gcc9-sm75 / test (pr_time_benchmarks, 1, 1, linux.g4dn.metal.nvidia.gpu, unstable) Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Collaborator
|
Starting merge as part of PR stack under #158490 |
pytorchmergebot
pushed a commit
that referenced
this pull request
Jul 18, 2025
Fixes several bugs in the original. - foremost, fixes a serious bug where we returned incorrect strategies by mixing input_specs that were frozen from select_strategy.strategies[0] with output_specs that varied across select_strategy.strategies[0..N] (e.g. we could create a nonsense strategy like input:Shard(0) output(Replicate) for an op like clone - fixes the redistribute costs: they should not actually be 0, they should be the cost of redistributing our single input from another strategy to the current strategy, in our list of output strategies - adds a note, wondering if we should have just literally returned the input strategy instead of creating this new object - Currently, using default_strategy is incorrect becuase it maps 'self' tensor's strategies directly onto 'src' tensor without accounting for the fact that copy_ supports broadcasting a smaller rank tensor into a larger one. Separates out copy_ op from default strategy, adds missing test case, but does not fix the underlying issue with copy_, leaves that for future PR Renames to `propagate_single_input_strategy` since that's more descriptive Pull Request resolved: #158490 Approved by: https://github.com/wanchaol, https://github.com/XilunWu ghstack dependencies: #158495
pytorchmergebot
pushed a commit
that referenced
this pull request
Jul 18, 2025
The previous strategy directly used 'self' input strategy for 'src' input. The fixed strategy correctly maps the self dim to src dim so that it works even if the src input is broadcast. E.g. for this program, broadcasting will occur on dims 0,1,3 of self. ``` self = torch.ones((2,3,4,5)) src = torch.ones((4,1)) self.copy_(src) ``` These are the correct sharding combinations: | self | src | |-------|------| | Shard(0) | Replicate() | | Shard(1) | Replicate() | | Shard(2) | Shard(0) | | Shard(3) | Shard(1) | Pull Request resolved: #158538 Approved by: https://github.com/zpcore, https://github.com/XilunWu, https://github.com/wanchaol ghstack dependencies: #158495, #158490
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.
Stack from ghstack (oldest at bottom):
cc @H-Huang @awgu @wanchaol @fegin @fduwjj @wz337 @d4l3k