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.
22 lines
670 B
MLIR
22 lines
670 B
MLIR
// RUN: mlir-opt %s \
|
|
// RUN: -one-shot-bufferize="allow-unknown-ops" \
|
|
// RUN: -split-input-file | \
|
|
// RUN: FileCheck %s
|
|
|
|
// CHECK-LABEL: func @out_of_place_bufferization
|
|
func.func @out_of_place_bufferization(%t1 : tensor<?xf32>) -> (f32, f32) {
|
|
// CHECK: memref.alloc
|
|
// CHECK: memref.copy
|
|
// CHECK-NOT: memref.dealloc
|
|
|
|
%cst = arith.constant 0.0 : f32
|
|
%idx = arith.constant 5 : index
|
|
|
|
// This bufferizes out-of-place. An allocation + copy will be inserted.
|
|
%0 = tensor.insert %cst into %t1[%idx] : tensor<?xf32>
|
|
|
|
%1 = tensor.extract %t1[%idx] : tensor<?xf32>
|
|
%2 = tensor.extract %0[%idx] : tensor<?xf32>
|
|
return %1, %2 : f32, f32
|
|
}
|