[PATCH] D78464: [mlir][Linalg] Add support for fusing linalg.tensor_reshape with linalg.generic operations.

Mahesh Ravishankar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 23 13:34:23 PDT 2020


mravishankar added inline comments.


================
Comment at: mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp:650
+  unsigned dim = 0;
+  for (AffineMap map : reassociationMaps) {
+    ArrayRef<AffineExpr> collapsedDims = map.getResults();
----------------
nicolasvasilache wrote:
> Could this whole loop be replaced by something like:
> ```
> if (!useIndexMap.isIdentity()) return false;
> for (auto linearizedExpr : linearizeCollapsedDims(useIndexMap, srcShape, reassociationMaps) )
>   if (!isPureAffine(linearizedExpr)) return false;
> ```
I removed this in the checker and just added a check in the `fuse` operations to check that the resulting map is pure affine. 


================
Comment at: mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp:661
+      if (d.isa<AffineSymbolExpr>())
+        hasSymbol = true;
+    });
----------------
antiagainst wrote:
> Can return WalkResult::interrupt() after this to avoid further walking.
I dont think the walk on AffineExpr allows that. In any case not needed anymore


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78464





More information about the llvm-commits mailing list