[Mlir-commits] [mlir] [mlir][linalg] Genericize MapOp (PR #162742)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Mon Oct 20 07:03:50 PDT 2025


srcarroll wrote:

> > If the `map` operation doesn't use the `init`, then bufferization will always create a new allocation.
> 
> In the current design, if you want a `linalg.map` to bufferize in-place, you have to select one of the "ins" operands as "init" operand. (I.e., pass the same operand as "in" and "init".)
> 
> This usually triggers a RaW in the bufferization. But there is one special case: `bufferizesToElementwiseAccess`. This is the case for Linalg ops and makes it such that this is not considered a conflict.
> 
> Whether you expose the "init" operand as a bbArg or not does not matter. The bufferizes-to-memwrite was already there for the init bbArg, the only thing you're possibly adding here is a bufferizes-to-memread. But due to `bufferizesToElementwiseAccess`, that cannot cause a RaW conflict.
> 
> Long story short: I think this PR does not pessimize bufferization.

@matthias-springer thanks for the thorough explanation

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


More information about the Mlir-commits mailing list