blob: 62f32bd8ba1788914d843918c56a77f34d5336c0 [file] [log] [blame]
Marat Dukhan08c4a432019-10-03 09:29:21 -07001# Copyright 2019 Google LLC
2#
3# This source code is licensed under the BSD-style license found in the
4# LICENSE file in the root directory of this source tree.
5#
6# Description:
7# XNNPACK - optimized floating-point neural network operators library
8
9licenses(["notice"])
10
11exports_files(["LICENSE"])
12
13load(":build_defs.bzl", "xnnpack_aggregate_library", "xnnpack_benchmark", "xnnpack_binary", "xnnpack_cc_library", "xnnpack_min_size_copts", "xnnpack_optional_armcl_copts", "xnnpack_optional_armcl_deps", "xnnpack_optional_gemmlowp_copts", "xnnpack_optional_gemmlowp_deps", "xnnpack_optional_ruy_copts", "xnnpack_optional_ruy_deps", "xnnpack_optional_tflite_copts", "xnnpack_optional_tflite_deps", "xnnpack_std_copts", "xnnpack_unit_test", "xnnpack_visibility")
14
15OPERATOR_BENCHMARK_DEPS = [
16 ":XNNPACK",
17 ":bench_utils",
18 "@cpuinfo",
19 "@pthreadpool",
20]
21
22MICROKERNEL_BENCHMARK_DEPS = [
23 ":ukernels",
24 ":bench_utils",
25 "@cpuinfo",
26 "@FP16",
27 "@pthreadpool",
28]
29
30MICROKERNEL_TEST_DEPS = [
31 ":ukernels",
32 "@cpuinfo",
33 "@FP16",
34 "@pthreadpool",
35]
36
37OPERATOR_TEST_DEPS = [
38 ":XNNPACK",
39 "@pthreadpool",
40 "@FP16",
41]
42
43OPERATOR_SRCS = [
44 "src/add.c",
45 "src/argmax-pooling.c",
46 "src/average-pooling.c",
47 "src/channel-pad.c",
48 "src/channel-shuffle.c",
49 "src/clamp.c",
50 "src/convolution-spnchw.c",
51 "src/convolution.c",
52 "src/deconvolution.c",
53 "src/fully-connected.c",
54 "src/global-average-pooling-spnchw.c",
55 "src/global-average-pooling.c",
56 "src/hardswish.c",
57 "src/leaky-relu.c",
58 "src/max-pooling.c",
59 "src/prelu.c",
60 "src/sigmoid.c",
61 "src/softargmax.c",
62 "src/unpooling.c",
63]
64
65SCALAR_UKERNELS = [
66 "src/f32-argmaxpool/mp9p8q-scalar.c",
67 "src/f32-argmaxpool/up4-scalar.c",
68 "src/f32-argmaxpool/up9-scalar.c",
69 "src/f32-avgpool/mp9p8q-scalar.c",
70 "src/f32-avgpool/up9-scalar.c",
71 "src/f32-clamp/scalar.c",
72 "src/f32-igemm/1x4-scalar.c",
73 "src/f32-igemm/2x4-scalar.c",
74 "src/f32-igemm/4x2-scalar.c",
75 "src/f32-igemm/4x4-scalar.c",
76 "src/f32-dwconv/up1x25-scalar.c",
77 "src/f32-dwconv/up1x4-scalar.c",
78 "src/f32-dwconv/up1x9-scalar.c",
79 "src/f32-gavgpool/mp7p7q-scalar.c",
80 "src/f32-gavgpool/up7-scalar.c",
81 "src/f32-gemm/1x4-scalar.c",
82 "src/f32-gemm/2x4-scalar.c",
83 "src/f32-gemm/4x2-scalar.c",
84 "src/f32-gemm/4x4-scalar.c",
85 "src/f32-gemminc/1x4-scalar.c",
86 "src/f32-gemminc/2x4-scalar.c",
87 "src/f32-gemminc/4x4-scalar.c",
88 "src/f32-hswish/scalar.c",
89 "src/f32-maxpool/9p8q-scalar.c",
90 "src/f32-pavgpool/mp9p8q-scalar.c",
91 "src/f32-pavgpool/up9-scalar.c",
92 "src/f32-ppmm/2x4-scalar.c",
93 "src/f32-ppmm/3x3-scalar.c",
94 "src/f32-ppmm/4x2-scalar.c",
95 "src/f32-ppmm/4x4-scalar.c",
96 "src/f32-prelu/x4-scalar.c",
97 "src/f32-rmax/scalar.c",
98 "src/f32-spmm/1x1-scalar-pipelined.c",
99 "src/f32-spmm/1x1-scalar-unroll2.c",
100 "src/f32-spmm/1x1-scalar.c",
101 "src/f32-spmm/2x1-scalar-pipelined.c",
102 "src/f32-spmm/2x1-scalar-unroll2.c",
103 "src/f32-spmm/2x1-scalar.c",
104 "src/f32-spmm/4x1-scalar-pipelined.c",
105 "src/f32-spmm/4x1-scalar-unroll2.c",
106 "src/f32-spmm/4x1-scalar.c",
107 "src/f32-spmm/8x1-scalar-pipelined.c",
108 "src/f32-spmm/8x1-scalar-unroll2.c",
109 "src/f32-spmm/8x1-scalar.c",
110 "src/f32-vadd/scalar.c",
111 "src/f32-vmul/scalar.c",
112 "src/f32-vmulcaddc/c1-scalar-x2.c",
113 "src/f32-vsub/scalar.c",
114 "src/q8-avgpool/mp9p8q-scalar.c",
115 "src/q8-avgpool/up9-scalar.c",
116 "src/q8-igemm/2x2-scalar.c",
117 "src/q8-dwconv/up1x9-scalar.c",
118 "src/q8-gavgpool/mp7p7q-scalar.c",
119 "src/q8-gavgpool/up7-scalar.c",
120 "src/q8-gemm/2x2-scalar.c",
121 "src/q8-vadd/scalar.c",
122 "src/u8-clamp/scalar.c",
123 "src/u8-lut32norm/scalar.c",
124 "src/u8-maxpool/9p8q-scalar.c",
125 "src/u8-rmax/scalar.c",
126 "src/x32-packx/x2-scalar.c",
127 "src/x32-packx/x3-scalar.c",
128 "src/x32-packx/x4-scalar.c",
129 "src/x32-pad/x2-scalar.c",
130 "src/x32-unpool/scalar.c",
131 "src/x32-zip/x2-scalar.c",
132 "src/x32-zip/x3-scalar.c",
133 "src/x32-zip/x4-scalar.c",
134 "src/x32-zip/xm-scalar.c",
135 "src/x8-lut/scalar.c",
136 "src/x8-zip/x2-scalar.c",
137 "src/x8-zip/x3-scalar.c",
138 "src/x8-zip/x4-scalar.c",
139 "src/x8-zip/xm-scalar.c",
140]
141
142PSIMD_UKERNELS = [
143 "src/f32-argmaxpool/mp9p8q-psimd.c",
144 "src/f32-argmaxpool/up4-psimd.c",
145 "src/f32-argmaxpool/up9-psimd.c",
146 "src/f32-avgpool/mp9p8q-psimd.c",
147 "src/f32-avgpool/up9-psimd.c",
148 "src/f32-clamp/psimd.c",
149 "src/f32-igemm/1x8-psimd-loadsplat.c",
150 "src/f32-igemm/1x8-psimd-splat.c",
151 "src/f32-igemm/1x8s4-psimd.c",
152 "src/f32-igemm/4x2c4-psimd.c",
153 "src/f32-igemm/4x8-psimd-loadsplat.c",
154 "src/f32-igemm/4x8-psimd-splat.c",
155 "src/f32-igemm/4x8s4-psimd.c",
156 "src/f32-igemm/6x8-psimd-loadsplat.c",
157 "src/f32-igemm/6x8-psimd-splat.c",
158 "src/f32-igemm/6x8s4-psimd.c",
159 "src/f32-dwconv/up4x25-psimd.c",
160 "src/f32-dwconv/up4x4-psimd.c",
161 "src/f32-dwconv/up4x9-psimd.c",
162 "src/f32-gavgpool/mp7p7q-psimd.c",
163 "src/f32-gavgpool/up7-psimd.c",
164 "src/f32-gemm/1x8-psimd-loadsplat.c",
165 "src/f32-gemm/1x8-psimd-splat.c",
166 "src/f32-gemm/1x8s4-psimd.c",
167 "src/f32-gemm/4x8-psimd-loadsplat.c",
168 "src/f32-gemm/4x8-psimd-splat.c",
169 "src/f32-gemm/4x8s4-psimd.c",
170 "src/f32-gemm/6x8-psimd-loadsplat.c",
171 "src/f32-gemm/6x8-psimd-splat.c",
172 "src/f32-gemm/6x8s4-psimd.c",
173 "src/f32-gemminc/1x8-psimd-loadsplat.c",
174 "src/f32-gemminc/1x8-psimd-splat.c",
175 "src/f32-gemminc/1x8s4-psimd.c",
176 "src/f32-gemminc/4x8-psimd-loadsplat.c",
177 "src/f32-gemminc/4x8-psimd-splat.c",
178 "src/f32-gemminc/4x8s4-psimd.c",
179 "src/f32-gemminc/6x8-psimd-loadsplat.c",
180 "src/f32-gemminc/6x8-psimd-splat.c",
181 "src/f32-gemminc/6x8s4-psimd.c",
182 "src/f32-hswish/psimd.c",
183 "src/f32-maxpool/9p8q-psimd.c",
184 "src/f32-pavgpool/mp9p8q-psimd.c",
185 "src/f32-pavgpool/up9-psimd.c",
186 "src/f32-ppmm/4x8-psimd.c",
187 "src/f32-prelu/x4-psimd.c",
188 "src/f32-vadd/psimd.c",
189 "src/f32-vmul/psimd.c",
190 "src/f32-vmulcaddc/c4-psimd-x2.c",
191 "src/f32-vsub/psimd.c",
192 "src/x32-packx/x4-psimd.c",
193 "src/x32-pad/x2-psimd.c",
194 "src/x32-unpool/psimd.c",
195 "src/x32-zip/x2-psimd.c",
196 "src/x32-zip/x3-psimd.c",
197 "src/x32-zip/x4-psimd.c",
198 "src/x32-zip/xm-psimd.c",
199]
200
201# ISA-specific micro-kernels
202NEON_UKERNELS = [
203 "src/f32-avgpool/mp9p8q-neon.c",
204 "src/f32-avgpool/up9-neon.c",
205 "src/f32-clamp/neon.c",
206 "src/f32-igemm/1x8-neon-ld64.c",
207 "src/f32-igemm/4x12-neon-ld64.c",
208 "src/f32-igemm/4x2-neon-ld64.c",
209 "src/f32-igemm/4x4-neon-ld64.c",
210 "src/f32-igemm/4x8-neon-ld128.c",
211 "src/f32-igemm/4x8-neon-ld64.c",
212 "src/f32-igemm/6x8-neon-ld64.c",
213 "src/f32-dwconv/up4x9-neon.c",
214 "src/f32-gavgpool-spchw/neon-x4.c",
215 "src/f32-gavgpool/mp7p7q-neon.c",
216 "src/f32-gavgpool/up7-neon.c",
217 "src/f32-gemm/1x8-neon-ld64.c",
218 "src/f32-gemm/4x12-neon-ld64.c",
219 "src/f32-gemm/4x2-neon-ld64.c",
220 "src/f32-gemm/4x8-neon-ld128.c",
221 "src/f32-gemm/4x8-neon-ld64.c",
222 "src/f32-gemm/5x8-neon-ld64.c",
223 "src/f32-gemm/6x8-neon-ld64.c",
224 "src/f32-gemminc/1x8-neon-ld64.c",
225 "src/f32-gemminc/4x12-neon-ld64.c",
226 "src/f32-gemminc/4x8-neon-ld128.c",
227 "src/f32-gemminc/4x8-neon-ld64.c",
228 "src/f32-gemminc/5x8-neon-ld64.c",
229 "src/f32-gemminc/6x8-neon-ld64.c",
230 "src/f32-hswish/neon.c",
231 "src/f32-pavgpool/mp9p8q-neon.c",
232 "src/f32-pavgpool/up9-neon.c",
233 "src/f32-ppmm/4x8-neon.c",
234 "src/f32-ppmm/8x8-neon.c",
235 "src/f32-rmax/neon.c",
236 "src/f32-vmulcaddc/c4-neon-x2.c",
237 "src/q8-avgpool/mp9p8q-neon.c",
238 "src/q8-avgpool/up9-neon.c",
239 "src/q8-igemm/4x8-neon.c",
240 "src/q8-igemm/8x8-neon.c",
241 "src/q8-dwconv/up8x9-neon.c",
242 "src/q8-gavgpool/mp7p7q-neon.c",
243 "src/q8-gavgpool/up7-neon.c",
244 "src/q8-gemm/4x8-neon.c",
245 "src/q8-gemm/8x8-neon.c",
246 "src/q8-vadd/neon.c",
247 "src/u8-clamp/neon.c",
248 "src/u8-maxpool/9p8q-neon.c",
249 "src/u8-rmax/neon.c",
250 "src/x32-packx/x4-neon-st4.c",
251 "src/x32-pad/x2-neon.c",
252 "src/x32-zip/x2-neon.c",
253 "src/x32-zip/x3-neon.c",
254 "src/x32-zip/x4-neon.c",
255 "src/x32-zip/xm-neon.c",
256 "src/x8-zip/x2-neon.c",
257 "src/x8-zip/x3-neon.c",
258 "src/x8-zip/x4-neon.c",
259 "src/x8-zip/xm-neon.c",
260]
261
262NEONFMA_UKERNELS = [
Frank Barcharddb45b6a2019-10-09 16:42:45 -0700263 "src/f32-igemm/1x8-neonfma-ld64.c",
Marat Dukhan08c4a432019-10-03 09:29:21 -0700264 "src/f32-igemm/4x12-neonfma-ld64.c",
265 "src/f32-igemm/4x2-neonfma-ld64.c",
266 "src/f32-igemm/4x4-neonfma-ld64.c",
267 "src/f32-igemm/4x8-neonfma-ld128.c",
268 "src/f32-igemm/4x8-neonfma-ld64.c",
269 "src/f32-igemm/6x8-neonfma-ld64.c",
270 "src/f32-dwconv/up4x9-neonfma.c",
271 "src/f32-dwconv/up8x9-neonfma.c",
272 "src/f32-gemm/1x8-neonfma-ld64.c",
273 "src/f32-gemm/4x12-neonfma-ld64.c",
274 "src/f32-gemm/4x2-neonfma-ld64.c",
275 "src/f32-gemm/4x8-neonfma-ld128.c",
276 "src/f32-gemm/4x8-neonfma-ld64.c",
277 "src/f32-gemm/5x8-neonfma-ld64.c",
278 "src/f32-gemm/6x8-neonfma-ld64.c",
279 "src/f32-gemminc/1x8-neonfma-ld64.c",
280 "src/f32-gemminc/4x12-neonfma-ld64.c",
281 "src/f32-gemminc/4x8-neonfma-ld128.c",
282 "src/f32-gemminc/4x8-neonfma-ld64.c",
283 "src/f32-gemminc/5x8-neonfma-ld64.c",
284 "src/f32-gemminc/6x8-neonfma-ld64.c",
285 "src/f32-hswish/neonfma.c",
286 "src/f32-ppmm/4x8-neonfma.c",
287 "src/f32-ppmm/8x8-neonfma.c",
288 "src/f32-vmulcaddc/c4-neonfma-x2.c",
289]
290
291AARCH64_NEONFMA_UKERNELS = [
292 "src/f32-conv-hwc/3x3s2p1c3x4-neonfma-2x2.c",
293 "src/f32-conv-hwc/3x3s2p1c3x8-neonfma-2x2.c",
294 "src/f32-conv-hwc2spchw/3x3s2p1c3x4-neonfma-2x2.c",
295 "src/f32-dwconv-spchw/3x3p1-neonfma.c",
296 "src/f32-dwconv-spchw/5x5p2-neonfma.c",
297 "src/f32-dwconv-spchw/3x3s2p1-neonfma.c",
298 "src/f32-dwconv-spchw/5x5s2p2-neonfma.c",
299 "src/f32-spmm/12x1-neonfma.c",
300 "src/f32-spmm/12x2-neonfma.c",
301 "src/f32-spmm/12x4-neonfma.c",
302 "src/f32-spmm/16x1-neonfma-pipelined.c",
303 "src/f32-spmm/16x1-neonfma-unroll2.c",
304 "src/f32-spmm/16x1-neonfma.c",
305 "src/f32-spmm/16x2-neonfma.c",
306 "src/f32-spmm/16x4-neonfma.c",
307 "src/f32-spmm/4x1-neonfma-pipelined.c",
308 "src/f32-spmm/4x1-neonfma-unroll2.c",
309 "src/f32-spmm/4x1-neonfma.c",
310 "src/f32-spmm/4x2-neonfma.c",
311 "src/f32-spmm/4x4-neonfma.c",
312 "src/f32-spmm/8x1-neonfma-pipelined.c",
313 "src/f32-spmm/8x1-neonfma-unroll2.c",
314 "src/f32-spmm/8x1-neonfma.c",
315 "src/f32-spmm/8x2-neonfma.c",
316 "src/f32-spmm/8x4-neonfma.c",
317]
318
319AARCH64_NEONFP16ARITH_UKERNELS = [
320 "src/f16-gemm/4x8-neonfp16arith-ld64.c",
321 "src/f16-gemm/6x8-neonfp16arith-ld64.c",
322 "src/f16-gemm/8x8-neonfp16arith-ld64.c",
323]
324
325SSE_UKERNELS = [
326 "src/f32-avgpool/mp9p8q-sse.c",
327 "src/f32-avgpool/up9-sse.c",
328 "src/f32-clamp/sse.c",
329 "src/f32-igemm/1x8-sse-dup.c",
330 "src/f32-igemm/1x8-sse-load1.c",
331 "src/f32-igemm/1x8s4-sse.c",
332 "src/f32-igemm/4x2c4-sse.c",
333 "src/f32-igemm/4x8-sse-dup.c",
334 "src/f32-igemm/4x8-sse-load1.c",
335 "src/f32-igemm/4x8s4-sse.c",
336 "src/f32-dwconv/up4x25-sse.c",
337 "src/f32-dwconv/up4x4-sse.c",
338 "src/f32-dwconv/up4x9-sse.c",
339 "src/f32-gavgpool-spchw/sse-x4.c",
340 "src/f32-gavgpool/mp7p7q-sse.c",
341 "src/f32-gavgpool/up7-sse.c",
342 "src/f32-gemm/1x8-sse-dup.c",
343 "src/f32-gemm/1x8-sse-load1.c",
344 "src/f32-gemm/1x8s4-sse.c",
345 "src/f32-gemm/4x8-sse-dup.c",
346 "src/f32-gemm/4x8-sse-load1.c",
347 "src/f32-gemm/4x8s4-sse.c",
348 "src/f32-gemminc/1x8-sse-dup.c",
349 "src/f32-gemminc/1x8-sse-load1.c",
350 "src/f32-gemminc/1x8s4-sse.c",
351 "src/f32-gemminc/4x8-sse-dup.c",
352 "src/f32-gemminc/4x8-sse-load1.c",
353 "src/f32-gemminc/4x8s4-sse.c",
354 "src/f32-hswish/sse.c",
355 "src/f32-maxpool/9p8q-sse.c",
356 "src/f32-pavgpool/mp9p8q-sse.c",
357 "src/f32-pavgpool/up9-sse.c",
358 "src/f32-dwconv-spchw/3x3p1-sse.c",
359 "src/f32-dwconv-spchw/3x3s2p1-sse.c",
360 "src/f32-ppmm/4x8-sse.c",
361 "src/f32-prelu/x4-sse.c",
362 "src/f32-rmax/sse.c",
363 "src/f32-spmm/4x1-sse.c",
364 "src/f32-spmm/8x1-sse.c",
365 "src/f32-vadd/sse.c",
366 "src/f32-vmul/sse.c",
367 "src/f32-vmulcaddc/c4-sse-x2.c",
368 "src/f32-vsub/sse.c",
369 "src/x32-packx/x4-sse.c",
370]
371
372SSE2_UKERNELS = [
373 "src/f32-argmaxpool/mp9p8q-sse2.c",
374 "src/f32-argmaxpool/up4-sse2.c",
375 "src/f32-argmaxpool/up9-sse2.c",
376 "src/q8-avgpool/mp9p8q-sse2.c",
377 "src/q8-avgpool/up9-sse2.c",
378 "src/q8-igemm/4x4c2-sse2.c",
379 "src/q8-dwconv/up8x9-sse2.c",
380 "src/q8-gavgpool/mp7p7q-sse2.c",
381 "src/q8-gavgpool/up7-sse2.c",
382 "src/q8-gemm/2x4c8-sse2.c",
383 "src/q8-gemm/4x4c2-sse2.c",
384 "src/q8-vadd/sse2.c",
385 "src/u8-clamp/sse2.c",
386 "src/u8-maxpool/9p8q-sse2.c",
387 "src/u8-rmax/sse2.c",
388 "src/x32-pad/x2-sse2.c",
389 "src/x32-zip/x2-sse2.c",
390 "src/x32-zip/x3-sse2.c",
391 "src/x32-zip/x4-sse2.c",
392 "src/x32-zip/xm-sse2.c",
393 "src/x8-zip/x2-sse2.c",
394 "src/x8-zip/x3-sse2.c",
395 "src/x8-zip/x4-sse2.c",
396 "src/x8-zip/xm-sse2.c",
397]
398
399AVX_UKERNELS = [
400 "src/f32-rmax/avx.c",
401]
402
403AVX512F_UKERNELS = [
404 "src/f32-rmax/avx512f.c",
405]
406
407AARCH32_ASM_UKERNELS = [
408 "src/q8-dwconv/up8x9-aarch32-neon.S",
409]
410
411AARCH64_ASM_UKERNELS = [
412 "src/f32-dwconv/up4x9-aarch64-neonfma-cortex-a55.S",
413 "src/f32-dwconv/up4x9-aarch64-neonfma.S",
414 "src/f32-gemm/1x12-aarch64-neonfma-cortex-a53.S",
Frank Barchard21be34f2019-10-09 19:32:19 -0700415 "src/f32-gemm/1x8-aarch64-neonfma-cortex-a53.S",
Marat Dukhan08c4a432019-10-03 09:29:21 -0700416 "src/f32-gemm/1x8-aarch64-neonfma-cortex-a57.S",
417 "src/f32-gemm/1x8-aarch64-neonfma-cortex-a75.S",
418 "src/f32-gemm/4x12-aarch64-neonfma-cortex-a53.S",
419 "src/f32-gemm/4x8-aarch64-neonfma-cortex-a57.S",
420 "src/f32-gemm/4x8-aarch64-neonfma-cortex-a75.S",
421 "src/f32-gemm/4x8-aarch64-neonfma-ld128.S",
422 "src/f32-gemm/4x8-aarch64-neonfma-ld64.S",
423 "src/f32-gemm/5x8-aarch64-neonfma-cortex-a75.S",
424 "src/f32-gemm/6x8-aarch64-neonfma-cortex-a57.S",
425 "src/f32-gemm/6x8-aarch64-neonfma-cortex-a73.S",
426 "src/f32-gemm/6x8-aarch64-neonfma-cortex-a75.S",
427 "src/f32-gemm/6x8-aarch64-neonfma-ld128.S",
428 "src/f32-gemm/6x8-aarch64-neonfma-ld64.S",
429 "src/f32-gemminc/1x12-aarch64-neonfma-cortex-a53.S",
Frank Barchard21be34f2019-10-09 19:32:19 -0700430 "src/f32-gemminc/1x8-aarch64-neonfma-cortex-a53.S",
Marat Dukhan08c4a432019-10-03 09:29:21 -0700431 "src/f32-gemminc/1x8-aarch64-neonfma-cortex-a57.S",
432 "src/f32-gemminc/1x8-aarch64-neonfma-cortex-a75.S",
433 "src/f32-gemminc/4x12-aarch64-neonfma-cortex-a53.S",
434 "src/f32-gemminc/4x8-aarch64-neonfma-cortex-a57.S",
435 "src/f32-gemminc/4x8-aarch64-neonfma-cortex-a75.S",
436 "src/f32-gemminc/4x8-aarch64-neonfma-ld128.S",
437 "src/f32-gemminc/4x8-aarch64-neonfma-ld64.S",
438 "src/f32-gemminc/5x8-aarch64-neonfma-cortex-a75.S",
439 "src/f32-gemminc/6x8-aarch64-neonfma-cortex-a57.S",
440 "src/f32-gemminc/6x8-aarch64-neonfma-cortex-a73.S",
441 "src/f32-gemminc/6x8-aarch64-neonfma-cortex-a75.S",
442 "src/f32-gemminc/6x8-aarch64-neonfma-ld128.S",
443 "src/f32-gemminc/6x8-aarch64-neonfma-ld64.S",
444 "src/f32-igemm/1x12-aarch64-neonfma-cortex-a53.S",
Frank Barchard21be34f2019-10-09 19:32:19 -0700445 "src/f32-igemm/1x8-aarch64-neonfma-cortex-a53.S",
Marat Dukhan08c4a432019-10-03 09:29:21 -0700446 "src/f32-igemm/1x8-aarch64-neonfma-cortex-a57.S",
447 "src/f32-igemm/1x8-aarch64-neonfma-cortex-a75.S",
448 "src/f32-igemm/4x12-aarch64-neonfma-cortex-a53.S",
449 "src/f32-igemm/4x8-aarch64-neonfma-cortex-a75.S",
450 "src/f32-igemm/5x8-aarch64-neonfma-cortex-a75.S",
451 "src/f32-igemm/6x8-aarch64-neonfma-cortex-a57.S",
452 "src/f32-igemm/6x8-aarch64-neonfma-cortex-a73.S",
453 "src/f32-igemm/6x8-aarch64-neonfma-cortex-a75.S",
454]
455
456INTERNAL_MICROKERNEL_HDRS = [
457 "src/xnnpack/argmaxpool.h",
458 "src/xnnpack/avgpool.h",
459 "src/xnnpack/clamp.h",
460 "src/xnnpack/common.h",
461 "src/xnnpack/conv.h",
462 "src/xnnpack/dwconv.h",
463 "src/xnnpack/gavgpool.h",
464 "src/xnnpack/gemm.h",
465 "src/xnnpack/hswish.h",
466 "src/xnnpack/igemm.h",
467 "src/xnnpack/lut.h",
468 "src/xnnpack/math.h",
469 "src/xnnpack/maxpool.h",
470 "src/xnnpack/packx.h",
471 "src/xnnpack/pad.h",
472 "src/xnnpack/params.h",
473 "src/xnnpack/pavgpool.h",
474 "src/xnnpack/ppmm.h",
475 "src/xnnpack/prelu.h",
476 "src/xnnpack/rmax.h",
477 "src/xnnpack/scalar-utils.h",
478 "src/xnnpack/spmm.h",
479 "src/xnnpack/unpool.h",
480 "src/xnnpack/vadd.h",
481 "src/xnnpack/vmul.h",
482 "src/xnnpack/vmulcaddc.h",
483 "src/xnnpack/vsub.h",
484 "src/xnnpack/zip.h",
485]
486
487INTERNAL_HDRS = INTERNAL_MICROKERNEL_HDRS + [
488 "include/xnnpack.h",
489 "src/xnnpack/allocator.h",
490 "src/xnnpack/compute.h",
491 "src/xnnpack/im2col.h",
492 "src/xnnpack/indirection.h",
Marat Dukhan08c4a432019-10-03 09:29:21 -0700493 "src/xnnpack/operator.h",
494 "src/xnnpack/pack.h",
495 "src/xnnpack/requantization.h",
496 "src/xnnpack/requantization-stubs.h",
497]
498
499MICROKERNEL_BENCHMARK_HDRS = INTERNAL_MICROKERNEL_HDRS + [
500 "src/xnnpack/requantization.h",
501 "include/xnnpack.h",
502]
503
504MICROKERNEL_TEST_HDRS = INTERNAL_MICROKERNEL_HDRS + [
505 "src/xnnpack/isa-checks.h",
506 "src/xnnpack/requantization.h",
507 "include/xnnpack.h",
508]
509
510OPERATOR_TEST_PARAMS_HDRS = [
511 "src/xnnpack/params.h",
512 "src/xnnpack/common.h",
513]
514
515WEIGHTS_PACK_HDRS = [
516 "src/xnnpack/pack.h",
517 "src/xnnpack/operator.h",
518 "src/xnnpack/compute.h",
519]
520
Marat Dukhanc8e00eb2019-10-04 14:55:26 -0700521LOGGING_COPTS = select({
522 # No logging in optimized mode
523 ":optimized_build": ["-DXNN_LOG_LEVEL=0"],
524 # Full logging in debug mode
525 ":debug_build": ["-DXNN_LOG_LEVEL=5"],
526 # Error-only logging in default (fastbuild) mode
527 "//conditions:default": ["-DXNN_LOG_LEVEL=2"],
528})
529
530LOGGING_HDRS = [
531 "src/xnnpack/log.h",
532]
533
Marat Dukhan08c4a432019-10-03 09:29:21 -0700534xnnpack_cc_library(
535 name = "scalar_ukernels",
536 srcs = SCALAR_UKERNELS,
537 hdrs = INTERNAL_HDRS,
538 aarch32_copts = ["-marm"],
539 copts = xnnpack_std_copts(),
540 deps = [
541 "@FP16",
542 "@FXdiv",
543 ],
544)
545
546xnnpack_cc_library(
547 name = "psimd_ukernels",
548 srcs = PSIMD_UKERNELS,
549 hdrs = INTERNAL_HDRS,
550 aarch32_copts = [
551 "-marm",
552 "-mfpu=neon",
553 ],
554 copts = xnnpack_std_copts(),
555 optimized_copts = [
556 "-O3",
557 "-ffast-math",
558 ],
559 deps = [
560 "@FP16",
561 "@psimd",
562 ],
563)
564
565xnnpack_cc_library(
566 name = "neon_ukernels",
567 hdrs = INTERNAL_HDRS,
568 aarch32_copts = [
569 "-marm",
570 "-mfpu=neon",
571 ],
572 aarch32_srcs = NEON_UKERNELS,
573 aarch64_srcs = NEON_UKERNELS,
574 copts = xnnpack_std_copts(),
575 deps = ["@FP16"],
576)
577
578xnnpack_cc_library(
579 name = "neonfma_ukernels",
580 hdrs = INTERNAL_HDRS,
581 aarch32_copts = [
582 "-marm",
583 "-mfpu=neon-vfpv4",
584 ],
585 aarch32_srcs = NEONFMA_UKERNELS,
586 aarch64_srcs = NEONFMA_UKERNELS + AARCH64_NEONFMA_UKERNELS,
587 copts = xnnpack_std_copts(),
588 deps = ["@FP16"],
589)
590
591xnnpack_cc_library(
592 name = "neonfp16arith_ukernels",
593 hdrs = INTERNAL_HDRS,
594 aarch64_copts = ["-march=armv8.2-a+fp16"],
595 aarch64_srcs = AARCH64_NEONFP16ARITH_UKERNELS,
596 copts = xnnpack_std_copts(),
597 deps = ["@FP16"],
598)
599
600xnnpack_cc_library(
601 name = "sse2_ukernels",
602 hdrs = INTERNAL_HDRS,
603 copts = xnnpack_std_copts(),
604 x86_copts = ["-msse2"],
605 x86_srcs = SSE_UKERNELS + SSE2_UKERNELS,
606 deps = ["@FP16"],
607)
608
609xnnpack_cc_library(
610 name = "avx_ukernels",
611 hdrs = INTERNAL_HDRS,
612 copts = xnnpack_std_copts(),
613 x86_copts = ["-mavx"],
614 x86_srcs = AVX_UKERNELS,
615 deps = ["@FP16"],
616)
617
618xnnpack_cc_library(
619 name = "avx512f_ukernels",
620 hdrs = INTERNAL_HDRS,
621 copts = xnnpack_std_copts(),
622 x86_copts = ["-mavx512f"],
623 x86_srcs = AVX512F_UKERNELS,
624 deps = ["@FP16"],
625)
626
627xnnpack_cc_library(
628 name = "asm_ukernels",
629 hdrs = ["src/xnnpack/assembly.h"],
630 aarch32_srcs = AARCH32_ASM_UKERNELS,
631 aarch64_srcs = AARCH64_ASM_UKERNELS,
632)
633
634xnnpack_aggregate_library(
635 name = "ukernels",
636 aarch32_deps = [
637 ":psimd_ukernels",
638 ":neon_ukernels",
639 ":neonfma_ukernels",
640 ":asm_ukernels",
641 ],
642 aarch64_deps = [
643 ":psimd_ukernels",
644 ":neon_ukernels",
645 ":neonfma_ukernels",
646 ":neonfp16arith_ukernels",
647 ":asm_ukernels",
648 ],
649 generic_deps = [":scalar_ukernels"],
650 wasmsimd_deps = [
651 ":psimd_ukernels",
652 ],
653 x86_deps = [
654 ":psimd_ukernels",
655 ":sse2_ukernels",
656 ":avx_ukernels",
657 ":avx512f_ukernels",
658 ],
659)
660
661xnnpack_cc_library(
662 name = "im2col",
663 srcs = ["src/im2col.c"],
664 hdrs = [
665 "src/xnnpack/common.h",
666 "src/xnnpack/im2col.h",
667 ],
668 copts = xnnpack_std_copts(),
669)
670
671xnnpack_cc_library(
672 name = "indirection",
673 srcs = ["src/indirection.c"],
674 hdrs = INTERNAL_HDRS,
675 copts = xnnpack_std_copts(),
676 deps = [
677 "@FP16",
678 "@FXdiv",
679 "@pthreadpool",
680 ],
681)
682
683xnnpack_cc_library(
684 name = "operator_run",
685 srcs = ["src/operator-run.c"],
Marat Dukhanc8e00eb2019-10-04 14:55:26 -0700686 hdrs = INTERNAL_HDRS + LOGGING_HDRS,
687 copts = xnnpack_std_copts() + LOGGING_COPTS + [
Marat Dukhan08c4a432019-10-03 09:29:21 -0700688 # Wrappers for multi-pass microkernels use VLAs for temporary buffers.
689 "-Wno-vla",
690 ],
691 deps = [
692 "@FP16",
693 "@FXdiv",
694 "@clog",
695 "@pthreadpool",
696 ],
697)
698
699cc_library(
700 name = "enable_assembly",
701 defines = select({
702 ":xnn_enable_assembly_explicit_true": ["XNN_ENABLE_ASSEMBLY=1"],
703 ":xnn_enable_assembly_explicit_false": ["XNN_ENABLE_ASSEMBLY=0"],
Frank Barchard810171d2019-10-10 10:34:51 -0700704 "//conditions:default": ["XNN_ENABLE_ASSEMBLY=1"],
Marat Dukhan08c4a432019-10-03 09:29:21 -0700705 }),
706)
707
Marat Dukhancf056b22019-10-07 10:26:29 -0700708xnnpack_cc_library(
Marat Dukhan08c4a432019-10-03 09:29:21 -0700709 name = "operators",
710 srcs = OPERATOR_SRCS + [
Marat Dukhan08c4a432019-10-03 09:29:21 -0700711 "src/operator-delete.c",
Marat Dukhancf056b22019-10-07 10:26:29 -0700712 ],
713 hdrs = INTERNAL_HDRS + LOGGING_HDRS,
Marat Dukhanc8e00eb2019-10-04 14:55:26 -0700714 copts = xnnpack_std_copts() + LOGGING_COPTS + [
Marat Dukhan08c4a432019-10-03 09:29:21 -0700715 "-Isrc",
716 "-Iinclude",
717 ] + select({
718 ":debug_build": [],
719 "//conditions:default": xnnpack_min_size_copts(),
720 }),
Marat Dukhancf056b22019-10-07 10:26:29 -0700721 wasm_srcs = ["src/wasm-stubs.c"],
722 wasmsimd_srcs = ["src/wasm-stubs.c"],
Marat Dukhan08c4a432019-10-03 09:29:21 -0700723 deps = [
Marat Dukhan08c4a432019-10-03 09:29:21 -0700724 ":indirection",
Marat Dukhan08c4a432019-10-03 09:29:21 -0700725 "@FP16",
726 "@FXdiv",
727 "@clog",
Marat Dukhan08c4a432019-10-03 09:29:21 -0700728 "@pthreadpool",
Marat Dukhan8fe54e42019-10-10 14:12:59 -0700729 ],
730)
731
732cc_library(
733 name = "XNNPACK",
734 srcs = [
735 "src/init.c",
736 ],
737 copts = xnnpack_std_copts() + LOGGING_COPTS + [
738 "-Isrc",
739 "-Iinclude",
740 ] + select({
741 ":debug_build": [],
742 "//conditions:default": xnnpack_min_size_copts(),
743 }),
744 includes = ["include"],
745 linkstatic = True,
746 textual_hdrs = ["include/xnnpack.h"],
747 visibility = xnnpack_visibility(),
748 deps = [
749 ":enable_assembly",
750 ":ukernels",
751 ":operator_run",
752 ":operators",
753 "@clog",
754 "@pthreadpool",
Marat Dukhand343c222019-10-07 09:22:14 -0700755 ] + select({
756 ":emscripten": [],
757 "//conditions:default": ["@cpuinfo"],
758 }),
Marat Dukhan08c4a432019-10-03 09:29:21 -0700759)
760
761cc_library(
Marat Dukhan8fe54e42019-10-10 14:12:59 -0700762 name = "xnnpack_operators_nhwc_f32",
763 srcs = [
764 "src/init.c",
765 ],
766 copts = xnnpack_std_copts() + LOGGING_COPTS + [
767 "-Isrc",
768 "-Iinclude",
769 ] + select({
770 ":debug_build": [],
771 "//conditions:default": xnnpack_min_size_copts(),
772 }),
773 defines = [
774 "XNN_NO_Q8_OPERATORS",
775 "XNN_NO_U8_OPERATORS",
776 "XNN_NO_X8_OPERATORS",
777 "XNN_NO_SPNCHW_OPERATORS",
778 ],
Marat Dukhan08c4a432019-10-03 09:29:21 -0700779 includes = ["include"],
780 linkstatic = True,
Marat Dukhan8fe54e42019-10-10 14:12:59 -0700781 textual_hdrs = ["include/xnnpack.h"],
Marat Dukhan08c4a432019-10-03 09:29:21 -0700782 visibility = xnnpack_visibility(),
783 deps = [
Marat Dukhan8fe54e42019-10-10 14:12:59 -0700784 ":enable_assembly",
785 ":ukernels",
Marat Dukhan08c4a432019-10-03 09:29:21 -0700786 ":operator_run",
787 ":operators",
Marat Dukhan8fe54e42019-10-10 14:12:59 -0700788 "@clog",
Marat Dukhan08c4a432019-10-03 09:29:21 -0700789 "@pthreadpool",
Marat Dukhan8fe54e42019-10-10 14:12:59 -0700790 ] + select({
791 ":emscripten": [],
792 "//conditions:default": ["@cpuinfo"],
793 }),
Marat Dukhan08c4a432019-10-03 09:29:21 -0700794)
795
Marat Dukhancf056b22019-10-07 10:26:29 -0700796xnnpack_cc_library(
Marat Dukhan08c4a432019-10-03 09:29:21 -0700797 name = "bench_utils",
798 srcs = ["bench/utils.cc"],
799 hdrs = ["bench/utils.h"],
800 copts = ["-Wno-unused-result"],
Marat Dukhan08c4a432019-10-03 09:29:21 -0700801 deps = ["@cpuinfo"],
802)
803
804######################### Unit tests for micro-kernels #########################
805
806xnnpack_benchmark(
807 name = "q8_gemm_bench",
808 srcs = [
809 "bench/gemm.h",
810 "bench/q8-gemm.cc",
811 "src/xnnpack/AlignedAllocator.h",
812 ] + WEIGHTS_PACK_HDRS + MICROKERNEL_BENCHMARK_HDRS,
813 copts = ["-Wno-unused-function"] + xnnpack_optional_ruy_copts() + xnnpack_optional_gemmlowp_copts(),
814 deps = MICROKERNEL_BENCHMARK_DEPS + xnnpack_optional_ruy_deps() + xnnpack_optional_gemmlowp_deps(),
815)
816
817xnnpack_benchmark(
818 name = "f16_gemm_bench",
819 srcs = [
820 "bench/f16-gemm.cc",
821 "bench/gemm.h",
822 "src/xnnpack/AlignedAllocator.h",
823 ] + WEIGHTS_PACK_HDRS + MICROKERNEL_BENCHMARK_HDRS,
824 copts = ["-Wno-unused-function"],
825 deps = MICROKERNEL_BENCHMARK_DEPS,
826)
827
828xnnpack_benchmark(
829 name = "f32_igemm_bench",
830 srcs = [
831 "bench/f32-igemm.cc",
832 "bench/conv.h",
833 "src/xnnpack/AlignedAllocator.h",
834 ] + MICROKERNEL_BENCHMARK_HDRS,
Frank Barcharddbafc582019-10-09 16:30:48 -0700835 deps = MICROKERNEL_BENCHMARK_DEPS + [
836 ":enable_assembly",
837 ":indirection",
838 ],
Marat Dukhan08c4a432019-10-03 09:29:21 -0700839)
840
841xnnpack_benchmark(
842 name = "f32_conv_hwc_bench",
843 srcs = [
844 "bench/f32-conv-hwc.cc",
845 "bench/dconv.h",
846 "src/xnnpack/AlignedAllocator.h",
847 ] + WEIGHTS_PACK_HDRS + MICROKERNEL_BENCHMARK_HDRS,
848 copts = ["-Wno-unused-function"],
849 deps = MICROKERNEL_BENCHMARK_DEPS,
850)
851
852xnnpack_benchmark(
853 name = "f32_dwconv_bench",
854 srcs = [
855 "bench/f32-dwconv.cc",
856 "bench/dwconv.h",
857 "src/xnnpack/AlignedAllocator.h",
858 ] + MICROKERNEL_BENCHMARK_HDRS,
859 deps = MICROKERNEL_BENCHMARK_DEPS + [":indirection"],
860)
861
862xnnpack_benchmark(
863 name = "f32_dwconv_spchw_bench",
864 srcs = [
865 "bench/f32-dwconv-spchw.cc",
866 "bench/dwconv.h",
867 "src/xnnpack/AlignedAllocator.h",
868 ] + WEIGHTS_PACK_HDRS + MICROKERNEL_BENCHMARK_HDRS,
869 deps = MICROKERNEL_BENCHMARK_DEPS + [":indirection"],
870)
871
872xnnpack_benchmark(
873 name = "f32_gemm_bench",
874 srcs = [
875 "bench/f32-gemm.cc",
876 "bench/gemm.h",
877 "src/xnnpack/AlignedAllocator.h",
878 ] + WEIGHTS_PACK_HDRS + MICROKERNEL_BENCHMARK_HDRS,
879 copts = ["-Wno-unused-function"] + xnnpack_optional_ruy_copts(),
Frank Barcharddbafc582019-10-09 16:30:48 -0700880 deps = MICROKERNEL_BENCHMARK_DEPS + xnnpack_optional_ruy_deps() + [
881 ":enable_assembly",
882 ],
Marat Dukhan08c4a432019-10-03 09:29:21 -0700883)
884
885xnnpack_benchmark(
886 name = "f32_rmax_bench",
887 srcs = [
888 "bench/f32-rmax.cc",
889 "src/xnnpack/AlignedAllocator.h",
890 ] + MICROKERNEL_BENCHMARK_HDRS,
891 deps = MICROKERNEL_BENCHMARK_DEPS,
892)
893
894xnnpack_benchmark(
895 name = "f32_spmm_bench",
896 srcs = [
897 "bench/f32-spmm.cc",
898 "bench/gemm.h",
899 "src/xnnpack/AlignedAllocator.h",
900 ] + MICROKERNEL_BENCHMARK_HDRS,
901 copts = ["-Wno-unused-function"],
902 deps = MICROKERNEL_BENCHMARK_DEPS,
903)
904
905xnnpack_benchmark(
906 name = "f32_im2col_gemm_bench",
907 srcs = [
908 "bench/f32-im2col-gemm.cc",
909 "bench/conv.h",
910 "src/xnnpack/AlignedAllocator.h",
911 ] + WEIGHTS_PACK_HDRS + MICROKERNEL_BENCHMARK_HDRS,
912 deps = MICROKERNEL_BENCHMARK_DEPS + [":im2col"],
913)
914
915########################### Benchmarks for operators ###########################
916
917xnnpack_benchmark(
918 name = "add_bench",
919 srcs = ["bench/add.cc"],
920 deps = OPERATOR_BENCHMARK_DEPS,
921)
922
923xnnpack_benchmark(
924 name = "average_pooling_bench",
925 srcs = ["bench/average-pooling.cc"],
926 deps = OPERATOR_BENCHMARK_DEPS,
927)
928
929xnnpack_benchmark(
930 name = "channel_shuffle_bench",
931 srcs = ["bench/channel-shuffle.cc"],
932 deps = OPERATOR_BENCHMARK_DEPS,
933)
934
935xnnpack_benchmark(
936 name = "convolution_bench",
937 srcs = ["bench/convolution.cc"],
938 copts = xnnpack_optional_tflite_copts() + xnnpack_optional_armcl_copts(),
939 deps = OPERATOR_BENCHMARK_DEPS + xnnpack_optional_tflite_deps() + xnnpack_optional_armcl_deps(),
940)
941
942xnnpack_benchmark(
943 name = "deconvolution_bench",
944 srcs = ["bench/deconvolution.cc"],
945 copts = xnnpack_optional_tflite_copts(),
946 deps = OPERATOR_BENCHMARK_DEPS + xnnpack_optional_tflite_deps(),
947)
948
949xnnpack_benchmark(
950 name = "global_average_pooling_bench",
951 srcs = ["bench/global-average-pooling.cc"],
952 deps = OPERATOR_BENCHMARK_DEPS,
953)
954
955xnnpack_benchmark(
956 name = "max_pooling_bench",
957 srcs = ["bench/max-pooling.cc"],
958 deps = OPERATOR_BENCHMARK_DEPS,
959)
960
961xnnpack_benchmark(
962 name = "sigmoid_bench",
963 srcs = ["bench/sigmoid.cc"],
964 deps = OPERATOR_BENCHMARK_DEPS,
965)
966
967xnnpack_benchmark(
968 name = "softargmax_bench",
969 srcs = ["bench/softargmax.cc"],
970 deps = OPERATOR_BENCHMARK_DEPS,
971)
972
Marat Dukhanc068bb62019-10-04 13:24:39 -0700973############################# End-to-end benchmarks ############################
974
975cc_library(
976 name = "mobilenet_v1",
977 srcs = ["models/mobilenet-v1.cc"],
978 hdrs = ["models/models.h"],
979 linkstatic = True,
980 deps = [
981 ":XNNPACK",
982 "@pthreadpool",
983 ],
984)
985
986cc_library(
987 name = "mobilenet_v2",
988 srcs = ["models/mobilenet-v2.cc"],
989 hdrs = ["models/models.h"],
990 linkstatic = True,
991 deps = [
992 ":XNNPACK",
993 "@pthreadpool",
994 ],
995)
996
997xnnpack_benchmark(
998 name = "end2end_bench",
999 srcs = ["bench/end2end.cc"],
1000 deps = [
1001 ":XNNPACK",
1002 ":mobilenet_v1",
1003 ":mobilenet_v2",
1004 "@pthreadpool",
1005 ],
1006)
1007
Marat Dukhan08c4a432019-10-03 09:29:21 -07001008######################### Unit tests for micro-kernels #########################
1009
1010xnnpack_unit_test(
1011 name = "f16_gemm_test",
1012 srcs = [
1013 "test/f16-gemm.cc",
1014 "test/gemm-microkernel-tester.h",
1015 "src/xnnpack/AlignedAllocator.h",
1016 ] + WEIGHTS_PACK_HDRS + MICROKERNEL_TEST_HDRS,
1017 deps = MICROKERNEL_TEST_DEPS,
1018)
1019
1020xnnpack_unit_test(
1021 name = "f32_argmaxpool_test",
1022 srcs = [
1023 "test/f32-argmaxpool.cc",
1024 "test/argmaxpool-microkernel-tester.h",
1025 "src/xnnpack/AlignedAllocator.h",
1026 ] + MICROKERNEL_TEST_HDRS,
1027 deps = MICROKERNEL_TEST_DEPS,
1028)
1029
1030xnnpack_unit_test(
1031 name = "f32_avgpool_test",
1032 srcs = [
1033 "test/f32-avgpool.cc",
1034 "test/avgpool-microkernel-tester.h",
1035 "src/xnnpack/AlignedAllocator.h",
1036 ] + MICROKERNEL_TEST_HDRS,
1037 deps = MICROKERNEL_TEST_DEPS,
1038)
1039
1040xnnpack_unit_test(
1041 name = "f32_clamp_test",
1042 srcs = [
1043 "test/f32-clamp.cc",
1044 "test/clamp-microkernel-tester.h",
1045 ] + MICROKERNEL_TEST_HDRS,
1046 deps = MICROKERNEL_TEST_DEPS,
1047)
1048
1049xnnpack_unit_test(
1050 name = "f32_igemm_test",
1051 srcs = [
1052 "test/f32-igemm.cc",
1053 "test/gemm-microkernel-tester.h",
1054 "src/xnnpack/AlignedAllocator.h",
1055 ] + WEIGHTS_PACK_HDRS + MICROKERNEL_TEST_HDRS,
1056 deps = MICROKERNEL_TEST_DEPS,
1057)
1058
1059xnnpack_unit_test(
1060 name = "f32_conv_hwc_test",
1061 srcs = [
1062 "test/f32-conv-hwc.cc",
1063 "test/conv-hwc-microkernel-tester.h",
1064 "src/xnnpack/AlignedAllocator.h",
1065 ] + WEIGHTS_PACK_HDRS + MICROKERNEL_TEST_HDRS,
1066 deps = MICROKERNEL_TEST_DEPS,
1067)
1068
1069xnnpack_unit_test(
1070 name = "f32_conv_hwc2spchw_test",
1071 srcs = [
1072 "test/f32-conv-hwc2spchw.cc",
1073 "test/conv-hwc2spchw-microkernel-tester.h",
1074 "src/xnnpack/AlignedAllocator.h",
1075 ] + WEIGHTS_PACK_HDRS + MICROKERNEL_TEST_HDRS,
1076 deps = MICROKERNEL_TEST_DEPS,
1077)
1078
1079xnnpack_unit_test(
1080 name = "f32_dwconv_test",
1081 srcs = [
1082 "test/f32-dwconv.cc",
1083 "test/dwconv-microkernel-tester.h",
1084 "src/xnnpack/AlignedAllocator.h",
1085 ] + WEIGHTS_PACK_HDRS + MICROKERNEL_TEST_HDRS,
1086 deps = MICROKERNEL_TEST_DEPS,
1087)
1088
1089xnnpack_unit_test(
1090 name = "f32_dwconv_spchw_test",
1091 srcs = [
1092 "test/f32-dwconv-spchw.cc",
1093 "test/dwconv-spchw-microkernel-tester.h",
1094 "src/xnnpack/AlignedAllocator.h",
1095 ] + WEIGHTS_PACK_HDRS + MICROKERNEL_TEST_HDRS,
1096 deps = MICROKERNEL_TEST_DEPS,
1097)
1098
1099xnnpack_unit_test(
1100 name = "f32_gavgpool_test",
1101 srcs = [
1102 "test/f32-gavgpool.cc",
1103 "test/gavgpool-microkernel-tester.h",
1104 "src/xnnpack/AlignedAllocator.h",
1105 ] + MICROKERNEL_TEST_HDRS,
1106 deps = MICROKERNEL_TEST_DEPS,
1107)
1108
1109xnnpack_unit_test(
1110 name = "f32_gavgpool_spchw_test",
1111 srcs = [
1112 "test/f32-gavgpool-spchw.cc",
1113 "test/gavgpool-spchw-microkernel-tester.h",
1114 "src/xnnpack/AlignedAllocator.h",
1115 ] + MICROKERNEL_TEST_HDRS,
1116 deps = MICROKERNEL_TEST_DEPS,
1117)
1118
1119xnnpack_unit_test(
1120 name = "f32_gemm_test",
1121 srcs = [
1122 "test/f32-gemm.cc",
1123 "test/gemm-microkernel-tester.h",
1124 "src/xnnpack/AlignedAllocator.h",
1125 ] + WEIGHTS_PACK_HDRS + MICROKERNEL_TEST_HDRS,
1126 deps = MICROKERNEL_TEST_DEPS,
1127)
1128
1129xnnpack_unit_test(
1130 name = "f32_gemminc_test",
1131 srcs = [
1132 "test/f32-gemminc.cc",
1133 "test/gemm-microkernel-tester.h",
1134 "src/xnnpack/AlignedAllocator.h",
1135 ] + WEIGHTS_PACK_HDRS + MICROKERNEL_TEST_HDRS,
1136 deps = MICROKERNEL_TEST_DEPS,
1137)
1138
1139xnnpack_unit_test(
1140 name = "f32_hswish_test",
1141 srcs = [
1142 "test/f32-hswish.cc",
1143 "test/hswish-microkernel-tester.h",
1144 ] + MICROKERNEL_TEST_HDRS,
1145 deps = MICROKERNEL_TEST_DEPS,
1146)
1147
1148xnnpack_unit_test(
1149 name = "f32_maxpool_test",
1150 srcs = [
1151 "test/f32-maxpool.cc",
1152 "test/maxpool-microkernel-tester.h",
1153 ] + MICROKERNEL_TEST_HDRS,
1154 deps = MICROKERNEL_TEST_DEPS,
1155)
1156
1157xnnpack_unit_test(
1158 name = "f32_pavgpool_test",
1159 srcs = [
1160 "test/f32-pavgpool.cc",
1161 "test/avgpool-microkernel-tester.h",
1162 "src/xnnpack/AlignedAllocator.h",
1163 ] + MICROKERNEL_TEST_HDRS,
1164 deps = MICROKERNEL_TEST_DEPS,
1165)
1166
1167xnnpack_unit_test(
1168 name = "f32_ppmm_test",
1169 srcs = [
1170 "test/f32-ppmm.cc",
1171 "test/gemm-microkernel-tester.h",
1172 "src/xnnpack/AlignedAllocator.h",
1173 ] + WEIGHTS_PACK_HDRS + MICROKERNEL_TEST_HDRS,
1174 deps = MICROKERNEL_TEST_DEPS,
1175)
1176
1177xnnpack_unit_test(
1178 name = "f32_prelu_test",
1179 srcs = [
1180 "test/f32-prelu.cc",
1181 "test/prelu-microkernel-tester.h",
1182 "src/xnnpack/AlignedAllocator.h",
1183 ] + MICROKERNEL_TEST_HDRS,
1184 deps = MICROKERNEL_TEST_DEPS,
1185)
1186
1187xnnpack_unit_test(
1188 name = "f32_rmax_test",
1189 srcs = [
1190 "test/f32-rmax.cc",
1191 "test/rmax-microkernel-tester.h",
1192 ] + MICROKERNEL_TEST_HDRS,
1193 deps = MICROKERNEL_TEST_DEPS,
1194)
1195
1196xnnpack_unit_test(
1197 name = "f32_spmm_test",
1198 srcs = [
1199 "test/f32-spmm.cc",
1200 "test/spmm-microkernel-tester.h",
1201 "src/xnnpack/AlignedAllocator.h",
1202 ] + MICROKERNEL_TEST_HDRS,
1203 deps = MICROKERNEL_TEST_DEPS,
1204)
1205
1206xnnpack_unit_test(
1207 name = "f32_vadd_test",
1208 srcs = [
1209 "test/f32-vadd.cc",
1210 "test/vadd-microkernel-tester.h",
1211 ] + MICROKERNEL_TEST_HDRS,
1212 deps = MICROKERNEL_TEST_DEPS,
1213)
1214
1215xnnpack_unit_test(
1216 name = "f32_vsub_test",
1217 srcs = [
1218 "test/f32-vsub.cc",
1219 "test/vsub-microkernel-tester.h",
1220 ] + MICROKERNEL_TEST_HDRS,
1221 deps = MICROKERNEL_TEST_DEPS,
1222)
1223
1224xnnpack_unit_test(
1225 name = "f32_vmul_test",
1226 srcs = [
1227 "test/f32-vmul.cc",
1228 "test/vmul-microkernel-tester.h",
1229 ] + MICROKERNEL_TEST_HDRS,
1230 deps = MICROKERNEL_TEST_DEPS,
1231)
1232
1233xnnpack_unit_test(
1234 name = "f32_vmulcaddc_test",
1235 srcs = [
1236 "test/f32-vmulcaddc.cc",
1237 "test/vmulcaddc-microkernel-tester.h",
1238 "src/xnnpack/AlignedAllocator.h",
1239 ] + WEIGHTS_PACK_HDRS + MICROKERNEL_TEST_HDRS,
1240 deps = MICROKERNEL_TEST_DEPS,
1241)
1242
1243xnnpack_unit_test(
1244 name = "q8_avgpool_test",
1245 srcs = [
1246 "test/q8-avgpool.cc",
1247 "test/avgpool-microkernel-tester.h",
1248 "src/xnnpack/AlignedAllocator.h",
1249 ] + MICROKERNEL_TEST_HDRS,
1250 deps = MICROKERNEL_TEST_DEPS,
1251)
1252
1253xnnpack_unit_test(
1254 name = "q8_igemm_test",
1255 srcs = [
1256 "test/q8-igemm.cc",
1257 "test/gemm-microkernel-tester.h",
1258 "src/xnnpack/AlignedAllocator.h",
1259 ] + WEIGHTS_PACK_HDRS + MICROKERNEL_TEST_HDRS,
1260 deps = MICROKERNEL_TEST_DEPS,
1261)
1262
1263xnnpack_unit_test(
1264 name = "q8_dwconv_test",
1265 srcs = [
1266 "test/q8-dwconv.cc",
1267 "test/dwconv-microkernel-tester.h",
1268 "src/xnnpack/AlignedAllocator.h",
1269 ] + WEIGHTS_PACK_HDRS + MICROKERNEL_TEST_HDRS,
1270 deps = MICROKERNEL_TEST_DEPS,
1271)
1272
1273xnnpack_unit_test(
1274 name = "q8_gavgpool_test",
1275 srcs = [
1276 "test/q8-gavgpool.cc",
1277 "test/gavgpool-microkernel-tester.h",
1278 "src/xnnpack/AlignedAllocator.h",
1279 ] + MICROKERNEL_TEST_HDRS,
1280 deps = MICROKERNEL_TEST_DEPS,
1281)
1282
1283xnnpack_unit_test(
1284 name = "q8_gemm_test",
1285 srcs = [
1286 "test/q8-gemm.cc",
1287 "test/gemm-microkernel-tester.h",
1288 "src/xnnpack/AlignedAllocator.h",
1289 ] + WEIGHTS_PACK_HDRS + MICROKERNEL_TEST_HDRS,
1290 deps = MICROKERNEL_TEST_DEPS,
1291)
1292
1293xnnpack_unit_test(
1294 name = "q8_vadd_test",
1295 srcs = [
1296 "test/q8-vadd.cc",
1297 "test/vadd-microkernel-tester.h",
1298 ] + MICROKERNEL_TEST_HDRS,
1299 deps = MICROKERNEL_TEST_DEPS,
1300)
1301
1302xnnpack_unit_test(
1303 name = "u8_clamp_test",
1304 srcs = [
1305 "test/u8-clamp.cc",
1306 "test/clamp-microkernel-tester.h",
1307 ] + MICROKERNEL_TEST_HDRS,
1308 deps = MICROKERNEL_TEST_DEPS,
1309)
1310
1311xnnpack_unit_test(
1312 name = "u8_lut32norm_test",
1313 srcs = [
1314 "test/u8-lut32norm.cc",
1315 "test/lut-norm-microkernel-tester.h",
1316 ] + MICROKERNEL_TEST_HDRS,
1317 deps = MICROKERNEL_TEST_DEPS,
1318)
1319
1320xnnpack_unit_test(
1321 name = "u8_maxpool_test",
1322 srcs = [
1323 "test/u8-maxpool.cc",
1324 "test/maxpool-microkernel-tester.h",
1325 ] + MICROKERNEL_TEST_HDRS,
1326 deps = MICROKERNEL_TEST_DEPS,
1327)
1328
1329xnnpack_unit_test(
1330 name = "u8_rmax_test",
1331 srcs = [
1332 "test/u8-rmax.cc",
1333 "test/rmax-microkernel-tester.h",
1334 ] + MICROKERNEL_TEST_HDRS,
1335 deps = MICROKERNEL_TEST_DEPS,
1336)
1337
1338xnnpack_unit_test(
1339 name = "x32_packx_test",
1340 srcs = [
1341 "test/x32-packx.cc",
1342 "test/pack-microkernel-tester.h",
1343 "src/xnnpack/AlignedAllocator.h",
1344 ] + MICROKERNEL_TEST_HDRS,
1345 deps = MICROKERNEL_TEST_DEPS,
1346)
1347
1348xnnpack_unit_test(
1349 name = "x32_pad_test",
1350 srcs = [
1351 "test/x32-pad.cc",
1352 "test/pad-microkernel-tester.h",
1353 ] + MICROKERNEL_TEST_HDRS,
1354 deps = MICROKERNEL_TEST_DEPS,
1355)
1356
1357xnnpack_unit_test(
1358 name = "x32_unpool_test",
1359 srcs = [
1360 "test/x32-unpool.cc",
1361 "test/unpool-microkernel-tester.h",
1362 ] + MICROKERNEL_TEST_HDRS,
1363 deps = MICROKERNEL_TEST_DEPS,
1364)
1365
1366xnnpack_unit_test(
1367 name = "x32_zip_test",
1368 srcs = [
1369 "test/x32-zip.cc",
1370 "test/zip-microkernel-tester.h",
1371 ] + MICROKERNEL_TEST_HDRS,
1372 deps = MICROKERNEL_TEST_DEPS,
1373)
1374
1375xnnpack_unit_test(
1376 name = "x8_lut_test",
1377 srcs = [
1378 "test/x8-lut.cc",
1379 "test/lut-microkernel-tester.h",
1380 ] + MICROKERNEL_TEST_HDRS,
1381 deps = MICROKERNEL_TEST_DEPS,
1382)
1383
1384xnnpack_unit_test(
1385 name = "x8_zip_test",
1386 srcs = [
1387 "test/x8-zip.cc",
1388 "test/zip-microkernel-tester.h",
1389 ] + MICROKERNEL_TEST_HDRS,
1390 deps = MICROKERNEL_TEST_DEPS,
1391)
1392
1393########################### Size test for the library ##########################
1394
1395xnnpack_binary(
1396 name = "size_test",
1397 srcs = ["test/size.c"],
Marat Dukhan8fe54e42019-10-10 14:12:59 -07001398 deps = [":xnnpack_operators_nhwc_f32"],
Marat Dukhan08c4a432019-10-03 09:29:21 -07001399)
1400
1401########################### Unit tests for operators ###########################
1402
1403xnnpack_unit_test(
1404 name = "add_test",
1405 srcs = [
1406 "test/add.cc",
1407 "test/add-operator-tester.h",
1408 ],
1409 deps = OPERATOR_TEST_DEPS,
1410)
1411
1412xnnpack_unit_test(
1413 name = "argmax_pooling_test",
1414 srcs = [
1415 "test/argmax-pooling.cc",
1416 "test/argmax-pooling-operator-tester.h",
1417 ] + OPERATOR_TEST_PARAMS_HDRS,
1418 deps = OPERATOR_TEST_DEPS,
1419)
1420
1421xnnpack_unit_test(
1422 name = "average_pooling_test",
1423 srcs = [
1424 "test/average-pooling.cc",
1425 "test/average-pooling-operator-tester.h",
1426 ] + OPERATOR_TEST_PARAMS_HDRS,
1427 deps = OPERATOR_TEST_DEPS,
1428)
1429
1430xnnpack_unit_test(
1431 name = "channel_pad_test",
1432 srcs = [
1433 "test/channel-pad.cc",
1434 "test/channel-pad-operator-tester.h",
1435 ] + OPERATOR_TEST_PARAMS_HDRS,
1436 deps = OPERATOR_TEST_DEPS,
1437)
1438
1439xnnpack_unit_test(
1440 name = "channel_shuffle_test",
1441 srcs = [
1442 "test/channel-shuffle.cc",
1443 "test/channel-shuffle-operator-tester.h",
1444 ],
1445 deps = OPERATOR_TEST_DEPS,
1446)
1447
1448xnnpack_unit_test(
1449 name = "clamp_test",
1450 srcs = [
1451 "test/clamp.cc",
1452 "test/clamp-operator-tester.h",
1453 ],
1454 deps = OPERATOR_TEST_DEPS,
1455)
1456
1457xnnpack_unit_test(
1458 name = "convolution_test",
1459 srcs = [
1460 "test/convolution.cc",
1461 "test/convolution-operator-tester.h",
1462 ],
1463 deps = OPERATOR_TEST_DEPS,
1464)
1465
1466xnnpack_unit_test(
1467 name = "convolution_spnchw_test",
1468 srcs = [
1469 "test/convolution-spnchw.cc",
1470 "test/convolution-spnchw-operator-tester.h",
1471 ],
1472 deps = OPERATOR_TEST_DEPS,
1473)
1474
1475xnnpack_unit_test(
1476 name = "deconvolution_test",
1477 srcs = [
1478 "test/deconvolution.cc",
1479 "test/deconvolution-operator-tester.h",
1480 ] + OPERATOR_TEST_PARAMS_HDRS,
1481 deps = OPERATOR_TEST_DEPS,
1482)
1483
1484xnnpack_unit_test(
1485 name = "fully_connected_test",
1486 srcs = [
1487 "test/fully-connected.cc",
1488 "test/fully-connected-operator-tester.h",
1489 ],
1490 deps = OPERATOR_TEST_DEPS,
1491)
1492
1493xnnpack_unit_test(
1494 name = "global_average_pooling_test",
1495 srcs = [
1496 "test/global-average-pooling.cc",
1497 "test/global-average-pooling-operator-tester.h",
1498 ] + OPERATOR_TEST_PARAMS_HDRS,
1499 deps = OPERATOR_TEST_DEPS,
1500)
1501
1502xnnpack_unit_test(
1503 name = "global_average_pooling_spnchw_test",
1504 srcs = [
1505 "test/global-average-pooling-spnchw.cc",
1506 "test/global-average-pooling-spnchw-operator-tester.h",
1507 ],
1508 deps = OPERATOR_TEST_DEPS,
1509)
1510
1511xnnpack_unit_test(
1512 name = "hardswish_test",
1513 srcs = [
1514 "test/hardswish.cc",
1515 "test/hardswish-operator-tester.h",
1516 ],
1517 deps = OPERATOR_TEST_DEPS,
1518)
1519
1520xnnpack_unit_test(
1521 name = "leaky_relu_test",
1522 srcs = [
1523 "test/leaky-relu.cc",
1524 "test/leaky-relu-operator-tester.h",
1525 ],
1526 deps = OPERATOR_TEST_DEPS,
1527)
1528
1529xnnpack_unit_test(
1530 name = "max_pooling_test",
1531 srcs = [
1532 "test/max-pooling.cc",
1533 "test/max-pooling-operator-tester.h",
1534 ] + OPERATOR_TEST_PARAMS_HDRS,
1535 deps = OPERATOR_TEST_DEPS,
1536)
1537
1538xnnpack_unit_test(
1539 name = "prelu_test",
1540 srcs = [
1541 "test/prelu.cc",
1542 "test/prelu-operator-tester.h",
1543 ] + OPERATOR_TEST_PARAMS_HDRS,
1544 deps = OPERATOR_TEST_DEPS,
1545)
1546
1547xnnpack_unit_test(
1548 name = "sigmoid_test",
1549 srcs = [
1550 "test/sigmoid.cc",
1551 "test/sigmoid-operator-tester.h",
1552 ],
1553 deps = OPERATOR_TEST_DEPS,
1554)
1555
1556xnnpack_unit_test(
1557 name = "softargmax_test",
1558 srcs = [
1559 "test/softargmax.cc",
1560 "test/softargmax-operator-tester.h",
1561 ],
1562 deps = OPERATOR_TEST_DEPS,
1563)
1564
1565xnnpack_unit_test(
1566 name = "unpooling_test",
1567 srcs = [
1568 "test/unpooling.cc",
1569 "test/unpooling-operator-tester.h",
1570 ],
1571 deps = OPERATOR_TEST_DEPS,
1572)
1573
1574############################# Build configurations #############################
1575
1576config_setting(
1577 name = "linux_k8",
1578 values = {
1579 "cpu": "k8",
1580 },
1581)
1582
1583config_setting(
Marat Dukhan4e45e662019-10-03 15:40:24 -07001584 name = "linux_aarch64",
1585 values = {
1586 "cpu": "aarch64",
1587 },
1588)
1589
1590config_setting(
Marat Dukhan08c4a432019-10-03 09:29:21 -07001591 name = "android",
1592 values = {"crosstool_top": "//external:android/crosstool"},
1593)
1594
1595config_setting(
1596 name = "android_armv7",
1597 values = {
1598 "crosstool_top": "//external:android/crosstool",
1599 "cpu": "armeabi-v7a",
1600 },
1601)
1602
1603config_setting(
1604 name = "android_arm64",
1605 values = {
1606 "crosstool_top": "//external:android/crosstool",
1607 "cpu": "arm64-v8a",
1608 },
1609)
1610
1611config_setting(
1612 name = "android_x86",
1613 values = {
1614 "crosstool_top": "//external:android/crosstool",
1615 "cpu": "x86",
1616 },
1617)
1618
1619config_setting(
1620 name = "android_x86_64",
1621 values = {
1622 "crosstool_top": "//external:android/crosstool",
1623 "cpu": "x86_64",
1624 },
1625)
1626
1627config_setting(
Marat Dukhan885ca242019-10-07 09:17:32 -07001628 name = "macos_x86_64",
1629 values = {
1630 "apple_platform_type": "macos",
1631 "cpu": "darwin",
1632 },
1633)
1634
1635config_setting(
Marat Dukhan08c4a432019-10-03 09:29:21 -07001636 name = "emscripten",
Marat Dukhan1a729ec2019-10-07 09:31:44 -07001637 values = {"crosstool_top": "//toolchain:emscripten"},
Marat Dukhan08c4a432019-10-03 09:29:21 -07001638)
1639
1640config_setting(
1641 name = "emscripten_wasm",
1642 values = {
Marat Dukhan1a729ec2019-10-07 09:31:44 -07001643 "crosstool_top": "//toolchain:emscripten",
Marat Dukhan08c4a432019-10-03 09:29:21 -07001644 "cpu": "wasm",
1645 },
1646)
1647
1648config_setting(
1649 name = "emscripten_wasmsimd",
1650 values = {
Marat Dukhan1a729ec2019-10-07 09:31:44 -07001651 "crosstool_top": "//toolchain:emscripten",
Marat Dukhan08c4a432019-10-03 09:29:21 -07001652 "cpu": "wasm",
1653 "features": "wasmsimd",
1654 },
1655)
1656
1657config_setting(
1658 name = "emscripten_asmjs",
1659 values = {
Marat Dukhan1a729ec2019-10-07 09:31:44 -07001660 "crosstool_top": "//toolchain:emscripten",
Marat Dukhan08c4a432019-10-03 09:29:21 -07001661 "cpu": "asmjs",
1662 },
1663)
1664
Marat Dukhan174706e2019-10-09 16:33:53 -07001665# Builds with -c dbg
Marat Dukhan08c4a432019-10-03 09:29:21 -07001666config_setting(
1667 name = "debug_build",
1668 values = {
1669 "compilation_mode": "dbg",
1670 },
Marat Dukhan08c4a432019-10-03 09:29:21 -07001671)
1672
Marat Dukhan174706e2019-10-09 16:33:53 -07001673# Builds with -c opt
Marat Dukhan08c4a432019-10-03 09:29:21 -07001674config_setting(
1675 name = "optimized_build",
1676 values = {
1677 "compilation_mode": "opt",
1678 },
Marat Dukhan08c4a432019-10-03 09:29:21 -07001679)
1680
1681# Enables usage of assembly kernels.
1682config_setting(
1683 name = "xnn_enable_assembly_explicit_true",
1684 define_values = {"xnn_enable_assembly": "true"},
1685)
1686
1687# Disables usage of assembly kernels.
1688config_setting(
1689 name = "xnn_enable_assembly_explicit_false",
1690 define_values = {"xnn_enable_assembly": "false"},
1691)