[mlir][tensor][bufferize] Fix dealloc placement in scf.forall op
authorMatthias Springer <springerm@google.com>
Sat, 15 Apr 2023 03:18:56 +0000 (12:18 +0900)
committerMatthias Springer <springerm@google.com>
Sun, 16 Apr 2023 00:34:43 +0000 (09:34 +0900)
commit7c06f63176da05ef45216c13b271a343b72d75d0
tree12c411c5370c2056cdb6c99a13b7f15240e66633
parent4889214a48cf7c7d1949b833d5a2d4604448c96e
[mlir][tensor][bufferize] Fix dealloc placement in scf.forall op

The terminator of this op is special: it does not just yield a value,
but bufferizes to a memcpy. This requires special treatment to make sure
that deallocs are placed after the memcpy. (By default, deallocs are
placed right before the terminator.)

Differential Revision: https://reviews.llvm.org/D148408
mlir/lib/Dialect/Tensor/Transforms/BufferizableOpInterfaceImpl.cpp
mlir/test/Dialect/Tensor/one-shot-bufferize.mlir