1
1
// RUN: mlir-opt %s -test-linalg-codegen-strategy="anchor-func=matmul anchor-op=linalg.matmul tile-sizes=2,4,8 vectorize vectorize-contraction-to=matrixintrinsics unroll-vector-transfers=true" -split-input-file | FileCheck %s --check-prefix=CHECK-INTRINSIC
2
2
// RUN: mlir-opt %s -test-linalg-codegen-strategy="anchor-func=matmul anchor-op=linalg.matmul tile-sizes=16,32,64 promote promote-full-tile-pad register-tile-sizes=2,4,8 vectorize vectorize-contraction-to=outerproduct split-transfers=true unroll-vector-transfers=false" -split-input-file | FileCheck %s --check-prefix=CHECK-OUTER
3
3
// RUN: mlir-opt %s -test-linalg-codegen-strategy="anchor-func=matmul anchor-op=linalg.matmul tile-sizes=16,32,64 tile-interchange=1,2,0 generalize iterator-interchange=0,2,1" -split-input-file | FileCheck %s --check-prefix=CHECK-INTERCHANGE
4
- // RUN: mlir-opt %s -test-linalg-codegen-strategy="anchor-func=matmul anchor-op=linalg.matmul tile-sizes=16,32,64 pad pack-paddings=1,1,0 hoist-paddings=3,3,0" -split-input-file | FileCheck %s --check-prefix=CHECK-PAD
5
- // RUN: mlir-opt %s -test-linalg-codegen-strategy="anchor-func=matmul anchor-op=linalg.matmul tile-sizes=16,32,64 fuse pad vectorize" -split-input-file | FileCheck %s --check-prefix=CHECK-FUSE
6
- // RUN: mlir-opt %s -test-linalg-codegen-strategy="anchor-func=conv anchor-op=linalg.conv_2d_nhwc_hwcf tile-sizes=1,1,8,32,1,1,8 fuse pad decompose vectorize vectorize-padding" -split-input-file | FileCheck %s --check-prefix=CHECK-DECOMP
4
+ // RUN: mlir-opt %s -test-linalg-codegen-strategy="anchor-func=matmul anchor-op=linalg.matmul tile-sizes=16,32,64 pad padding-values=0.:f32,0.:f32,0.:f32 pack-paddings=1,1,0 hoist-paddings=3,3,0" -split-input-file | FileCheck %s --check-prefix=CHECK-PAD
5
+ // RUN: mlir-opt %s -test-linalg-codegen-strategy="anchor-func=matmul anchor-op=linalg.matmul tile-sizes=16,32,64 fuse pad padding-values=0.:f32,0.:f32,0.:f32 vectorize" -split-input-file | FileCheck %s --check-prefix=CHECK-FUSE
6
+ // RUN: mlir-opt %s -test-linalg-codegen-strategy="anchor-func=conv anchor-op=linalg.conv_2d_nhwc_hwcf tile-sizes=1,1,8,32,1,1,8 fuse pad padding-values=0.:f32,0.:f32,0.:f32 decompose vectorize vectorize-padding" -split-input-file | FileCheck %s --check-prefix=CHECK-DECOMP
7
7
8
8
// CHECK-INTRINSIC: func @matmul(
9
9
// CHECK-OUTER: func @matmul(
10
- func @matmul (%arg0: memref <72 x72 xf32 >, %arg1: memref <72 x72 xf32 >, %arg2: memref <72 x72 xf32 >) {
10
+ func.func @matmul (%arg0: memref <72 x72 xf32 >, %arg1: memref <72 x72 xf32 >, %arg2: memref <72 x72 xf32 >) {
11
11
12
12
// Check the matrix intrinsic lowering is triggered.
13
13
// CHECK-INTRINSIC: vector.matrix_multiply
@@ -17,13 +17,13 @@ func @matmul(%arg0: memref<72x72xf32>, %arg1: memref<72x72xf32>, %arg2: memref<7
17
17
// Check the outer product lowering is triggered.
18
18
// CHECK-OUTER: vector.outerproduct {{.*}} : vector<2xf32>, vector<4xf32>
19
19
linalg.matmul ins (%arg0 , %arg1: memref <72 x72 xf32 >, memref <72 x72 xf32 >) outs (%arg2: memref <72 x72 xf32 >)
20
- return
20
+ func. return
21
21
}
22
22
23
23
// -----
24
24
25
25
// CHECK-INTERCHANGE: func @matmul(
26
- func @matmul (%arg0: tensor <72 x72 xf32 >, %arg1: tensor <72 x72 xf32 >, %arg2: tensor <72 x72 xf32 >) -> tensor <72 x72 xf32 > {
26
+ func.func @matmul (%arg0: tensor <72 x72 xf32 >, %arg1: tensor <72 x72 xf32 >, %arg2: tensor <72 x72 xf32 >) -> tensor <72 x72 xf32 > {
27
27
// CHECK-INTERCHANGE-DAG: %[[C16:.*]] = arith.constant 16
28
28
// CHECK-INTERCHANGE-DAG: %[[C32:.*]] = arith.constant 32
29
29
// CHECK-INTERCHANGE-DAG: %[[C64:.*]] = arith.constant 64
@@ -37,15 +37,15 @@ func @matmul(%arg0: tensor<72x72xf32>, %arg1: tensor<72x72xf32>, %arg2: tensor<7
37
37
// CHECK-INTERCHANGE: linalg.generic
38
38
// CHECK-INTERCHANGE-SAME: iterator_types = ["parallel", "reduction", "parallel"]
39
39
%0 = linalg.matmul ins (%arg0 , %arg1: tensor <72 x72 xf32 >, tensor <72 x72 xf32 >) outs (%arg2: tensor <72 x72 xf32 >) -> tensor <72 x72 xf32 >
40
- return %0 : tensor <72 x72 xf32 >
40
+ func. return %0 : tensor <72 x72 xf32 >
41
41
}
42
42
43
43
// -----
44
44
45
45
// CHECK-PAD-DAG: #[[MAP0:[0-9a-z]+]] = affine_map<(d0) -> (-d0 + 72, 16)>
46
46
47
47
// CHECK-PAD: func @matmul(
48
- func @matmul (%arg0: tensor <72 x72 xf32 >, %arg1: tensor <72 x72 xf32 >, %arg2: tensor <72 x72 xf32 >) -> tensor <72 x72 xf32 > {
48
+ func.func @matmul (%arg0: tensor <72 x72 xf32 >, %arg1: tensor <72 x72 xf32 >, %arg2: tensor <72 x72 xf32 >) -> tensor <72 x72 xf32 > {
49
49
50
50
// Check the padding of the input operands has been hoisted out of the tile loop nest.
51
51
// CHECK-PAD-COUNT=2: tensor.pad %{{.*}} nofold
@@ -56,13 +56,13 @@ func @matmul(%arg0: tensor<72x72xf32>, %arg1: tensor<72x72xf32>, %arg2: tensor<7
56
56
// CHECK-PAD-COUNT=2: scf.for
57
57
// CHECK-PAD: linalg.matmul
58
58
%0 = linalg.matmul ins (%arg0 , %arg1: tensor <72 x72 xf32 >, tensor <72 x72 xf32 >) outs (%arg2: tensor <72 x72 xf32 >) -> tensor <72 x72 xf32 >
59
- return %0 : tensor <72 x72 xf32 >
59
+ func. return %0 : tensor <72 x72 xf32 >
60
60
}
61
61
62
62
// -----
63
63
64
64
// CHECK-FUSE: func @matmul(
65
- func @matmul (%arg0: tensor <72 x72 xf32 >, %arg1: tensor <72 x72 xf32 >, %arg2: tensor <72 x72 xf32 >) -> tensor <72 x72 xf32 > {
65
+ func.func @matmul (%arg0: tensor <72 x72 xf32 >, %arg1: tensor <72 x72 xf32 >, %arg2: tensor <72 x72 xf32 >) -> tensor <72 x72 xf32 > {
66
66
67
67
// Check the padding and vectorization applies to the fill operation due to the empty anchor op string.
68
68
// CHECK-FUSE: %[[CST:.*]] = arith.constant dense<0.000000e+00>
@@ -73,13 +73,13 @@ func @matmul(%arg0: tensor<72x72xf32>, %arg1: tensor<72x72xf32>, %arg2: tensor<7
73
73
// Check the matmul is padded and vectorized despite the empty anchor op string.
74
74
// CHECK-FUSE: vector.outerproduct
75
75
%1 = linalg.matmul ins (%arg0 , %arg1: tensor <72 x72 xf32 >, tensor <72 x72 xf32 >) outs (%0: tensor <72 x72 xf32 >) -> tensor <72 x72 xf32 >
76
- return %1 : tensor <72 x72 xf32 >
76
+ func. return %1 : tensor <72 x72 xf32 >
77
77
}
78
78
79
79
// -----
80
80
81
81
// CHECK-DECOMP: func @conv(
82
- func @conv (%arg0: tensor <8 x18 x17 x32 xf32 >, %arg1: tensor <3 x3 x32 x64 xf32 >, %arg2: tensor <8 x16 x15 x64 xf32 >) -> tensor <8 x16 x15 x64 xf32 > {
82
+ func.func @conv (%arg0: tensor <8 x18 x17 x32 xf32 >, %arg1: tensor <3 x3 x32 x64 xf32 >, %arg2: tensor <8 x16 x15 x64 xf32 >) -> tensor <8 x16 x15 x64 xf32 > {
83
83
%cst = arith.constant 0.000000e+00 : f32
84
84
%0 = linalg.fill ins (%cst : f32 ) outs (%arg2 : tensor <8 x16 x15 x64 xf32 >) -> tensor <8 x16 x15 x64 xf32 >
85
85
@@ -88,5 +88,5 @@ func @conv(%arg0: tensor<8x18x17x32xf32>, %arg1: tensor<3x3x32x64xf32>, %arg2: t
88
88
// CHECK-DECOMP: vector.outerproduct
89
89
// CHECK-DECOMP: vector.transfer_write {{.*}}: vector<1x8x32xf32>, tensor<1x1x?x32xf32>
90
90
%1 = linalg.conv_2d_nhwc_hwcf {dilations = dense <1 > : tensor <2 xi64 >, strides = dense <1 > : tensor <2 xi64 >} ins (%arg0 , %arg1 : tensor <8 x18 x17 x32 xf32 >, tensor <3 x3 x32 x64 xf32 >) outs (%0 : tensor <8 x16 x15 x64 xf32 >) -> tensor <8 x16 x15 x64 xf32 >
91
- return %1 : tensor <8 x16 x15 x64 xf32 >
91
+ func. return %1 : tensor <8 x16 x15 x64 xf32 >
92
92
}
0 commit comments