-
Notifications
You must be signed in to change notification settings - Fork 53
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
Identify loop induction variables #1832
Comments
This sounds potentially quite useful! It seems like there are two big options here for the core problem of reducing that obvious redundancy:
The trade-offs here are standard: one makes the compiler more predictable and less mysterious, while the other leads to a more regular IL that simplifies control-flow handling in general. |
If I redesigned Calyx, I would make registers and wires abstract in the IR like @cgyurgyik did in the MLIR dialect. There are a lot of passes, analyses, and optimizations that would benefit from that. |
I don't see why option 2 is necessarily mutually exclusive with option 1. It's reasonable for me to have |
The more things you have in the IR, the more things you have to worry about optimizing so we generally prefer having canonical versions. |
I meant that the loop counter variable would be created regardless, but Adrian's syntax could give it a custom name. |
When using
repeat
statements in Calyx, we currently end up creating two registers: one that tracks when the loop needs to exit (inserted by the compiler), and another one usually inserted by the frontend to iterate over some value.In general, it seems useful be to able to identify loop induction variable so that we can share them in passes. They can also be used for a host of other optimizations.
To do this correctly, we need to use live-range analysis and detect the live range of registers. Specifically, the register:
I might be missing other constraints so let's look through class SW loop induction variable detection and make sure we are getting all the corner cases.
The text was updated successfully, but these errors were encountered: