[Mlir-commits] [mlir] 53da860 - [linalg][mlir] Replace getSmallestBoundingIndex in promotion (NFC).

Tobias Gysi llvmlistbot at llvm.org
Wed Nov 10 08:16:53 PST 2021


Author: Tobias Gysi
Date: 2021-11-10T16:16:08Z
New Revision: 53da8600e1bd2fb91b344ad301209e1b8d5de160

URL: https://github.com/llvm/llvm-project/commit/53da8600e1bd2fb91b344ad301209e1b8d5de160
DIFF: https://github.com/llvm/llvm-project/commit/53da8600e1bd2fb91b344ad301209e1b8d5de160.diff

LOG: [linalg][mlir] Replace getSmallestBoundingIndex in promotion (NFC).

Replace the getSmallestBoundingIndex method used in promotion by getConstantUpperBoundForIndex that uses flat affine constraints to compute a constant upper bound.

Depends On D113546

Reviewed By: nicolasvasilache

Differential Revision: https://reviews.llvm.org/D113548

Added: 
    

Modified: 
    mlir/lib/Dialect/Linalg/Transforms/Promotion.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/Linalg/Transforms/Promotion.cpp b/mlir/lib/Dialect/Linalg/Transforms/Promotion.cpp
index ed86cfc080a9..130908142042 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/Promotion.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/Promotion.cpp
@@ -223,9 +223,12 @@ FailureOr<PromotionInfo> mlir::linalg::promoteSubviewAsNewBuffer(
     auto rangeValue = en.value();
     // Try to extract a tight constant.
     LLVM_DEBUG(llvm::dbgs() << "Extract tightest: " << rangeValue.size << "\n");
-    IntegerAttr sizeAttr = getSmallestBoundingIndex(rangeValue.size);
-    Value size = (!sizeAttr) ? rangeValue.size
-                             : b.create<arith::ConstantOp>(loc, sizeAttr);
+    FailureOr<int64_t> upperBound =
+        getConstantUpperBoundForIndex(rangeValue.size);
+    Value size =
+        failed(upperBound)
+            ? rangeValue.size
+            : b.create<arith::ConstantIndexOp>(loc, upperBound.getValue());
     LLVM_DEBUG(llvm::dbgs() << "Extracted tightest: " << size << "\n");
     fullSizes.push_back(size);
     partialSizes.push_back(


        


More information about the Mlir-commits mailing list