-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[mlir][Interfaces][NFC] ValueBoundsConstraintSet
: Add columns for constant values/dims
#86097
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
Closed
matthias-springer
wants to merge
1
commit into
main
from
users/matthias-springer/value_bounds_const_columns
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Hmm, I feel this is tricky: this really depends about the context in which we query the analysis.
It is easy to create a varying shape (i.e. size depends on loop iv) and this will not be a symbol anymore.
Basically, if the analysis was properly rooted at an op / block, we could say that everything defined above is a symbol.
IOW, any such analysis is relative to its context: if your transform/analysis cares about information on say k innermost loops, you can "make" information about the outermost loops constant.
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 don't fully understand the different between symbols and dimensions in
IntegerRelation
. The limitations that I am aware of:getSliceBounds
can only be called on a dimensions, so the first "column" that I add to the constraint set (for which we want to compute LB/UB) is a dimension.projectOut
works on both symbols and dimensions, so all other values are added as symbols.Basically we have only one dimension and everything else is a symbol. (But the current implementation would make it easy to change this.) This seems to work well so far.
Uh oh!
There was an error while loading. Please reload this page.
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.
On second thought, that's actually how it is implemented at the moment. We provide a
ValueBoundsConstraintSet::computeBound(Value)
API. That function will build a constraint set and add the given value as a dimension, everything else as a symbol. When computing a bound for a different value, we build a brand new constraint set, this time with the other value being the only dimension. (There is no public API that exposes the constraint set itself.) So this analysis is actually relative to a context and rooted at a certain op.Computing multiple bounds back-to-back is slow at the moment because we have to re-analyze the entire IR. If we improve this at some point in the future, we will have to take a closer look at what's a symbol and what's a dimension, as you suggested.