-
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
Fix bug for comptime.get_local for cells/closures #126637
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/126637
Note: Links to docs will display an error until the docs builds have been completed. ❌ 1 New Failure, 3 Unrelated FailuresAs of commit 635aab4 with merge base 5ea956a (): NEW FAILURE - The following job has failed:
FLAKY - The following jobs failed but were likely due to flakiness present on trunk:
UNSTABLE - The following job failed but was likely due to flakiness present on trunk and has been marked as unstable:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
I wasn't paying enough attention and didn't notice that LOAD_DEREF is defined differently for InliningInstructionTranslator. Match it up with the code there. This also fixes comptime.print(), which was broken, because closing over an argument turned it into a cell rather than a regular local. Signed-off-by: Edward Z. Yang <ezyang@meta.com> ghstack-source-id: 725c826544915778d89a0a30645091ed403ea115 Pull Request resolved: #126637
I wasn't paying enough attention and didn't notice that LOAD_DEREF is defined differently for InliningInstructionTranslator. Match it up with the code there. This also fixes comptime.print(), which was broken, because closing over an argument turned it into a cell rather than a regular local. Signed-off-by: Edward Z. Yang <ezyang@meta.com> ghstack-source-id: 33b8a2c7aa354dd875238bf24fcc7e40d2f57c11 Pull Request resolved: #126637
I wasn't paying enough attention and didn't notice that LOAD_DEREF is defined differently for InliningInstructionTranslator. Match it up with the code there. This also fixes comptime.print(), which was broken, because closing over an argument turned it into a cell rather than a regular local. Signed-off-by: Edward Z. Yang <ezyang@meta.com> ghstack-source-id: 0656df00cc38d477fa8d4f1a37ae9a5c4407e072 Pull Request resolved: #126637
@pytorchbot merge -f "unrelated failures in ci" |
Merge startedYour change will be merged immediately since you used the force (-f) flag, bypassing any CI checks (ETA: 1-5 minutes). Please use Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
…or (#126245) This PR requires a little justification, but let's start with what it does first: 1. When you have a 0d CPU scalar int64/float64 tensor input to a graph, we will preallocate a backed SymInt/SymFloat corresponding to what you would get if you call item() on this tensor. This means you can freely change your input to be a Python int/float or a Tensor with an item() call and end up with exactly the same level of expressivity (specifically, you can guard on the internal SymInt/SymFloat no matter what). By default, the source of the backed SymInt/SymFloat is `L['tensor'].item()`, but if you have promoted a float input into a Tensor, we will cancel out `torch.as_tensor(L['float']).item()` into just `L['float']`. 2. We switch wrap_symfloat to use this, instead of hand crafting the new SymNodeVariable. Everything works out, except that we carefully pass the item() result to tracked fakes (and not the fake Tensor argument) OK, so why do this at all? There is some marginal benefit where now some item() calls on scalar inputs can be guarded on, but IMO this is a pretty marginal benefit, and if it was the only reason, I wouldn't do this. The real reason for this is that I need to be able to propagate fake tensors through the graphs that are produced by Dynamo, and if I am doing the old custom wrap_symfloat logic, there's no way I can do this, because ordinarily an item() call will cause an unbacked SymInt when I reallocate. The other obvious way to solve the problem above is to make a HOP alternative that item() that "bakes in" the backed SymInt its supposed to return. But this strategy seems more parsimonious, and it does have the marginal benefit I mentioned above. The main downside is that what I have to do next, is make it so that when I run tensor computation, I also apply the equivalent operations to the SymInt/SymFloat as well. That's next PR. Signed-off-by: Edward Z. Yang <ezyang@meta.com> Pull Request resolved: #126245 Approved by: https://github.com/eellison ghstack dependencies: #126637
Stack from ghstack (oldest at bottom):
I wasn't paying enough attention and didn't notice that LOAD_DEREF is
defined differently for InliningInstructionTranslator. Match it up with
the code there.
This also fixes comptime.print(), which was broken, because closing over
an argument turned it into a cell rather than a regular local.
Signed-off-by: Edward Z. Yang ezyang@meta.com
cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @chenyang78 @kadeng @chauhang