[Mlir-commits] [mlir] [mlir][affine][Analysis] Add conservative bounds for semi-affine mods (PR #93576)

Kunwar Grover llvmlistbot at llvm.org
Tue Jun 4 04:22:42 PDT 2024


================
@@ -77,21 +81,39 @@ class FlatLinearConstraints : public presburger::IntegerPolyhedron {
   /// as a closed bound by +1/-1 respectively. In case of an EQ bound, it can
   /// only be added as a closed bound.
   ///
+  /// Conservative bounds for semi-affine expressions will be added if
+  /// `AddConservativeSemiAffineBounds` is set to `Yes`. This currently does not
+  /// cover all semi-affine expressions, so `addBound()` still may fail with
+  /// this set. Note: If enabled it is possible for the resulting constraint set
+  /// to become empty if a precondition of a conservative bound is found not to
+  /// hold.
+  ///
   /// Note: The dimensions/symbols of this FlatLinearConstraints must match the
   /// dimensions/symbols of the affine map.
-  LogicalResult addBound(presburger::BoundType type, unsigned pos,
-                         AffineMap boundMap, bool isClosedBound);
+  LogicalResult addBound(
+      presburger::BoundType type, unsigned pos, AffineMap boundMap,
+      bool isClosedBound,
+      AddConservativeSemiAffineBounds = AddConservativeSemiAffineBounds::No);
 
   /// Adds a bound for the variable at the specified position with constraints
   /// being drawn from the specified bound map. In case of an EQ bound, the
   /// bound map is expected to have exactly one result. In case of a LB/UB, the
   /// bound map may have more than one result, for each of which an inequality
   /// is added.
+  ///
+  /// Conservative bounds for semi-affine expressions will be added if
+  /// `AddConservativeSemiAffineBounds` is set to `Yes`. This currently does not
+  /// cover all semi-affine expressions, so `addBound()` still may fail with
----------------
Groverkss wrote:

We probably should document what class of semi-affine expressions we do not cover. From what I understand, we should cover everything already, right?

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


More information about the Mlir-commits mailing list