[PATCH] D77286: [mlir] Enable fusion on conv op if it is a consumer.

Han-Chung Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 1 21:46:44 PDT 2020


hanchung created this revision.
hanchung added reviewers: mravishankar, nicolasvasilache, pifon2a.
Herald added subscribers: llvm-commits, grosul1, Joonsoo, liufengdb, lucyrfox, mgester, arpith-jacob, antiagainst, shauheen, burmako, jpienaar, rriddle, mehdi_amini.
Herald added a project: LLVM.

The `fuse` method will tile the producer based on the subview of the operand in
the consumer. Thus, we don't really care if the consumer has padding or not. It
only breaks if the conv op is a producer (and has padding).

Add a comment for `fuse` method as well.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D77286

Files:
  mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp


Index: mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp
===================================================================
--- mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp
+++ mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp
@@ -137,6 +137,8 @@
   llvm_unreachable("Expect to be able to extract a view defining loop range");
 }
 
+// Fuse the `producer` into `consumer`. The `producer` will be tiled base on
+// the subview of the operand in consumer.
 static LinalgOp fuse(Value producedView, LinalgOp producer, LinalgOp consumer,
                      unsigned consumerIdx, unsigned producerIdx,
                      OperationFolder *folder) {
@@ -150,11 +152,6 @@
     if (convOp.padding())
       llvm_unreachable("Unexpected conv with padding");
   }
-  if (auto convOp = dyn_cast<linalg::ConvOp>(consumer.getOperation())) {
-    // TODO(ntv): add a level of indirection to linalg.generic.
-    if (convOp.padding())
-      llvm_unreachable("Unexpected conv with padding");
-  }
 
   auto subView = dyn_cast_or_null<SubViewOp>(
       consumer.getBuffer(consumerIdx).getDefiningOp());


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77286.254414.patch
Type: text/x-patch
Size: 1087 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200402/5b0c8bfa/attachment.bin>


More information about the llvm-commits mailing list