-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
move is_checkpointable call reducing torch.compile Graph breaks #5759
Merged
tohtana
merged 5 commits into
microsoft:master
from
NirSonnenschein:torch_compile_is_checkpointable_fix_1
Jul 23, 2024
Merged
move is_checkpointable call reducing torch.compile Graph breaks #5759
tohtana
merged 5 commits into
microsoft:master
from
NirSonnenschein:torch_compile_is_checkpointable_fix_1
Jul 23, 2024
Conversation
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
We have enoucountered a performance issue when running torch compile on a model utilizing the pipeline engine (Mixtral). The issue was found to be the is_checkpointable function which is called in the engine's forward function. This function creates a graph break when using torch.compile leading to decreased performance (particularly since this happens in every forward call). We propose a change in the way is_checkpointable is checked by precomputing and storing its value before the forward call and accessing the stored values in the forward function. given this change the graph break in the forward call is avoided which should lead to better performance for torch compile.
Hi @duli2012, |
tjruwase
requested review from
tohtana and
umchand
and removed request for
duli2012
July 15, 2024 10:18
Hi @tohtana, |
tohtana
approved these changes
Jul 22, 2024
@NirSonnenschein This is a great improvement. Sorry for the delay. I just approved. |
The current test failures will be resolved after #5797 completes. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
We have encountered a performance issue when running torch compile on a model utilizing
the pipeline engine (Mixtral).
The issue was found to be the is_checkpointable function which is called in the engine's forward function.
This function creates a graph break when using torch.compile leading to decreased performance (particularly since this happens in every forward call). We propose a change in the way is_checkpointable is checked by precomputing and storing its value before the forward call and accessing the stored values in the forward function.
given this change the graph break in the forward call is avoided which should lead to better performance for torch compile.