[Mlir-commits] [mlir] [mlir][affine] Use value bound inference to determine minimum/maximum trip counts in loop analysis (PR #128113)
lonely eagle
llvmlistbot at llvm.org
Tue Jul 29 19:52:44 PDT 2025
linuxlonelyeagle wrote:
Yesterday I was thinking about situations where there are multiple affine results.I think this point needs a little more thought.
Re the [2, 3] and [4, 6] example, We still can't discard [4, 6], and the thing to do here should be to take their GCD @ftynse , Since 4 here is exactly divisible by 2, it can be discarded.If it turns out to be [2, 3], [5, 7], we have to consider [5, 7], and it is clear that the unroll factor should be 1(GCD).
> Suppose we have a loop where the lower bounds are L = {l1, l2, ... lM}, and the upper bounds are U = {u1, u2, ..., uN} and step S . This means that the trip count T is bounded by min(U) - max(L)) ceildiv S <= T <= (max(U) - min(L)) ceildiv S.
@krzysz00 I'm thinking that we shouldn't be able to use the formulas here, we should calculate the range for each loop separately.
One last point, I'm trying to figure out how to write tests. Probably can't be writing tests in GPU dialect here.I was wondering if there was a conveniently specified range of test ops that we could use.
https://github.com/llvm/llvm-project/pull/128113
More information about the Mlir-commits
mailing list