[PATCH] D79766: [mlir][Linalg] Add pass to remove unit-extent dims from tensor operands of Generic ops.

River Riddle via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 27 14:43:07 PDT 2020


rriddle added inline comments.


================
Comment at: mlir/lib/Dialect/Linalg/Transforms/DropUnitDims.cpp:113
+  for (unsigned dim : llvm::seq<unsigned>(0, numIterationDims)) {
+    if (unitDims.count(dim)) {
+      dimReplacements.push_back(getAffineConstantExpr(0, context));
----------------
nit: Drop trivial braces.


================
Comment at: mlir/lib/Dialect/Linalg/Transforms/DropUnitDims.cpp:249
+    while (dim + 1 < origRank && isUnitExtent(dim + 1)) {
+      dim++;
+      reassociations.push_back(getAffineDimExpr(dim, context));
----------------
nit: ++dim;


================
Comment at: mlir/lib/Dialect/Linalg/Transforms/DropUnitDims.cpp:255
+    reassociations.clear();
+    dim++;
+  }
----------------
Same here.


================
Comment at: mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp:550
         Value yieldVal = yieldOp.getOperand(0);
-        auto clonedVal = mapper.lookup(yieldVal);
-        mapper.map(consumerBlock.getArgument(consumerIdx), clonedVal);
+        auto clonedVal = mapper.lookupOrNull(yieldVal);
+        if (clonedVal)
----------------
nit: Merge this into the if and use a type other than auto.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79766





More information about the llvm-commits mailing list