1// RUN: mlir-opt %s -allow-unregistered-dialect -one-shot-bufferize="must-infer-memory-space" -split-input-file -verify-diagnostics
2
3func.func @alloc_tensor_without_memory_space() -> tensor<10xf32> {
4  // expected-error @+2 {{could not infer memory space}}
5  // expected-error @+1 {{failed to bufferize op}}
6  %0 = bufferization.alloc_tensor() : tensor<10xf32>
7  return %0 : tensor<10xf32>
8}
9
10// -----
11
12func.func @memory_space_of_unknown_op() -> f32 {
13  %c0 = arith.constant 0 : index
14  // expected-error @+1 {{could not infer memory space}}
15  %t = "test.dummy_op"() : () -> (tensor<10xf32>)
16  // expected-error @+1 {{failed to bufferize op}}
17  %s = tensor.extract %t[%c0] : tensor<10xf32>
18  return %s : f32
19}
20