-
Notifications
You must be signed in to change notification settings - Fork 138
Loop Normalization Utilities #1988
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
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.
LGTM
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.
I am not a huge fan of having this kind of functionality be a pattern transformation. I am of the opinion that something like this is general-purpose enough that it warrants having a utility function somewhere that performs this operation. Whether the utility function can then be exposed through a pattern matching transformation can be discussed. However, there are a few reasons I am not in favor of it being a pattern matching transformation:
- The pattern is a single node - that's often not a good sign
- The operation is in my eyes primarily an optimization preparation, rather than an actual optimization itself. That means that when gathering applicable transformations for a program to improve performance, a transformation like this unnecessarily clutters the results.
- The operation is difficult to reuse. Given that it serves as an optimization preparation, that makes it so it is useful to apply from many other transformations / passes. Having it be a transformation means that doing so requires a lot of boiler-plate (setup a match, etc.).
As such, I would be in favor of having the same functionality given through 2 loop utility functions:
- Can a loop be normalized
- Normalize a loop
This would also make it possible to expose these functions through the LoopRegion
's own API easily.
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.
Thank you for the change, this is exactly what I had in mind. Looks good to me!
This PR adds a loop normalization transformation, transforming loops to start at zero with a step size of one.