[Mlir-commits] [mlir] [mlir] Extend affine.min/max ValueBoundsOpInterfaceImpls (PR #118840)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Mon Jan 27 06:42:28 PST 2025


================
@@ -67,6 +67,27 @@ struct AffineMinOpInterface
           expr.replaceDimsAndSymbols(dimReplacements, symReplacements);
       cstr.bound(value) <= bound;
     }
+    // Get all constant lower bounds, choose minimum, and set lower bound to it.
+    MLIRContext *ctx = op->getContext();
+    AffineMap map = minOp.getAffineMap();
+    SmallVector<Value> mapOperands = minOp.getOperands();
+    std::optional<int64_t> minBound;
+    for (AffineExpr expr : map.getResults()) {
+      auto exprMap =
+          AffineMap::get(map.getNumDims(), map.getNumSymbols(), expr, ctx);
+      ValueBoundsConstraintSet::Variable exprVar(exprMap, mapOperands);
+      FailureOr<int64_t> exprBound =
+          cstr.computeConstantBound(presburger::BoundType::LB, exprVar,
----------------
Max191 wrote:

Yes, that sounds like exactly what we need! I can try this out, although I have some other things on my plate as well. I may start with a workaround solution downstream, and then come back to this when I have some more time, since it will take me some extra time to gain more context on the ValueBoundsOpInterface.

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


More information about the Mlir-commits mailing list