- 
                Notifications
    You must be signed in to change notification settings 
- Fork 5.2k
JIT: Graph-based loop inversion #113709
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
JIT: Graph-based loop inversion #113709
Conversation
Rewrite loop inversion to be graph based and to use the new loop representation.
… from old inversion
| Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch | 
| I can't repro the SPMI failures locally, and the assert  This test is failing with an AV from an array access with an underflowing index Before inversion, we have the following layout: We invert this loop by cloning the check  RBO determines that the preliminary checks can be removed since we know  Assertion prop gets rid of the  After this, range check elimination seems to think  cc @EgorBo, seems like this exposed a range check bug? | 
| 
 Usually, this assert means that someone created a node in a phase that returned PhaseStatus::MODIFIED_NOTHING | 
| 
 can you provide the full jit dump? | 
| 
 It hit during flow opts, I suspect it's one of the paths where  
 Sure: | 
| 
 If  | 
| Diffs are still large, and  In these instances, loop unrolling isn't able to look before the hoisted loop checks to find the init value of the IV, so we leave the loops intact. In the baseline JIT, we produce straight-line code that's eventually collapsed into simple return logic. There are a few instances of similarly large improvements: In cases like  With loop unrolling disabled, the diffs are considerably less severe:  | 
| @amanasifkhalid can you please re-base the PR to see if the range check issue still reproes with recent changes | 
| @EgorBo this failure repro'd in the latest run | 
| @amanasifkhalid can you point me to a pipeline where the test failed? I presume it's not SPMI | 
| @EgorBo sure, it's failing in the  | 
| 
 thanks, I can repro it locally | 
| Ok, looks like RangeCheck gets confused by a range where lower bound is greater than the upper one  | 
| So I filed a PR to fix this case #113935, but I'd recommend to disable the range check phase in your PR, because I suspect you have other issues so I don't expect the PR to become green once you disable the range check phase. Or you can integrate my PR (let's wait till its green) | 
| Draft Pull Request was automatically closed for 30 days of inactivity. Please let us know if you'd like to reopen it. | 
Follow-up to #109346. cc @jakobbotsch, feel free to merge this back into your branch if you'd prefer to keep the old PR.