-
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unnecessary compilation fails to optimize simple code #125652
Comments
The problem is that dynamo burns the parameters/buffers into the graph that we compile for each layer, forcing them to get specialized. @anijain2305 recently added an (experimental?) config to avoid that burning in, that you can try by running with I actually tried it on your repro, and I (successfully) don't see any recompiles when I turn it on. |
@bdhirsh Can you explain the rationale of the specialization? I'm quite puzzled here. |
This is Animesh's thing, he's working on fixing it |
@bdhirsh thanks for the information. I suppose that requires several months to be public, right? |
@anijain2305 seemed pretty close when we talked about it a week ago |
in particular, the flag is already available, you can opt into it and see if it works |
Thanks for the answer. Setting May I ask why this is not the default? Why do we need to set it manually? |
@anijain2305 is working on setting it default on. It currently uncovers a pile of latent bugs that are showing on test suite. |
馃悰 Describe the bug
A minimal reproducible example:
For these 100 layers,
torch.compile
will compile the first 64 layers (which is the dynamo size limit for a code object), and the rest layers are not optimized.However, ideally, we should only have one cache entry, that can be shared for all layers. We don't need to create different cache entry depending on
id(self)
.cc @ezyang @msaroufim @bdhirsh @anijain2305 @chauhang @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @chenyang78 @kadeng @jansel
Error logs
No response
Minified repro
No response
Versions
pytorch 2.3.0+cu121
The text was updated successfully, but these errors were encountered: