-
Notifications
You must be signed in to change notification settings - Fork 8
Remove DTensor accumulateGrad overhead #193
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
Open
fmassa
wants to merge
2
commits into
main
Choose a base branch
from
fmassa/remove_dtensor_overhead
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
Oops, something went wrong.
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.
one thing that seems at least a bit nicer about this compared to the SimpleFSDP setup is that since we are calling compile ourselves, we don't actually have to worry about these hooks causing graph breaks (since we are calling compile manually on the fw/bw graphs instead of the user calling compile on the entire module themselves). Although I guess we still have the "composability risk" of the params being implicitly-sharded plain tensors rather than DTensors.
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.
Yes, indeed the AutoParallel case is simpler than in SimpleFSDP, but the general idea for SimpleFSDP was to introduce graph breaks only at the outer-most FSDP block (which performs the fwd / bwd hooks).
If the model has no graph breaks, then it would hopefully be equivalent to having a single full-graph, as the graph break introduced by this change would be in outer-most wrapper.
Does it make sense?
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.
yep, I think we're on the same page - in the SimpleFSDP setup, even if we force the graph break on the top-level module that has the backward hooks, we can still expect to capture all of the model's actual compute/comms in a single graph in the inner module.
The only thing I really meant by my comment is that "graph breaks are spooky" (at the very least they add noise to tlparse), so compiling only the the stuff inside the wrapper feels a tiny bit nicer (but the graph break idea for SimpleFSDP still seems perfectly reasonable)