// RUN: npcomp-opt <%s -convert-tcf-to-tcp | FileCheck %s --dump-input=fail // CHECK-LABEL: func @tcf_add( // CHECK-SAME: %[[LHS:.*]]: tensor, // CHECK-SAME: %[[RHS:.*]]: tensor) -> tensor { // CHECK: %[[LHSSHAPE:.*]] = shape.shape_of %[[LHS]] // CHECK: %[[RHSSHAPE:.*]] = shape.shape_of %[[RHS]] // CHECK: %[[WITNESS:.*]] = shape.cstr_broadcastable %[[LHSSHAPE]], %[[RHSSHAPE]] // CHECK: %[[RET:.*]] = shape.assuming %[[WITNESS]] -> (tensor) { // CHECK: %[[RESULTSHAPE:.*]] = shape.broadcast %[[LHSSHAPE]], %[[RHSSHAPE]] // CHECK: %[[LHSBCAST:.*]] = tcp.broadcast_to %[[LHS]], %[[RESULTSHAPE]] // CHECK: %[[RHSBCAST:.*]] = tcp.broadcast_to %[[RHS]], %[[RESULTSHAPE]] // CHECK: %[[ADD:.*]] = tcp.add %[[LHSBCAST]], %[[RHSBCAST]] // CHECK: shape.assuming_yield %[[ADD]] : tensor // CHECK: } // CHECK: return %[[RET:.*]] : tensor // CHECK: } func @tcf_add(%arg0: tensor, %arg1: tensor) -> tensor { %0 = tcf.add %arg0, %arg1 : (tensor, tensor) -> tensor return %0 : tensor } // CHECK-LABEL: func @tcf_matmul( // CHECK-SAME: %[[LHS:.*]]: tensor, // CHECK-SAME: %[[RHS:.*]]: tensor) -> tensor { // CHECK: %[[C1:.*]] = constant 1 : index // CHECK: %[[C0:.*]] = constant 0 : index // CHECK: %[[LHSK:.*]] = dim %[[LHS]], %[[C1]] : tensor // CHECK: %[[RHSK:.*]] = dim %[[RHS]], %[[C0]] : tensor // CHECK: %[[KEQUAL:.*]] = cmpi "eq", %[[LHSK]], %[[RHSK]] : index // CHECK: %[[WITNESS:.*]] = shape.cstr_require %[[KEQUAL]], "{{.*}}" // CHECK: %[[RET:.*]] = shape.assuming %[[WITNESS]] -> (tensor) { // CHECK: %[[MATMUL:.*]] = tcp.matmul %[[LHS]], %[[RHS]] : (tensor, tensor) -> tensor // CHECK: shape.assuming_yield %[[MATMUL]] : tensor // CHECK: } // CHECK: return %[[RET:.*]] : tensor // CHECK: } func @tcf_matmul(%arg0: tensor, %arg1: tensor) -> tensor { %0 = tcf.matmul %arg0, %arg1 : (tensor, tensor) -> tensor return %0 : tensor }