test-conv-3d-ndhwc-call.mlir
5.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
// RUN: mlir-opt %s -convert-linalg-to-loops -convert-linalg-to-llvm -convert-std-to-llvm | \
// RUN: mlir-cpu-runner -e main -entry-point-result=void \
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
// RUN: | FileCheck %s
// RUN: mlir-opt %s -linalg-tile="linalg-tile-sizes=0,5,5,5" -convert-linalg-to-loops \
// RUN: -convert-linalg-to-llvm -convert-std-to-llvm | \
// RUN: mlir-cpu-runner -e main -entry-point-result=void \
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
// RUN: | FileCheck %s
// RUN: mlir-opt %s -test-conv-vectorization="tile-sizes=1,1,1,1,1,3,3,3,3" -convert-linalg-to-llvm | \
// RUN: mlir-cpu-runner -e main -entry-point-result=void \
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
// RUN: | FileCheck %s
// RUN: mlir-opt %s -linalg-tile="linalg-tile-sizes=0,5,5,5" \
// RUN: -test-conv-vectorization="tile-sizes=1,1,1,1,1,3,3,3,3" -convert-linalg-to-llvm | \
// RUN: mlir-cpu-runner -e main -entry-point-result=void \
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
// RUN: | FileCheck %s
func @print_memref_f32(memref<*xf32>)
// Creates and returns 5-D buffer of size (%s1, %s2, %s3, %s4, %s5) filled with the value %f
func @alloc_5d_filled_f32(%s1 : index, %s2 : index, %s3 : index, %s4 : index, %s5 : index, %f : f32) -> memref<?x?x?x?x?xf32> {
%buf = alloc(%s1, %s2, %s3, %s4, %s5) : memref<?x?x?x?x?xf32>
linalg.fill(%buf, %f) : memref<?x?x?x?x?xf32>, f32
return %buf : memref<?x?x?x?x?xf32>
}
func @conv_3d_ndhwc(%arg0: memref<?x?x?x?x?xf32>, %arg1: memref<?x?x?x?x?xf32>, %arg2: memref<?x?x?x?x?xf32>) {
linalg.conv_3d_ndhwc ins (%arg0, %arg1: memref<?x?x?x?x?xf32>, memref<?x?x?x?x?xf32>)
outs (%arg2: memref<?x?x?x?x?xf32>)
return
}
func @main() {
%c0 = constant 0 : index
%c1 = constant 1 : index
%c3 = constant 3 : index
%c6 = constant 6 : index
%c8 = constant 8 : index
%f10 = constant 10.00000e+00 : f32
%val = constant 2.00000e+00 : f32
%zero = constant 0.00000e+00 : f32
%filter3D_ndhwc = call @alloc_5d_filled_f32(%c1, %c3, %c3, %c3, %c1, %val) : (index, index, index, index, index, f32) -> (memref<?x?x?x?x?xf32>)
%in3D_ndhwc = call @alloc_5d_filled_f32(%c1, %c8, %c8, %c8, %c1, %val) : (index, index, index, index, index, f32) -> (memref<?x?x?x?x?xf32>)
%out3D_ndhwc = call @alloc_5d_filled_f32(%c1, %c6, %c6, %c6, %c1, %zero) : (index, index, index, index, index, f32) -> (memref<?x?x?x?x?xf32>)
store %f10, %in3D_ndhwc[%c0, %c0, %c0, %c3, %c0] : memref<?x?x?x?x?xf32>
call @conv_3d_ndhwc(%in3D_ndhwc, %filter3D_ndhwc, %out3D_ndhwc) : (memref<?x?x?x?x?xf32>, memref<?x?x?x?x?xf32>, memref<?x?x?x?x?xf32>) -> ()
%out3D_ndhwc_ = memref_cast %out3D_ndhwc : memref<?x?x?x?x?xf32> to memref<*xf32>
call @print_memref_f32(%out3D_ndhwc_): (memref<*xf32>) -> ()
dealloc %filter3D_ndhwc : memref<?x?x?x?x?xf32>
dealloc %in3D_ndhwc : memref<?x?x?x?x?xf32>
dealloc %out3D_ndhwc : memref<?x?x?x?x?xf32>
return
}
// CHECK: Unranked Memref {{.*}}
// CHECK-NEXT: [
// CHECK-SAME: [
// CHECK-SAME: [
// CHECK-SAME: [
// CHECK-SAME: [108],
// CHECK-COUNT-3: [124],
// CHECK-COUNT-2: [108]
// CHECK-SAME: ],
// CHECK-NEXT: [
// CHECK-COUNT-6: [108]
// CHECK-SAME: ],
// CHECK-NEXT: [
// CHECK-COUNT-6: [108]
// CHECK-SAME: ],
// CHECK-NEXT: [
// CHECK-COUNT-6: [108]
// CHECK-SAME: ],
// CHECK-NEXT: [
// CHECK-COUNT-6: [108]
// CHECK-SAME: ],
// CHECK-NEXT: [
// CHECK-COUNT-6: [108]
// CHECK-SAME: ]
// CHECK-SAME: ],
// CHECK-NEXT: [
// CHECK-SAME: [
// CHECK-COUNT-6: [108]
// CHECK-SAME: ],
// CHECK-NEXT: [
// CHECK-COUNT-6: [108]
// CHECK-SAME: ],
// CHECK-NEXT: [
// CHECK-COUNT-6: [108]
// CHECK-SAME: ],
// CHECK-NEXT: [
// CHECK-COUNT-6: [108]
// CHECK-SAME: ],
// CHECK-NEXT: [
// CHECK-COUNT-6: [108]
// CHECK-SAME: ],
// CHECK-NEXT: [
// CHECK-COUNT-6: [108]
// CHECK-SAME: ]
// CHECK-SAME: ],
// CHECK-NEXT: [
// CHECK-SAME: [
// CHECK-COUNT-6: [108]
// CHECK-SAME: ],
// CHECK-NEXT: [
// CHECK-COUNT-6: [108]
// CHECK-SAME: ],
// CHECK-NEXT: [
// CHECK-COUNT-6: [108]
// CHECK-SAME: ],
// CHECK-NEXT: [
// CHECK-COUNT-6: [108]
// CHECK-SAME: ],
// CHECK-NEXT: [
// CHECK-COUNT-6: [108]
// CHECK-SAME: ],
// CHECK-NEXT: [
// CHECK-COUNT-6: [108]
// CHECK-SAME: ]
// CHECK-SAME: ],
// CHECK-NEXT: [
// CHECK-SAME: [
// CHECK-COUNT-6: [108]
// CHECK-SAME: ],
// CHECK-NEXT: [
// CHECK-COUNT-6: [108]
// CHECK-SAME: ],
// CHECK-NEXT: [
// CHECK-COUNT-6: [108]
// CHECK-SAME: ],
// CHECK-NEXT: [
// CHECK-COUNT-6: [108]
// CHECK-SAME: ],
// CHECK-NEXT: [
// CHECK-COUNT-6: [108]
// CHECK-SAME: ],
// CHECK-NEXT: [
// CHECK-COUNT-6: [108]
// CHECK-SAME: ]
// CHECK-SAME: ],
// CHECK-NEXT: [
// CHECK-SAME: [
// CHECK-COUNT-6: [108]
// CHECK-SAME: ],
// CHECK-NEXT: [
// CHECK-COUNT-6: [108]
// CHECK-SAME: ],
// CHECK-NEXT: [
// CHECK-COUNT-6: [108]
// CHECK-SAME: ],
// CHECK-NEXT: [
// CHECK-COUNT-6: [108]
// CHECK-SAME: ],
// CHECK-NEXT: [
// CHECK-COUNT-6: [108]
// CHECK-SAME: ],
// CHECK-NEXT: [
// CHECK-COUNT-6: [108]
// CHECK-SAME: ]
// CHECK-SAME: ],
// CHECK-NEXT: [
// CHECK-SAME: [
// CHECK-COUNT-6: [108]
// CHECK-SAME: ],
// CHECK-NEXT: [
// CHECK-COUNT-6: [108]
// CHECK-SAME: ],
// CHECK-NEXT: [
// CHECK-COUNT-6: [108]
// CHECK-SAME: ],
// CHECK-NEXT: [
// CHECK-COUNT-6: [108]
// CHECK-SAME: ],
// CHECK-NEXT: [
// CHECK-COUNT-6: [108]
// CHECK-SAME: ],
// CHECK-NEXT: [
// CHECK-COUNT-6: [108]
// CHECK-SAME: ]
// CHECK-SAME: ]
// CHECK-SAME: ]
// CHECK-SAME: ]