[Mlir-commits] [mlir] 09c18a6 - [mlir] Return scf.parallel ops resulted from tiling.

Alexander Belyaev llvmlistbot at llvm.org
Thu Feb 4 05:47:35 PST 2021


Author: Alexander Belyaev
Date: 2021-02-04T14:47:14+01:00
New Revision: 09c18a6606e1437234fc1ac9f75b32c168a2d05b

URL: https://github.com/llvm/llvm-project/commit/09c18a6606e1437234fc1ac9f75b32c168a2d05b
DIFF: https://github.com/llvm/llvm-project/commit/09c18a6606e1437234fc1ac9f75b32c168a2d05b.diff

LOG: [mlir] Return scf.parallel ops resulted from tiling.

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

Added: 
    

Modified: 
    mlir/include/mlir/Dialect/SCF/Transforms.h
    mlir/lib/Dialect/SCF/Transforms/ParallelLoopTiling.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Dialect/SCF/Transforms.h b/mlir/include/mlir/Dialect/SCF/Transforms.h
index 3164d337b4775..456eb4e286598 100644
--- a/mlir/include/mlir/Dialect/SCF/Transforms.h
+++ b/mlir/include/mlir/Dialect/SCF/Transforms.h
@@ -44,7 +44,11 @@ void naivelyFuseParallelOps(Region &region);
 ///                                           min(tileSize[1], %arg3-%j1))
 ///                                        step (%arg4, %arg5)
 /// The old loop is replaced with the new one.
-void tileParallelLoop(ParallelOp op, llvm::ArrayRef<int64_t> tileSizes);
+///
+/// The function returns the resulting ParallelOps, i.e. {outer_loop_op,
+/// inner_loop_op}.
+std::pair<ParallelOp, ParallelOp>
+tileParallelLoop(ParallelOp op, llvm::ArrayRef<int64_t> tileSizes);
 
 /// Populates patterns for SCF structural type conversions and sets up the
 /// provided ConversionTarget with the appropriate legality configuration for

diff  --git a/mlir/lib/Dialect/SCF/Transforms/ParallelLoopTiling.cpp b/mlir/lib/Dialect/SCF/Transforms/ParallelLoopTiling.cpp
index 542c1c2150206..cdb4afa929cf2 100644
--- a/mlir/lib/Dialect/SCF/Transforms/ParallelLoopTiling.cpp
+++ b/mlir/lib/Dialect/SCF/Transforms/ParallelLoopTiling.cpp
@@ -37,7 +37,8 @@ using namespace mlir::scf;
 /// %i0 + j0 and %i1 + %j1.
 //
 /// The old loop is replaced with the new one.
-void mlir::scf::tileParallelLoop(ParallelOp op, ArrayRef<int64_t> tileSizes) {
+std::pair<ParallelOp, ParallelOp>
+mlir::scf::tileParallelLoop(ParallelOp op, ArrayRef<int64_t> tileSizes) {
   OpBuilder b(op);
   auto zero = b.create<ConstantIndexOp>(op.getLoc(), 0);
   SmallVector<Value, 2> tileSizeConstants;
@@ -125,6 +126,7 @@ void mlir::scf::tileParallelLoop(ParallelOp op, ArrayRef<int64_t> tileSizes) {
   }
 
   op.erase();
+  return std::make_pair(outerLoop, innerLoop);
 }
 
 namespace {


        


More information about the Mlir-commits mailing list