Skip to content
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

[FSDP] Do not _unshard if already prefetched #97981

Closed
wants to merge 4 commits into from

Conversation

@pytorch-bot
Copy link

pytorch-bot bot commented Mar 30, 2023

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/97981

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit c789061:
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@pytorch-bot pytorch-bot bot added the release notes: distributed (fsdp) release notes category label Mar 30, 2023
awgu added a commit that referenced this pull request Mar 30, 2023
ghstack-source-id: d8149d2f96f14b8a60393371ce16c328264753ca
Pull Request resolved: #97981
awgu added a commit that referenced this pull request Mar 30, 2023
ghstack-source-id: 9d76f160eb1e37ede7485773d6344e632a61042b
Pull Request resolved: #97981
awgu added a commit that referenced this pull request Mar 30, 2023
ghstack-source-id: dd1c57e7790d0bca8ff3a780b17168391d60ba3a
Pull Request resolved: #97981
@awgu awgu added the topic: not user facing topic category label Mar 30, 2023
awgu added a commit that referenced this pull request Mar 30, 2023
ghstack-source-id: b952c9ea2446a3d4c11e235854a169b60c41488d
Pull Request resolved: #97981
@awgu awgu added the ciflow/trunk Trigger trunk jobs on your pull request label Mar 31, 2023
@awgu awgu marked this pull request as ready for review March 31, 2023 16:00
Copy link
Contributor

@fegin fegin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@awgu
Copy link
Contributor Author

awgu commented Mar 31, 2023

@pytorchbot merge

@pytorchmergebot
Copy link
Collaborator

Merge started

Your 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

Advanced Debugging
Check the merge workflow status
here

awgu added a commit that referenced this pull request Apr 3, 2023
- This undoes #97981 due to a minor concern: The unshard logic (namely the `_use_unsharded_flat_parameter()` -> `_use_unsharded_views()` logic) for a handle depends on its own training state, not on that of the handle that prefetched it. Therefore, we actually want the handle itself to run `_use_unsharded_flat_parameter()`, not the handle that is prefetching. Otherwise, the handle could still be in `IDLE` but is being prefetched from another handle in `BACKWARD_PRE`, in which case the original handle does not correctly use the logic as if it were in `BACKWARD_PRE`.
- Instead, we only run the `_use_unsharded_flat_parameter()` when the handle itself is running `unshard()`, which we differentiate using the `is_prefetch: bool` flag.



[ghstack-poisoned]
@facebook-github-bot facebook-github-bot deleted the gh/awgu/371/head branch June 8, 2023 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ciflow/trunk Trigger trunk jobs on your pull request Merged release notes: distributed (fsdp) release notes category topic: not user facing topic category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants