This repository was archived by the owner on Aug 1, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 129
Backend Agnostic Minifier for TorchDynamo produced Fx Graphs #1056
Merged
Conversation
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
16cd634 to
6686847
Compare
Can we use export? I believe it has a very similar api to make_fx, in that it takes a callable and args and produces an fx graph. |
e35c50b to
06b9e42
Compare
Chillee
reviewed
Aug 31, 2022
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.
Mostly LGTM, modulo naming nits.
66bf99c to
664c689
Compare
using horace's infra Cleanup More fixes
jansel
reviewed
Sep 1, 2022
664c689 to
e821f59
Compare
Chillee
approved these changes
Sep 1, 2022
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.
LGTM
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
This work is based on @Chillee minifier infrastructure.
The existing minifier works after AotAutograd is run, and runs on the generated forward and backward pass. Therefore, it cannot minify issues in the Aot Autograd tracing, decomps, partitioner etc.
This PR adds minifier to the TorchDynamo produced Fx graph (opposed to the Aot Autograd produced Fx Graphs). This makes it backend-agnostic. In the generated repro file, we use
torchdynamo.optimize("compiler_name")(opposed tomake_fxin the existing infra).However, there are few points to notice
make_fxto generate the Fx Graph module forminifier. This makes it pretty nice and isolated.make_fxhere because we want to run torchdynamo.optimize compiler here. Therefore, the minification runs in the main process. This might be problematic if the process crashes during minification.