From 700b64dc54d43e9ea544dd14e0bb344101567423 Mon Sep 17 00:00:00 2001 From: Matthias Springer Date: Fri, 4 Jun 2021 23:30:28 +0900 Subject: [PATCH] [mlir] Mark VectorToSCF patterns as recursive Differential Revision: https://reviews.llvm.org/D103599 --- mlir/lib/Conversion/VectorToSCF/VectorToSCF.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/mlir/lib/Conversion/VectorToSCF/VectorToSCF.cpp b/mlir/lib/Conversion/VectorToSCF/VectorToSCF.cpp index 9993c82..cfd21dc 100644 --- a/mlir/lib/Conversion/VectorToSCF/VectorToSCF.cpp +++ b/mlir/lib/Conversion/VectorToSCF/VectorToSCF.cpp @@ -663,6 +663,12 @@ template struct TransferOpConversion : public VectorToSCFPattern { using VectorToSCFPattern::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 { using VectorToSCFPattern::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 { using VectorToSCFPattern::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)) -- 2.7.4