[Mlir-commits] [mlir] [mlir][Linalg]: Optimize linalg generic in transform::PromoteOp to avoid unnecessary copies (PR #68555)

lorenzo chelini llvmlistbot at llvm.org
Tue Oct 10 02:24:39 PDT 2023


================
@@ -174,6 +177,11 @@ LinalgOpInstancePromotionOptions::LinalgOpInstancePromotionOptions(
     Operation *op = opOperand.get().getDefiningOp();
     if (auto sv = dyn_cast_or_null<memref::SubViewOp>(op)) {
       subViews[operandNumber] = sv;
+      // In case of linalg generic, copy in only if subview is used in linalg
+      // payload.
+      if (!isa<linalg::GenericOp>(linalgOp) ||
----------------
chelini wrote:

why is tied to a linalg.generic? Can the optimization works for any LinalgOp?

https://github.com/llvm/llvm-project/pull/68555


More information about the Mlir-commits mailing list