This commit removes the deallocation capabilities of one-shot-bufferization. One-shot-bufferization should never deallocate any memrefs as this should be entirely handled by the ownership-based-buffer-deallocation pass going forward. This means the `allow-return-allocs` pass option will default to true now, `create-deallocs` defaults to false and they, as well as the escape attribute indicating whether a memref escapes the current region, will be removed. A new `allow-return-allocs-from-loops` option is added as a temporary workaround for some bufferization limitations.
26 lines
1.1 KiB
MLIR
26 lines
1.1 KiB
MLIR
// RUN: mlir-opt %s -test-tensor-copy-insertion="must-infer-memory-space" -split-input-file | FileCheck %s
|
|
|
|
// CHECK-LABEL: func @unknown_op_copy
|
|
func.func @unknown_op_copy() -> (tensor<10xf32>, tensor<10xf32>) {
|
|
%c0 = arith.constant 0 : index
|
|
%cst = arith.constant 0.0 : f32
|
|
// CHECK: %[[dummy:.*]] = "test.dummy_op"() : () -> tensor<10xf32>
|
|
%t = "test.dummy_op"() : () -> tensor<10xf32>
|
|
// CHECK: %[[copy:.*]] = bufferization.alloc_tensor() copy(%[[dummy]]) : tensor<10xf32>
|
|
%s = tensor.insert %cst into %t[%c0] : tensor<10xf32>
|
|
return %s, %t : tensor<10xf32>, tensor<10xf32>
|
|
}
|
|
|
|
// -----
|
|
|
|
// CHECK-LABEL: func @alloc_tensor_copy
|
|
func.func @alloc_tensor_copy() -> (tensor<10xf32>, tensor<10xf32>) {
|
|
%c0 = arith.constant 0 : index
|
|
%cst = arith.constant 0.0 : f32
|
|
// CHECK: bufferization.alloc_tensor() {memory_space = 1 : ui64} : tensor<10xf32>
|
|
%t = bufferization.alloc_tensor() {memory_space = 1 : ui64} : tensor<10xf32>
|
|
// CHECK: bufferization.alloc_tensor() {memory_space = 1 : ui64} : tensor<10xf32>
|
|
%s = tensor.insert %cst into %t[%c0] : tensor<10xf32>
|
|
return %s, %t : tensor<10xf32>, tensor<10xf32>
|
|
}
|