22 lines · plain
1// RUN: mlir-opt %s \2// RUN: -one-shot-bufferize="allow-unknown-ops" \3// RUN: -split-input-file | \4// RUN: FileCheck %s5 6// CHECK-LABEL: func @out_of_place_bufferization7func.func @out_of_place_bufferization(%t1 : tensor<?xf32>) -> (f32, f32) {8 // CHECK: memref.alloc9 // CHECK: memref.copy10 // CHECK-NOT: memref.dealloc11 12 %cst = arith.constant 0.0 : f3213 %idx = arith.constant 5 : index14 15 // This bufferizes out-of-place. An allocation + copy will be inserted.16 %0 = tensor.insert %cst into %t1[%idx] : tensor<?xf32>17 18 %1 = tensor.extract %t1[%idx] : tensor<?xf32>19 %2 = tensor.extract %0[%idx] : tensor<?xf32>20 return %1, %2 : f32, f3221}22