22 lines · plain
1# RUN: toyc-ch3 %s -emit=mlir -opt 2>&1 | FileCheck %s2 3# User defined generic function that operates on unknown shaped arguments4def transpose_transpose(x) {5 return transpose(transpose(x));6}7 8def main() {9 var a<2, 3> = [[1, 2, 3], [4, 5, 6]];10 var b = transpose_transpose(a);11 print(b);12}13 14# CHECK-LABEL: toy.func @transpose_transpose(15# CHECK-SAME: [[VAL_0:%.*]]: tensor<*xf64>) -> tensor<*xf64>16# CHECK-NEXT: toy.return [[VAL_0]] : tensor<*xf64>17 18# CHECK-LABEL: toy.func @main()19# CHECK-NEXT: [[VAL_1:%.*]] = toy.constant dense<{{\[\[}}1.000000e+00, 2.000000e+00, 3.000000e+00], [4.000000e+00, 5.000000e+00, 6.000000e+00]]> : tensor<2x3xf64>20# CHECK-NEXT: [[VAL_2:%.*]] = toy.generic_call @transpose_transpose([[VAL_1]]) : (tensor<2x3xf64>) -> tensor<*xf64>21# CHECK-NEXT: toy.print [[VAL_2]] : tensor<*xf64>22# CHECK-NEXT: toy.return