-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
[DTensor] implement dist_split as a sharding prop rule #93306
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-source-id: 17951d93ac33b0c1c58caf83c2767cb91c121494 Pull Request resolved: #93306
[ghstack-poisoned]
ghstack-source-id: 737cb0f8c42183cc069c23d2bb219422fe0541e1 Pull Request resolved: #93306
[ghstack-poisoned]
ghstack-source-id: 95deefbd55f41ae0d2985935c086b577eb7b8021 Pull Request resolved: #93306
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]
ghstack-source-id: fb8f5360b3a521480329ed2fa2a817c2de018161 Pull Request resolved: #93306
@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):