// RUN: npcomp-opt -tcp-bufferize <%s | FileCheck %s // CHECK-LABEL: func @tcp_broadcast_to( // CHECK-SAME: %[[TENSOR:.*]]: tensor, // CHECK-SAME: %[[SHAPE:.*]]: tensor) -> tensor { // CHECK: refback.alloc_memref %[[SHAPE]] : memref // Check for two nested loops, but don't look at more detail for now. // TODO: This pass should not create loops. Instead it should create a // buffer version of tcp.broadcast_to // CHECK: scf.for // CHECK: scf.for func @tcp_broadcast_to(%arg0: tensor, %arg1: tensor) -> tensor { %0 = tcp.broadcast_to %arg0, %arg1 : (tensor, tensor) -> tensor return %0 : tensor } // CHECK-LABEL: func @tcp_splatted( // CHECK-SAME: %[[SPLAT_VAL:.*]]: f32, // CHECK-SAME: %[[SHAPE:.*]]: tensor) -> tensor { // CHECK: %[[RESULT:.*]] = refback.alloc_memref %[[SHAPE]] : memref // CHECK: linalg.fill(%[[RESULT]], %[[SPLAT_VAL]]) : memref, f32 // CHECK: %[[RESULT_TENSOR:.*]] = tensor_load %[[RESULT]] : memref // CHECK: return %[[RESULT_TENSOR]] : tensor func @tcp_splatted(%arg0: f32, %arg1: tensor) -> tensor { %0 = tcp.splatted %arg0, %arg1 : (f32, tensor) -> tensor return %0 : tensor }