[Mlir-commits] [mlir] [mlir][scf] Add value bound for computed upper bound of forall loop (PR #171158)

Aviad Cohen llvmlistbot at llvm.org
Tue Dec 9 01:12:05 PST 2025


================
@@ -141,11 +152,20 @@ struct ForallOpInterface
     assert(blockArg.getArgNumber() < forallOp.getInductionVars().size() &&
            "expected index value to be an induction var");
     int64_t idx = blockArg.getArgNumber();
-    // TODO: Take into account step size.
     AffineExpr lb = cstr.getExpr(forallOp.getMixedLowerBound()[idx]);
     AffineExpr ub = cstr.getExpr(forallOp.getMixedUpperBound()[idx]);
     cstr.bound(value) >= lb;
     cstr.bound(value) < ub;
+    // iv <= lb + ((ub-lb)/step - 1) * step
+    // This bound does not replace the `iv < ub` constraint mentioned above,
+    // since constraints involving the multiplication of two constraint set
----------------
AviadCo wrote:

Same here, can we make a common function between forOp & forallOp?

https://github.com/llvm/llvm-project/pull/171158


More information about the Mlir-commits mailing list