[mlir][linalg][bufferize] Add `createDealloc` options
authorMatthias Springer <springerm@google.com>
Thu, 6 Jan 2022 21:10:55 +0000 (06:10 +0900)
committerMatthias Springer <springerm@google.com>
Thu, 6 Jan 2022 21:13:57 +0000 (06:13 +0900)
commit0f5edb9d63b871396e773224ca9005b8c2c7520d
treef10c57f13dbb393b79497048d7ae9c198bd1dc24
parent37e6e022d21fc9e188701c684dc0f6a13366ddf9
[mlir][linalg][bufferize] Add `createDealloc` options

If `createDealloc` is deactivated (enabled by default), newly allocated buffers are not deallocated anymore. In such a case, the missing deallocations can be inserted by the existing "BufferDeallocation" pass.

This change is needed for unifying core bufferization and Comprehensive Bufferize. Core bufferization has a separate pass for generating deallocations.

Note: In the future, this will evolve towards generating deallocation ops only for buffer allocations that do not escape block boundaries (i.e., that are in destination passing style).

Differential Revision: https://reviews.llvm.org/D116450
mlir/include/mlir/Dialect/Linalg/ComprehensiveBufferize/BufferizableOpInterface.h
mlir/lib/Dialect/Linalg/ComprehensiveBufferize/BufferizableOpInterface.cpp
mlir/lib/Dialect/Linalg/ComprehensiveBufferize/LinalgInterfaceImpl.cpp
mlir/lib/Dialect/Linalg/ComprehensiveBufferize/TensorInterfaceImpl.cpp