[MLIR][Bufferization] Introduce `EmptyTensorToAllocTensorOp`
authorLorenzo Chelini <l.chelini@icloud.com>
Wed, 14 Dec 2022 13:47:01 +0000 (14:47 +0100)
committerLorenzo Chelini <l.chelini@icloud.com>
Mon, 19 Dec 2022 08:12:10 +0000 (09:12 +0100)
commite7d0cc76d7f03020429f4e15de79ddb6a3695aea
treef87e016833004b594427b98e02e2033b1c2b7e34
parent5d65f8a7931c160fe5a11c120796779ba59789b9
[MLIR][Bufferization] Introduce `EmptyTensorToAllocTensorOp`

Introduce a new transform operation to replace `tensor.empty` with
`alloc_tensor` operations. The operation is a pass-through if the target
operation is already a `alloc_tensor`; otherwise, it expects a
`tensor.empty` as a target. Currently, it does not return any results.

The operation is expected to run before `one_shot_bufferize` as
`one_shot_bufferize` rejects `tensor.empty`.

Reviewed By: springerm

Differential Revision: https://reviews.llvm.org/D140026
mlir/include/mlir/Dialect/Bufferization/TransformOps/BufferizationTransformOps.h
mlir/include/mlir/Dialect/Bufferization/TransformOps/BufferizationTransformOps.td
mlir/lib/Dialect/Bufferization/TransformOps/BufferizationTransformOps.cpp
mlir/test/Dialect/Bufferization/Transforms/transform-ops.mlir