[mlir][bufferize] Implement BufferizableOpInterface for tensor.empty
authorMatthias Springer <springerm@google.com>
Mon, 12 Dec 2022 13:16:28 +0000 (14:16 +0100)
committerMatthias Springer <springerm@google.com>
Mon, 12 Dec 2022 13:19:38 +0000 (14:19 +0100)
commitbe630f07de0c17bade67e6ab6a297db41003775d
tree4ef543bcb3ea7c12547f72a73de1761eb4b88f71
parent710a834c4c822c5c444fc9715785d23959f5c645
[mlir][bufferize] Implement BufferizableOpInterface for tensor.empty

The op is not bufferizable but should be analyzable (for `EliminateEmptyTensors`, which uses the bufferization infrastructure).

Also improve debugging functionality and error messages.

Also adds a missing pass to the sparse pipeline. (tensor.empty should be replaced with bufferization.alloc_tensor, but it sometimes used to work without depending on how the tensor.empty is used. Now we always fail explicitly.)
mlir/lib/Dialect/Bufferization/Transforms/OneShotAnalysis.cpp
mlir/lib/Dialect/SparseTensor/Transforms/SparsificationAndBufferizationPass.cpp
mlir/lib/Dialect/Tensor/Transforms/BufferizableOpInterfaceImpl.cpp
mlir/test/Dialect/SparseTensor/sparse_sddmm.mlir
mlir/test/Dialect/Tensor/bufferize.mlir