-
Notifications
You must be signed in to change notification settings - Fork 25.7k
[FSDP2] Added _set_unshard_async_op
#135523
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/135523
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 266fc37 with merge base b7eb725 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
cc XilunWu H-Huang kwen2501 wanchaol fegin fduwjj wz337 wconstab d4l3k c-p-i-o [ghstack-poisoned]
|
@awgu has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
|
@pytorchbot merge |
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 |
This PR adds a private API `_set_unshard_async_op` that allows for running pre-forward and pre-backward all-gathers using the `async_op=True` path so that all-gather allocations happen in the default stream to avoid inter-stream fragmentation. If using this option, forward requires explicit prefetching e.g. via the `unshard(async_op=True)` API for overlap. fp32 -> bf16 casts and the all-gather copy-in will not overlap with compute. Differential Revision: [D62401551](https://our.internmc.facebook.com/intern/diff/D62401551) Pull Request resolved: pytorch#135523 Approved by: https://github.com/weifengpy
Stack from ghstack (oldest at bottom):
_set_unshard_async_op#135523This PR adds a private API
_set_unshard_async_opthat allows for running pre-forward and pre-backward all-gathers using theasync_op=Truepath so that all-gather allocations happen in the default stream to avoid inter-stream fragmentation.If using this option, forward requires explicit prefetching e.g. via the
unshard(async_op=True)API for overlap. fp32 -> bf16 casts and the all-gather copy-in will not overlap with compute.cc @XilunWu @H-Huang @kwen2501 @wanchaol @fegin @fduwjj @wz337 @wconstab @d4l3k @c-p-i-o
Differential Revision: D62401551