-
Notifications
You must be signed in to change notification settings - Fork 26.3k
[DTensor] implement dist_split as a sharding prop rule #93306
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
[ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/93306
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit e1cc5d5: This comment was automatically generated by Dr. CI and updates every 15 minutes. |
[ghstack-poisoned]
[ghstack-poisoned]
wanchaol
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost ready! Have some nits and suggestions inlined.
|
|
||
| # TODO: just like slice op, split replicates before splitting | ||
| # on a sharded dimension | ||
| # TODO: shall we consider partial??? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should consider partial (maybe we can add this later), and because the dtensor_ops test does not generate partial inputs, we also need to add the partial inputs to op db
| placements=unshard_tensor_dim(input_spec.placements, dim=dim), | ||
| shape=input_spec.shape, | ||
| ndim=input_spec.ndim, | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: add a check to partial input_spec and raise NotImplementedError so we know to implement this later?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sounds good!
[ghstack-poisoned]
|
@pytorchmergebot merge -g |
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 |
| need_reshard = False | ||
| if is_tensor_dim_sharded(input_spec, dim=dim): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This somehow broke TP's code logic. Because a common technique people are using is that the DTensor is sharded on the last dim and they call split on the last dim too. We still want the result to be sharded on dim=-1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently after split, we got replicate as a DTensor.
Stack from ghstack (oldest at bottom):