[Mlir-commits] [mlir] [mlir][Linalg]: Optimize any structured linalg operation in transform::PromoteOp to avoid unnecessary copies (PR #69876)

Aviad Cohen llvmlistbot at llvm.org
Sun Oct 22 05:03:29 PDT 2023


AviadCo wrote:

@nicolasvasilache @chelini 
This patch continues https://github.com/llvm/llvm-project/pull/68555

I went over the linalg structured operations and went over the `LinalgOp` interface. After thinking I decided that we need to promote arguments only if those are input or those are outputs which are considered as init tensors, where init tensor function is defined to be:

```cpp
    InterfaceMethod<
      /*desc=*/[{
        Return true if `opOperand` is an init tensor. This is true when it is
        an output tensor operand whose value is used in the payload region.
      }],
      /*retTy=*/"bool",
      /*methodName=*/"isInitTensor",
      /*args=*/(ins "OpOperand *":$opOperand),
      /*methodBody=*/"",
      /*defaultImplementation=*/[{
        if (!$_op.isDpsInit(opOperand))
          return false;
        return payloadUsesValueFromOperand(opOperand);
      }]
    >,
```


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


More information about the Mlir-commits mailing list