[Mlir-commits] [mlir] [mlir][tensor] Bufferize tensor.reshape with non-identity layouts (PR #65654)

Spenser Bauman llvmlistbot at llvm.org
Fri Sep 15 07:37:28 PDT 2023


sabauma wrote:

@Lewuathe The change I made in the bufferization interface for `tensor.reshape` ensures that the lowering process always produces a `memref.reshape` with an identity affine map.

Without the change to the bufferization interface, the bufferization process will produce IR that fails verification. From my perspective, the issue I'm trying to address is that bufferization produces an invalid `memref.reshape`.

> In that case, can we improve the documentation to say we can pass non-identity layout memref to memref.reshape op?

I don't think we want to do that. I suspect the lowerings depend on this identity map requirement. I think the fact that bufferization will try to create `memref.reshape` operations with non-identity layouts is a bug, as it is not conforming to the spec of `memref.reshape`.

It may be possible to enhance `memref.reshape` to handle non-identity layout maps, but that is probably a more invasive change.

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


More information about the Mlir-commits mailing list