forked from pytorch/pytorch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[inductor] Fix can_merge check for expr=q0*q1 (pytorch#129806)
Fixes pytorch#111884 In the minimised reproducer, we have a loop with the index expression `-q0*q1` for which in the merge tester we get: ``` expr1 = - 0 * (_merge_tester * 16) = 0 expr2 = - _merge_tester * 0 = 0 ``` so it decides we can merge the dimensions and `q0` is set to `0`, meaning `-q0*q1` is always zero! Here I change the test so we have at least one case where no zeros are substituted so we can catch this situation. In the normal strided case we get e.g. ``` expr = 16 * q0 + q1 expr1 = 16 * _merge_tester2 + (16 * _merge_tester1) expr2 = 16 * (_merge_tester2 + _merge_tester1) ``` which are still equivalent expressions. Pull Request resolved: pytorch#129806 Approved by: https://github.com/lezcano
- Loading branch information
1 parent
37e3c60
commit dc75ec2
Showing
3 changed files
with
29 additions
and
3 deletions.
There are no files selected for viewing
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
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
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