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.
25 lines
903 B
MLIR
25 lines
903 B
MLIR
// RUN: mlir-opt -one-shot-bufferize="bufferize-function-boundaries" -split-input-file %s -verify-diagnostics
|
|
|
|
// expected-error @below{{failed to bufferize op}}
|
|
// expected-error @below{{incoming operands of block argument have inconsistent memory spaces}}
|
|
func.func @inconsistent_memory_space() -> tensor<5xf32> {
|
|
%0 = bufferization.alloc_tensor() {memory_space = 0 : ui64} : tensor<5xf32>
|
|
cf.br ^bb1(%0: tensor<5xf32>)
|
|
^bb1(%arg1: tensor<5xf32>):
|
|
func.return %arg1 : tensor<5xf32>
|
|
^bb2():
|
|
%1 = bufferization.alloc_tensor() {memory_space = 1 : ui64} : tensor<5xf32>
|
|
cf.br ^bb1(%1: tensor<5xf32>)
|
|
}
|
|
|
|
// -----
|
|
|
|
// expected-error @below{{failed to bufferize op}}
|
|
// expected-error @below{{could not infer buffer type of block argument}}
|
|
func.func @cannot_infer_type() {
|
|
return
|
|
// The type of the block argument cannot be inferred.
|
|
^bb1(%t: tensor<5xf32>):
|
|
cf.br ^bb1(%t: tensor<5xf32>)
|
|
}
|