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

Aviad Cohen llvmlistbot at llvm.org
Wed Oct 11 03:20:32 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) ||
----------------
AviadCo wrote:

You are right about `CopyOp` has `payloadUsesValueFromOperand `, but for that example the `ins` operand needs promotation altough `payloadUsesValueFromOperand ` will return false for it since `linalg.copy` has not payload 

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


More information about the Mlir-commits mailing list