1*c1fef4e8SMatthias Springer// RUN: mlir-opt %s -test-tensor-copy-insertion="must-infer-memory-space" -split-input-file -verify-diagnostics
2c0b0b6a0SMatthias Springer
3c0b0b6a0SMatthias Springer// An alloc is inserted but the copy is emitted. Therefore, the memory space
4c0b0b6a0SMatthias Springer// should be specified on the alloc_tensor op.
5c0b0b6a0SMatthias Springerfunc.func @memory_space_of_unknown_op() -> (tensor<10xf32>, tensor<10xf32>) {
6c0b0b6a0SMatthias Springer  %c0 = arith.constant 0 : index
7c0b0b6a0SMatthias Springer  %cst = arith.constant 0.0 : f32
8c0b0b6a0SMatthias Springer  // expected-error @+1 {{could not infer memory space}}
9c0b0b6a0SMatthias Springer  %t = bufferization.alloc_tensor() : tensor<10xf32>
10c0b0b6a0SMatthias Springer  %s = tensor.insert %cst into %t[%c0] : tensor<10xf32>
11c0b0b6a0SMatthias Springer  return %s, %t : tensor<10xf32>, tensor<10xf32>
12c0b0b6a0SMatthias Springer}
13