[PATCH] D80347: [mlir][Linalg] Add support for fusion between indexed_generic ops and generic ops on tensors.

Mahesh Ravishankar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 27 10:17:40 PDT 2020


mravishankar accepted this revision.
mravishankar added a comment.
This revision is now accepted and ready to land.

Really cool! Just one comment. Approving assuming that it will be addressed. Thanks a lot!



================
Comment at: mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp:413
 struct FuseGenericOpsOnTensors {
-  static bool isFusible(GenericOp producer, GenericOp consumer,
+  static bool isFusible(LinalgOp producer, LinalgOp consumer,
                         unsigned consumerIdx) {
----------------
Oh I really like this! It was something I wanted to get to anyway. Thanks for doing it right here!


================
Comment at: mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp:503-511
+      AffineMap consumerResultIndexMap =
+          consumer.getInputIndexingMap(consumerIdx);
+      AffineMap producerResultIndexMap = producer.getOutputIndexingMap(0);
+      AffineMap invProducerResultIndexMap =
+          inversePermutation(producerResultIndexMap);
+      assert(invProducerResultIndexMap &&
+             "expected producer result indexig map to be invertible");
----------------
I think this should be outside of the `else`?


================
Comment at: mlir/test/Dialect/Linalg/fusion-tensor.mlir:226
+#map0 = affine_map<(d0, d1) -> (d0, d1)>
+func @generic_op_indexed_generic_op_fusion(%arg0: tensor<2x2xi32>,
+                                           %arg1: tensor<2x2xi32>) {
----------------
Lets just make all shapes dynamic in the tests. THere shouldnt be any reason for static shape right?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80347/new/

https://reviews.llvm.org/D80347





More information about the llvm-commits mailing list