brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · 7398fdf Raw
21 lines · plain
1// RUN: mlir-opt %s -one-shot-bufferize="use-encoding-for-memory-space" -split-input-file | FileCheck %s2 3func.func @from_elements(%fill: f32, %f: f32, %idx: index) -> tensor<3xf32, 1> {4  %t = tensor.from_elements %fill, %fill, %fill : tensor<3xf32, 1>5  %i = tensor.insert %f into %t[%idx] : tensor<3xf32, 1>6  return %i : tensor<3xf32, 1>7}8 9// CHECK-LABEL: @from_elements10//  CHECK-SAME: (%[[arg0:.+]]: f32, %[[arg1:.+]]: f32, %[[arg2:.+]]: index) -> tensor<3xf32, 1 : i64>11//       CHECK:     %[[alloc:.+]] = memref.alloc() {{.*}} : memref<3xf32, 1>12//       CHECK-DAG:     %[[c0:.+]] = arith.constant 0 : index13//       CHECK-DAG:     %[[c1:.+]] = arith.constant 1 : index14//       CHECK-DAG:     %[[c2:.+]] = arith.constant 2 : index15//       CHECK:     memref.store %[[arg0]], %[[alloc]][%[[c0]]] : memref<3xf32, 1>16//       CHECK:     memref.store %[[arg0]], %[[alloc]][%[[c1]]] : memref<3xf32, 1>17//       CHECK:     memref.store %[[arg0]], %[[alloc]][%[[c2]]] : memref<3xf32, 1>18//       CHECK:     memref.store %[[arg1]], %[[alloc]][%[[arg2]]] : memref<3xf32, 1>19//       CHECK:     %[[v0:.+]] = bufferization.to_tensor %[[alloc]] : memref<3xf32, 1> to tensor<3xf32, 1 : i64>20//       CHECK:     return %[[v0]] : tensor<3xf32, 1 : i64>21