-
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
[FSDP] Use correct handle training state when prefetching #98249
Closed
Closed
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
e381c7e
[FSDP] Use correct handle training state when prefetching
awgu 12e0dae
Update on "[FSDP] Use correct handle training state when prefetching"
awgu 48f5cc9
Update on "[FSDP] Use correct handle training state when prefetching"
awgu 86bb839
Update on "[FSDP] Use correct handle training state when prefetching"
awgu 971d2c1
Update on "[FSDP] Use correct handle training state when prefetching"
awgu 58bfb34
Update on "[FSDP] Use correct handle training state when prefetching"
awgu File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains 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
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.
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.
what improvement does doing this provide if there's no functionality difference?
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.
For
_use_unsharded_views(as_params=....)
,as_params
depends on the handle's_training_state
.For example, suppose we are backward prefetching with
BACKWARD_PRE
and handleh1
prefetches handleh2
.h2._training_state
isIDLE
.h1._training_state
isBACKWARD_PRE
.h2._training_state = BACKWARD_PRE
, while we prefetch the unshard, so thatas_params
in_use_unsharded_views()
will correctly useas_params=False
instead ofTrue
._use_unsharded_views()
will useas_params=True
, which is actually incorrect for reentrant checkpointing.I need to investigate more, but I think our FSDP <> AC unit tests were too weak to catch this bug that I introduced in #97981. Before #97981, we would just override the prefetched unshard with the correct
_use_unsharded_views(as_params=...)
. However, after #97981, we skip the second overriding_use_unsharded_views(as_params=...)
. With this PR, we still skip the second overriding_use_unsharded_views()
, but that is no longer an issue since the first prefetched_use_unsharded_views()
uses the correct training state and hence the correctas_params
.