[Mlir-commits] [mlir] [MLIR] Let matchers work on int ranges (PR #102494)
Tobias Gysi
llvmlistbot at llvm.org
Sat Aug 10 06:18:25 PDT 2024
gysit wrote:
> Since our motivating example is "number of threads", perhaps we want to restrict this check to operations with no inputs?
Our "number of threads" operation has an optional integer argument. So deciding purely based on the number of inputs is not sufficient for our use case.
One way to make the change more opt in could be that we either add a new interface (i.e. a StaticIntRangeInterface or similar) that implements a `getStaticResultBounds` function that returns the static upper and lower bounds for the result of an operation (not taking the operands into account). Potentially that function could also be added to the existing interface, providing a default implementation that returns std::nullopt instead of a constant range.
An alternative way could be to add a speculatable attribute on the division operation which if set makes the division speculatable. That way downstream passes could use potentially more complex analysis to decide if a division is speculatable.
Let me know if you have any preference?
https://github.com/llvm/llvm-project/pull/102494
More information about the Mlir-commits
mailing list