-
Couldn't load subscription status.
- Fork 25.7k
If you have i0 = i1 * 12, perform this replacement directly #112653
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
Conversation
Signed-off-by: Edward Z. Yang <ezyang@meta.com> [ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/112653
Note: Links to docs will display an error until the docs builds have been completed. ✅ You can merge normally! (2 Unrelated Failures)As of commit afd7f3e with merge base 68dead4 ( BROKEN TRUNK - The following jobs failed but were present on the merge base:👉 Rebase onto the `viable/strict` branch to avoid these failures
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
Signed-off-by: Edward Z. Yang <ezyangmeta.com> [ghstack-poisoned]
|
cc @asmeurer |
|
I guess this is related to #112347 (comment) I'm still learning how this code works, so it's hard to comment too much here. Is it really a good idea to replace in both directions? That means you don't have to be careful about (again, hard for me to know the answers to these questions because I'm still learning my way around all this) |
|
Yeah, this simplification arose as desirable because we were trying to rewrite an integer so that it would pass through modulus checks.
It's fine, for the equality replacements we are doing unification, so it doesn't matter which variable you end up with in the end, they're all in the same equivalence class.
Feel free to ask anything you need :) |
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.
This, together with the divisible_by workaround suggested in #112347, seems to help going through the reshape with -1 in the target shape in the internal model. Thanks!
|
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
…112653) In pytorch#112156 I added support for creating replacements on unbacked SymInts, so if you asserted that `i0 == s0`, we would replace i0 with s0 (only ever replacing unbacked with backed.) However, if we have assertions involving only unbacked SymInts, we can also replace in this case! E.g., `i0 == i1` or `i0 == i1 * 12`. The previous logic for generating replacements would reject these cases, because you're not allowed to replace unbacked with unbacked. Modifying the logic is not so easy though; ordinarily, we decide what substitution to prioritize by trying to replace the largest hinted symbol, but for unbacked integers we don't have this. To get around this problem, for now I only setup replacements for trivial symbol equals something else situations. Check the diff with whitespace ignored, the addition is quite small. Signed-off-by: Edward Z. Yang <ezyang@meta.com> Pull Request resolved: pytorch#112653 Approved by: https://github.com/aakhundov
Stack from ghstack (oldest at bottom):
In #112156 I added support for creating replacements on unbacked SymInts, so if you asserted that
i0 == s0, we would replace i0 with s0 (only ever replacing unbacked with backed.)However, if we have assertions involving only unbacked SymInts, we can also replace in this case! E.g.,
i0 == i1ori0 == i1 * 12. The previous logic for generating replacements would reject these cases, because you're not allowed to replace unbacked with unbacked. Modifying the logic is not so easy though; ordinarily, we decide what substitution to prioritize by trying to replace the largest hinted symbol, but for unbacked integers we don't have this. To get around this problem, for now I only setup replacements for trivial symbol equals something else situations. Check the diff with whitespace ignored, the addition is quite small.Signed-off-by: Edward Z. Yang ezyang@meta.com