[Mlir-commits] [mlir] 700b64d - [mlir] Mark VectorToSCF patterns as recursive

Matthias Springer llvmlistbot at llvm.org
Fri Jun 4 07:41:09 PDT 2021


Author: Matthias Springer
Date: 2021-06-04T23:40:57+09:00
New Revision: 700b64dc54d43e9ea544dd14e0bb344101567423

URL: https://github.com/llvm/llvm-project/commit/700b64dc54d43e9ea544dd14e0bb344101567423
DIFF: https://github.com/llvm/llvm-project/commit/700b64dc54d43e9ea544dd14e0bb344101567423.diff

LOG: [mlir] Mark VectorToSCF patterns as recursive

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

Added: 
    

Modified: 
    mlir/lib/Conversion/VectorToSCF/VectorToSCF.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Conversion/VectorToSCF/VectorToSCF.cpp b/mlir/lib/Conversion/VectorToSCF/VectorToSCF.cpp
index 9993c823d6d6f..cfd21dcadd0d7 100644
--- a/mlir/lib/Conversion/VectorToSCF/VectorToSCF.cpp
+++ b/mlir/lib/Conversion/VectorToSCF/VectorToSCF.cpp
@@ -663,6 +663,12 @@ template <typename OpTy>
 struct TransferOpConversion : public VectorToSCFPattern<OpTy> {
   using VectorToSCFPattern<OpTy>::VectorToSCFPattern;
 
+  void initialize() {
+    // This pattern recursively unpacks one dimension at a time. The recursion
+    // bounded as the rank is strictly decreasing.
+    this->setHasBoundedRewriteRecursion();
+  }
+
   LogicalResult matchAndRewrite(OpTy xferOp,
                                 PatternRewriter &rewriter) const override {
     if (!xferOp->hasAttr(kPassLabel))
@@ -826,6 +832,12 @@ struct UnrollTransferReadConversion
     : public VectorToSCFPattern<TransferReadOp> {
   using VectorToSCFPattern<TransferReadOp>::VectorToSCFPattern;
 
+  void initialize() {
+    // This pattern recursively unpacks one dimension at a time. The recursion
+    // bounded as the rank is strictly decreasing.
+    setHasBoundedRewriteRecursion();
+  }
+
   /// Return the vector into which the newly created TransferReadOp results
   /// are inserted.
   Value getResultVector(TransferReadOp xferOp,
@@ -957,6 +969,12 @@ struct UnrollTransferWriteConversion
     : public VectorToSCFPattern<TransferWriteOp> {
   using VectorToSCFPattern<TransferWriteOp>::VectorToSCFPattern;
 
+  void initialize() {
+    // This pattern recursively unpacks one dimension at a time. The recursion
+    // bounded as the rank is strictly decreasing.
+    setHasBoundedRewriteRecursion();
+  }
+
   /// Return the vector from which newly generated ExtracOps will extract.
   Value getDataVector(TransferWriteOp xferOp) const {
     if (auto extractOp = getExtractOp(xferOp))


        


More information about the Mlir-commits mailing list