blob: e5c927753048aac316229d50261243f2871b7a59 [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 = [
263 "src/f32-igemm/4x12-neonfma-ld64.c",
264 "src/f32-igemm/4x2-neonfma-ld64.c",
265 "src/f32-igemm/4x4-neonfma-ld64.c",
266 "src/f32-igemm/4x8-neonfma-ld128.c",
267 "src/f32-igemm/4x8-neonfma-ld64.c",
268 "src/f32-igemm/6x8-neonfma-ld64.c",
269 "src/f32-dwconv/up4x9-neonfma.c",
270 "src/f32-dwconv/up8x9-neonfma.c",
271 "src/f32-gemm/1x8-neonfma-ld64.c",
272 "src/f32-gemm/4x12-neonfma-ld64.c",
273 "src/f32-gemm/4x2-neonfma-ld64.c",
274 "src/f32-gemm/4x8-neonfma-ld128.c",
275 "src/f32-gemm/4x8-neonfma-ld64.c",
276 "src/f32-gemm/5x8-neonfma-ld64.c",
277 "src/f32-gemm/6x8-neonfma-ld64.c",
278 "src/f32-gemminc/1x8-neonfma-ld64.c",
279 "src/f32-gemminc/4x12-neonfma-ld64.c",
280 "src/f32-gemminc/4x8-neonfma-ld128.c",
281 "src/f32-gemminc/4x8-neonfma-ld64.c",
282 "src/f32-gemminc/5x8-neonfma-ld64.c",
283 "src/f32-gemminc/6x8-neonfma-ld64.c",
284 "src/f32-hswish/neonfma.c",
285 "src/f32-ppmm/4x8-neonfma.c",
286 "src/f32-ppmm/8x8-neonfma.c",
287 "src/f32-vmulcaddc/c4-neonfma-x2.c",
288]
289
290AARCH64_NEONFMA_UKERNELS = [
291 "src/f32-conv-hwc/3x3s2p1c3x4-neonfma-2x2.c",
292 "src/f32-conv-hwc/3x3s2p1c3x8-neonfma-2x2.c",
293 "src/f32-conv-hwc2spchw/3x3s2p1c3x4-neonfma-2x2.c",
294 "src/f32-dwconv-spchw/3x3p1-neonfma.c",
295 "src/f32-dwconv-spchw/5x5p2-neonfma.c",
296 "src/f32-dwconv-spchw/3x3s2p1-neonfma.c",
297 "src/f32-dwconv-spchw/5x5s2p2-neonfma.c",
298 "src/f32-spmm/12x1-neonfma.c",
299 "src/f32-spmm/12x2-neonfma.c",
300 "src/f32-spmm/12x4-neonfma.c",
301 "src/f32-spmm/16x1-neonfma-pipelined.c",
302 "src/f32-spmm/16x1-neonfma-unroll2.c",
303 "src/f32-spmm/16x1-neonfma.c",
304 "src/f32-spmm/16x2-neonfma.c",
305 "src/f32-spmm/16x4-neonfma.c",
306 "src/f32-spmm/4x1-neonfma-pipelined.c",
307 "src/f32-spmm/4x1-neonfma-unroll2.c",
308 "src/f32-spmm/4x1-neonfma.c",
309 "src/f32-spmm/4x2-neonfma.c",
310 "src/f32-spmm/4x4-neonfma.c",
311 "src/f32-spmm/8x1-neonfma-pipelined.c",
312 "src/f32-spmm/8x1-neonfma-unroll2.c",
313 "src/f32-spmm/8x1-neonfma.c",
314 "src/f32-spmm/8x2-neonfma.c",
315 "src/f32-spmm/8x4-neonfma.c",
316]
317
318AARCH64_NEONFP16ARITH_UKERNELS = [
319 "src/f16-gemm/4x8-neonfp16arith-ld64.c",
320 "src/f16-gemm/6x8-neonfp16arith-ld64.c",
321 "src/f16-gemm/8x8-neonfp16arith-ld64.c",
322]
323
324SSE_UKERNELS = [
325 "src/f32-avgpool/mp9p8q-sse.c",
326 "src/f32-avgpool/up9-sse.c",
327 "src/f32-clamp/sse.c",
328 "src/f32-igemm/1x8-sse-dup.c",
329 "src/f32-igemm/1x8-sse-load1.c",
330 "src/f32-igemm/1x8s4-sse.c",
331 "src/f32-igemm/4x2c4-sse.c",
332 "src/f32-igemm/4x8-sse-dup.c",
333 "src/f32-igemm/4x8-sse-load1.c",
334 "src/f32-igemm/4x8s4-sse.c",
335 "src/f32-dwconv/up4x25-sse.c",
336 "src/f32-dwconv/up4x4-sse.c",
337 "src/f32-dwconv/up4x9-sse.c",
338 "src/f32-gavgpool-spchw/sse-x4.c",
339 "src/f32-gavgpool/mp7p7q-sse.c",
340 "src/f32-gavgpool/up7-sse.c",
341 "src/f32-gemm/1x8-sse-dup.c",
342 "src/f32-gemm/1x8-sse-load1.c",
343 "src/f32-gemm/1x8s4-sse.c",
344 "src/f32-gemm/4x8-sse-dup.c",
345 "src/f32-gemm/4x8-sse-load1.c",
346 "src/f32-gemm/4x8s4-sse.c",
347 "src/f32-gemminc/1x8-sse-dup.c",
348 "src/f32-gemminc/1x8-sse-load1.c",
349 "src/f32-gemminc/1x8s4-sse.c",
350 "src/f32-gemminc/4x8-sse-dup.c",
351 "src/f32-gemminc/4x8-sse-load1.c",
352 "src/f32-gemminc/4x8s4-sse.c",
353 "src/f32-hswish/sse.c",
354 "src/f32-maxpool/9p8q-sse.c",
355 "src/f32-pavgpool/mp9p8q-sse.c",
356 "src/f32-pavgpool/up9-sse.c",
357 "src/f32-dwconv-spchw/3x3p1-sse.c",
358 "src/f32-dwconv-spchw/3x3s2p1-sse.c",
359 "src/f32-ppmm/4x8-sse.c",
360 "src/f32-prelu/x4-sse.c",
361 "src/f32-rmax/sse.c",
362 "src/f32-spmm/4x1-sse.c",
363 "src/f32-spmm/8x1-sse.c",
364 "src/f32-vadd/sse.c",
365 "src/f32-vmul/sse.c",
366 "src/f32-vmulcaddc/c4-sse-x2.c",
367 "src/f32-vsub/sse.c",
368 "src/x32-packx/x4-sse.c",
369]
370
371SSE2_UKERNELS = [
372 "src/f32-argmaxpool/mp9p8q-sse2.c",
373 "src/f32-argmaxpool/up4-sse2.c",
374 "src/f32-argmaxpool/up9-sse2.c",
375 "src/q8-avgpool/mp9p8q-sse2.c",
376 "src/q8-avgpool/up9-sse2.c",
377 "src/q8-igemm/4x4c2-sse2.c",
378 "src/q8-dwconv/up8x9-sse2.c",
379 "src/q8-gavgpool/mp7p7q-sse2.c",
380 "src/q8-gavgpool/up7-sse2.c",
381 "src/q8-gemm/2x4c8-sse2.c",
382 "src/q8-gemm/4x4c2-sse2.c",
383 "src/q8-vadd/sse2.c",
384 "src/u8-clamp/sse2.c",
385 "src/u8-maxpool/9p8q-sse2.c",
386 "src/u8-rmax/sse2.c",
387 "src/x32-pad/x2-sse2.c",
388 "src/x32-zip/x2-sse2.c",
389 "src/x32-zip/x3-sse2.c",
390 "src/x32-zip/x4-sse2.c",
391 "src/x32-zip/xm-sse2.c",
392 "src/x8-zip/x2-sse2.c",
393 "src/x8-zip/x3-sse2.c",
394 "src/x8-zip/x4-sse2.c",
395 "src/x8-zip/xm-sse2.c",
396]
397
398AVX_UKERNELS = [
399 "src/f32-rmax/avx.c",
400]
401
402AVX512F_UKERNELS = [
403 "src/f32-rmax/avx512f.c",
404]
405
406AARCH32_ASM_UKERNELS = [
407 "src/q8-dwconv/up8x9-aarch32-neon.S",
408]
409
410AARCH64_ASM_UKERNELS = [
411 "src/f32-dwconv/up4x9-aarch64-neonfma-cortex-a55.S",
412 "src/f32-dwconv/up4x9-aarch64-neonfma.S",
413 "src/f32-gemm/1x12-aarch64-neonfma-cortex-a53.S",
414 "src/f32-gemm/1x8-aarch64-neonfma-cortex-a57.S",
415 "src/f32-gemm/1x8-aarch64-neonfma-cortex-a75.S",
416 "src/f32-gemm/4x12-aarch64-neonfma-cortex-a53.S",
417 "src/f32-gemm/4x8-aarch64-neonfma-cortex-a57.S",
418 "src/f32-gemm/4x8-aarch64-neonfma-cortex-a75.S",
419 "src/f32-gemm/4x8-aarch64-neonfma-ld128.S",
420 "src/f32-gemm/4x8-aarch64-neonfma-ld64.S",
421 "src/f32-gemm/5x8-aarch64-neonfma-cortex-a75.S",
422 "src/f32-gemm/6x8-aarch64-neonfma-cortex-a57.S",
423 "src/f32-gemm/6x8-aarch64-neonfma-cortex-a73.S",
424 "src/f32-gemm/6x8-aarch64-neonfma-cortex-a75.S",
425 "src/f32-gemm/6x8-aarch64-neonfma-ld128.S",
426 "src/f32-gemm/6x8-aarch64-neonfma-ld64.S",
427 "src/f32-gemminc/1x12-aarch64-neonfma-cortex-a53.S",
428 "src/f32-gemminc/1x8-aarch64-neonfma-cortex-a57.S",
429 "src/f32-gemminc/1x8-aarch64-neonfma-cortex-a75.S",
430 "src/f32-gemminc/4x12-aarch64-neonfma-cortex-a53.S",
431 "src/f32-gemminc/4x8-aarch64-neonfma-cortex-a57.S",
432 "src/f32-gemminc/4x8-aarch64-neonfma-cortex-a75.S",
433 "src/f32-gemminc/4x8-aarch64-neonfma-ld128.S",
434 "src/f32-gemminc/4x8-aarch64-neonfma-ld64.S",
435 "src/f32-gemminc/5x8-aarch64-neonfma-cortex-a75.S",
436 "src/f32-gemminc/6x8-aarch64-neonfma-cortex-a57.S",
437 "src/f32-gemminc/6x8-aarch64-neonfma-cortex-a73.S",
438 "src/f32-gemminc/6x8-aarch64-neonfma-cortex-a75.S",
439 "src/f32-gemminc/6x8-aarch64-neonfma-ld128.S",
440 "src/f32-gemminc/6x8-aarch64-neonfma-ld64.S",
441 "src/f32-igemm/1x12-aarch64-neonfma-cortex-a53.S",
442 "src/f32-igemm/1x8-aarch64-neonfma-cortex-a57.S",
443 "src/f32-igemm/1x8-aarch64-neonfma-cortex-a75.S",
444 "src/f32-igemm/4x12-aarch64-neonfma-cortex-a53.S",
445 "src/f32-igemm/4x8-aarch64-neonfma-cortex-a75.S",
446 "src/f32-igemm/5x8-aarch64-neonfma-cortex-a75.S",
447 "src/f32-igemm/6x8-aarch64-neonfma-cortex-a57.S",
448 "src/f32-igemm/6x8-aarch64-neonfma-cortex-a73.S",
449 "src/f32-igemm/6x8-aarch64-neonfma-cortex-a75.S",
450]
451
452INTERNAL_MICROKERNEL_HDRS = [
453 "src/xnnpack/argmaxpool.h",
454 "src/xnnpack/avgpool.h",
455 "src/xnnpack/clamp.h",
456 "src/xnnpack/common.h",
457 "src/xnnpack/conv.h",
458 "src/xnnpack/dwconv.h",
459 "src/xnnpack/gavgpool.h",
460 "src/xnnpack/gemm.h",
461 "src/xnnpack/hswish.h",
462 "src/xnnpack/igemm.h",
463 "src/xnnpack/lut.h",
464 "src/xnnpack/math.h",
465 "src/xnnpack/maxpool.h",
466 "src/xnnpack/packx.h",
467 "src/xnnpack/pad.h",
468 "src/xnnpack/params.h",
469 "src/xnnpack/pavgpool.h",
470 "src/xnnpack/ppmm.h",
471 "src/xnnpack/prelu.h",
472 "src/xnnpack/rmax.h",
473 "src/xnnpack/scalar-utils.h",
474 "src/xnnpack/spmm.h",
475 "src/xnnpack/unpool.h",
476 "src/xnnpack/vadd.h",
477 "src/xnnpack/vmul.h",
478 "src/xnnpack/vmulcaddc.h",
479 "src/xnnpack/vsub.h",
480 "src/xnnpack/zip.h",
481]
482
483INTERNAL_HDRS = INTERNAL_MICROKERNEL_HDRS + [
484 "include/xnnpack.h",
485 "src/xnnpack/allocator.h",
486 "src/xnnpack/compute.h",
487 "src/xnnpack/im2col.h",
488 "src/xnnpack/indirection.h",
Marat Dukhan08c4a432019-10-03 09:29:21 -0700489 "src/xnnpack/operator.h",
490 "src/xnnpack/pack.h",
491 "src/xnnpack/requantization.h",
492 "src/xnnpack/requantization-stubs.h",
493]
494
495MICROKERNEL_BENCHMARK_HDRS = INTERNAL_MICROKERNEL_HDRS + [
496 "src/xnnpack/requantization.h",
497 "include/xnnpack.h",
498]
499
500MICROKERNEL_TEST_HDRS = INTERNAL_MICROKERNEL_HDRS + [
501 "src/xnnpack/isa-checks.h",
502 "src/xnnpack/requantization.h",
503 "include/xnnpack.h",
504]
505
506OPERATOR_TEST_PARAMS_HDRS = [
507 "src/xnnpack/params.h",
508 "src/xnnpack/common.h",
509]
510
511WEIGHTS_PACK_HDRS = [
512 "src/xnnpack/pack.h",
513 "src/xnnpack/operator.h",
514 "src/xnnpack/compute.h",
515]
516
Marat Dukhanc8e00eb2019-10-04 14:55:26 -0700517LOGGING_COPTS = select({
518 # No logging in optimized mode
519 ":optimized_build": ["-DXNN_LOG_LEVEL=0"],
520 # Full logging in debug mode
521 ":debug_build": ["-DXNN_LOG_LEVEL=5"],
522 # Error-only logging in default (fastbuild) mode
523 "//conditions:default": ["-DXNN_LOG_LEVEL=2"],
524})
525
526LOGGING_HDRS = [
527 "src/xnnpack/log.h",
528]
529
Marat Dukhan08c4a432019-10-03 09:29:21 -0700530xnnpack_cc_library(
531 name = "scalar_ukernels",
532 srcs = SCALAR_UKERNELS,
533 hdrs = INTERNAL_HDRS,
534 aarch32_copts = ["-marm"],
535 copts = xnnpack_std_copts(),
536 deps = [
537 "@FP16",
538 "@FXdiv",
539 ],
540)
541
542xnnpack_cc_library(
543 name = "psimd_ukernels",
544 srcs = PSIMD_UKERNELS,
545 hdrs = INTERNAL_HDRS,
546 aarch32_copts = [
547 "-marm",
548 "-mfpu=neon",
549 ],
550 copts = xnnpack_std_copts(),
551 optimized_copts = [
552 "-O3",
553 "-ffast-math",
554 ],
555 deps = [
556 "@FP16",
557 "@psimd",
558 ],
559)
560
561xnnpack_cc_library(
562 name = "neon_ukernels",
563 hdrs = INTERNAL_HDRS,
564 aarch32_copts = [
565 "-marm",
566 "-mfpu=neon",
567 ],
568 aarch32_srcs = NEON_UKERNELS,
569 aarch64_srcs = NEON_UKERNELS,
570 copts = xnnpack_std_copts(),
571 deps = ["@FP16"],
572)
573
574xnnpack_cc_library(
575 name = "neonfma_ukernels",
576 hdrs = INTERNAL_HDRS,
577 aarch32_copts = [
578 "-marm",
579 "-mfpu=neon-vfpv4",
580 ],
581 aarch32_srcs = NEONFMA_UKERNELS,
582 aarch64_srcs = NEONFMA_UKERNELS + AARCH64_NEONFMA_UKERNELS,
583 copts = xnnpack_std_copts(),
584 deps = ["@FP16"],
585)
586
587xnnpack_cc_library(
588 name = "neonfp16arith_ukernels",
589 hdrs = INTERNAL_HDRS,
590 aarch64_copts = ["-march=armv8.2-a+fp16"],
591 aarch64_srcs = AARCH64_NEONFP16ARITH_UKERNELS,
592 copts = xnnpack_std_copts(),
593 deps = ["@FP16"],
594)
595
596xnnpack_cc_library(
597 name = "sse2_ukernels",
598 hdrs = INTERNAL_HDRS,
599 copts = xnnpack_std_copts(),
600 x86_copts = ["-msse2"],
601 x86_srcs = SSE_UKERNELS + SSE2_UKERNELS,
602 deps = ["@FP16"],
603)
604
605xnnpack_cc_library(
606 name = "avx_ukernels",
607 hdrs = INTERNAL_HDRS,
608 copts = xnnpack_std_copts(),
609 x86_copts = ["-mavx"],
610 x86_srcs = AVX_UKERNELS,
611 deps = ["@FP16"],
612)
613
614xnnpack_cc_library(
615 name = "avx512f_ukernels",
616 hdrs = INTERNAL_HDRS,
617 copts = xnnpack_std_copts(),
618 x86_copts = ["-mavx512f"],
619 x86_srcs = AVX512F_UKERNELS,
620 deps = ["@FP16"],
621)
622
623xnnpack_cc_library(
624 name = "asm_ukernels",
625 hdrs = ["src/xnnpack/assembly.h"],
626 aarch32_srcs = AARCH32_ASM_UKERNELS,
627 aarch64_srcs = AARCH64_ASM_UKERNELS,
628)
629
630xnnpack_aggregate_library(
631 name = "ukernels",
632 aarch32_deps = [
633 ":psimd_ukernels",
634 ":neon_ukernels",
635 ":neonfma_ukernels",
636 ":asm_ukernels",
637 ],
638 aarch64_deps = [
639 ":psimd_ukernels",
640 ":neon_ukernels",
641 ":neonfma_ukernels",
642 ":neonfp16arith_ukernels",
643 ":asm_ukernels",
644 ],
645 generic_deps = [":scalar_ukernels"],
646 wasmsimd_deps = [
647 ":psimd_ukernels",
648 ],
649 x86_deps = [
650 ":psimd_ukernels",
651 ":sse2_ukernels",
652 ":avx_ukernels",
653 ":avx512f_ukernels",
654 ],
655)
656
657xnnpack_cc_library(
658 name = "im2col",
659 srcs = ["src/im2col.c"],
660 hdrs = [
661 "src/xnnpack/common.h",
662 "src/xnnpack/im2col.h",
663 ],
664 copts = xnnpack_std_copts(),
665)
666
667xnnpack_cc_library(
668 name = "indirection",
669 srcs = ["src/indirection.c"],
670 hdrs = INTERNAL_HDRS,
671 copts = xnnpack_std_copts(),
672 deps = [
673 "@FP16",
674 "@FXdiv",
675 "@pthreadpool",
676 ],
677)
678
679xnnpack_cc_library(
680 name = "operator_run",
681 srcs = ["src/operator-run.c"],
Marat Dukhanc8e00eb2019-10-04 14:55:26 -0700682 hdrs = INTERNAL_HDRS + LOGGING_HDRS,
683 copts = xnnpack_std_copts() + LOGGING_COPTS + [
Marat Dukhan08c4a432019-10-03 09:29:21 -0700684 # Wrappers for multi-pass microkernels use VLAs for temporary buffers.
685 "-Wno-vla",
686 ],
687 deps = [
688 "@FP16",
689 "@FXdiv",
690 "@clog",
691 "@pthreadpool",
692 ],
693)
694
695cc_library(
696 name = "enable_assembly",
697 defines = select({
698 ":xnn_enable_assembly_explicit_true": ["XNN_ENABLE_ASSEMBLY=1"],
699 ":xnn_enable_assembly_explicit_false": ["XNN_ENABLE_ASSEMBLY=0"],
700 "//conditions:default": [],
701 }),
702)
703
704cc_library(
705 name = "operators",
706 srcs = OPERATOR_SRCS + [
707 "src/init.c",
708 "src/operator-delete.c",
709 ] + select({
710 ":emscripten_wasm": ["src/wasm-stubs.c"],
711 "//conditions:default": [],
712 }),
Marat Dukhanc8e00eb2019-10-04 14:55:26 -0700713 copts = xnnpack_std_copts() + LOGGING_COPTS + [
Marat Dukhan08c4a432019-10-03 09:29:21 -0700714 "-Isrc",
715 "-Iinclude",
716 ] + select({
717 ":debug_build": [],
718 "//conditions:default": xnnpack_min_size_copts(),
719 }),
720 linkstatic = True,
Marat Dukhanc8e00eb2019-10-04 14:55:26 -0700721 textual_hdrs = INTERNAL_HDRS + LOGGING_HDRS,
Marat Dukhan08c4a432019-10-03 09:29:21 -0700722 deps = [
723 ":enable_assembly",
724 ":indirection",
725 ":ukernels",
726 "@FP16",
727 "@FXdiv",
728 "@clog",
729 "@cpuinfo",
730 "@pthreadpool",
731 ],
732)
733
734cc_library(
735 name = "XNNPACK",
736 hdrs = ["include/xnnpack.h"],
737 includes = ["include"],
738 linkstatic = True,
Marat Dukhan08c4a432019-10-03 09:29:21 -0700739 visibility = xnnpack_visibility(),
740 deps = [
741 ":operator_run",
742 ":operators",
743 "@pthreadpool",
744 ],
745)
746
747cc_library(
748 name = "bench_utils",
749 srcs = ["bench/utils.cc"],
750 hdrs = ["bench/utils.h"],
751 copts = ["-Wno-unused-result"],
752 linkstatic = True,
753 deps = ["@cpuinfo"],
754)
755
756######################### Unit tests for micro-kernels #########################
757
758xnnpack_benchmark(
759 name = "q8_gemm_bench",
760 srcs = [
761 "bench/gemm.h",
762 "bench/q8-gemm.cc",
763 "src/xnnpack/AlignedAllocator.h",
764 ] + WEIGHTS_PACK_HDRS + MICROKERNEL_BENCHMARK_HDRS,
765 copts = ["-Wno-unused-function"] + xnnpack_optional_ruy_copts() + xnnpack_optional_gemmlowp_copts(),
766 deps = MICROKERNEL_BENCHMARK_DEPS + xnnpack_optional_ruy_deps() + xnnpack_optional_gemmlowp_deps(),
767)
768
769xnnpack_benchmark(
770 name = "f16_gemm_bench",
771 srcs = [
772 "bench/f16-gemm.cc",
773 "bench/gemm.h",
774 "src/xnnpack/AlignedAllocator.h",
775 ] + WEIGHTS_PACK_HDRS + MICROKERNEL_BENCHMARK_HDRS,
776 copts = ["-Wno-unused-function"],
777 deps = MICROKERNEL_BENCHMARK_DEPS,
778)
779
780xnnpack_benchmark(
781 name = "f32_igemm_bench",
782 srcs = [
783 "bench/f32-igemm.cc",
784 "bench/conv.h",
785 "src/xnnpack/AlignedAllocator.h",
786 ] + MICROKERNEL_BENCHMARK_HDRS,
787 deps = MICROKERNEL_BENCHMARK_DEPS + [":indirection"],
788)
789
790xnnpack_benchmark(
791 name = "f32_conv_hwc_bench",
792 srcs = [
793 "bench/f32-conv-hwc.cc",
794 "bench/dconv.h",
795 "src/xnnpack/AlignedAllocator.h",
796 ] + WEIGHTS_PACK_HDRS + MICROKERNEL_BENCHMARK_HDRS,
797 copts = ["-Wno-unused-function"],
798 deps = MICROKERNEL_BENCHMARK_DEPS,
799)
800
801xnnpack_benchmark(
802 name = "f32_dwconv_bench",
803 srcs = [
804 "bench/f32-dwconv.cc",
805 "bench/dwconv.h",
806 "src/xnnpack/AlignedAllocator.h",
807 ] + MICROKERNEL_BENCHMARK_HDRS,
808 deps = MICROKERNEL_BENCHMARK_DEPS + [":indirection"],
809)
810
811xnnpack_benchmark(
812 name = "f32_dwconv_spchw_bench",
813 srcs = [
814 "bench/f32-dwconv-spchw.cc",
815 "bench/dwconv.h",
816 "src/xnnpack/AlignedAllocator.h",
817 ] + WEIGHTS_PACK_HDRS + MICROKERNEL_BENCHMARK_HDRS,
818 deps = MICROKERNEL_BENCHMARK_DEPS + [":indirection"],
819)
820
821xnnpack_benchmark(
822 name = "f32_gemm_bench",
823 srcs = [
824 "bench/f32-gemm.cc",
825 "bench/gemm.h",
826 "src/xnnpack/AlignedAllocator.h",
827 ] + WEIGHTS_PACK_HDRS + MICROKERNEL_BENCHMARK_HDRS,
828 copts = ["-Wno-unused-function"] + xnnpack_optional_ruy_copts(),
829 deps = MICROKERNEL_BENCHMARK_DEPS + xnnpack_optional_ruy_deps(),
830)
831
832xnnpack_benchmark(
833 name = "f32_rmax_bench",
834 srcs = [
835 "bench/f32-rmax.cc",
836 "src/xnnpack/AlignedAllocator.h",
837 ] + MICROKERNEL_BENCHMARK_HDRS,
838 deps = MICROKERNEL_BENCHMARK_DEPS,
839)
840
841xnnpack_benchmark(
842 name = "f32_spmm_bench",
843 srcs = [
844 "bench/f32-spmm.cc",
845 "bench/gemm.h",
846 "src/xnnpack/AlignedAllocator.h",
847 ] + MICROKERNEL_BENCHMARK_HDRS,
848 copts = ["-Wno-unused-function"],
849 deps = MICROKERNEL_BENCHMARK_DEPS,
850)
851
852xnnpack_benchmark(
853 name = "f32_im2col_gemm_bench",
854 srcs = [
855 "bench/f32-im2col-gemm.cc",
856 "bench/conv.h",
857 "src/xnnpack/AlignedAllocator.h",
858 ] + WEIGHTS_PACK_HDRS + MICROKERNEL_BENCHMARK_HDRS,
859 deps = MICROKERNEL_BENCHMARK_DEPS + [":im2col"],
860)
861
862########################### Benchmarks for operators ###########################
863
864xnnpack_benchmark(
865 name = "add_bench",
866 srcs = ["bench/add.cc"],
867 deps = OPERATOR_BENCHMARK_DEPS,
868)
869
870xnnpack_benchmark(
871 name = "average_pooling_bench",
872 srcs = ["bench/average-pooling.cc"],
873 deps = OPERATOR_BENCHMARK_DEPS,
874)
875
876xnnpack_benchmark(
877 name = "channel_shuffle_bench",
878 srcs = ["bench/channel-shuffle.cc"],
879 deps = OPERATOR_BENCHMARK_DEPS,
880)
881
882xnnpack_benchmark(
883 name = "convolution_bench",
884 srcs = ["bench/convolution.cc"],
885 copts = xnnpack_optional_tflite_copts() + xnnpack_optional_armcl_copts(),
886 deps = OPERATOR_BENCHMARK_DEPS + xnnpack_optional_tflite_deps() + xnnpack_optional_armcl_deps(),
887)
888
889xnnpack_benchmark(
890 name = "deconvolution_bench",
891 srcs = ["bench/deconvolution.cc"],
892 copts = xnnpack_optional_tflite_copts(),
893 deps = OPERATOR_BENCHMARK_DEPS + xnnpack_optional_tflite_deps(),
894)
895
896xnnpack_benchmark(
897 name = "global_average_pooling_bench",
898 srcs = ["bench/global-average-pooling.cc"],
899 deps = OPERATOR_BENCHMARK_DEPS,
900)
901
902xnnpack_benchmark(
903 name = "max_pooling_bench",
904 srcs = ["bench/max-pooling.cc"],
905 deps = OPERATOR_BENCHMARK_DEPS,
906)
907
908xnnpack_benchmark(
909 name = "sigmoid_bench",
910 srcs = ["bench/sigmoid.cc"],
911 deps = OPERATOR_BENCHMARK_DEPS,
912)
913
914xnnpack_benchmark(
915 name = "softargmax_bench",
916 srcs = ["bench/softargmax.cc"],
917 deps = OPERATOR_BENCHMARK_DEPS,
918)
919
Marat Dukhanc068bb62019-10-04 13:24:39 -0700920############################# End-to-end benchmarks ############################
921
922cc_library(
923 name = "mobilenet_v1",
924 srcs = ["models/mobilenet-v1.cc"],
925 hdrs = ["models/models.h"],
926 linkstatic = True,
927 deps = [
928 ":XNNPACK",
929 "@pthreadpool",
930 ],
931)
932
933cc_library(
934 name = "mobilenet_v2",
935 srcs = ["models/mobilenet-v2.cc"],
936 hdrs = ["models/models.h"],
937 linkstatic = True,
938 deps = [
939 ":XNNPACK",
940 "@pthreadpool",
941 ],
942)
943
944xnnpack_benchmark(
945 name = "end2end_bench",
946 srcs = ["bench/end2end.cc"],
947 deps = [
948 ":XNNPACK",
949 ":mobilenet_v1",
950 ":mobilenet_v2",
951 "@pthreadpool",
952 ],
953)
954
Marat Dukhan08c4a432019-10-03 09:29:21 -0700955######################### Unit tests for micro-kernels #########################
956
957xnnpack_unit_test(
958 name = "f16_gemm_test",
959 srcs = [
960 "test/f16-gemm.cc",
961 "test/gemm-microkernel-tester.h",
962 "src/xnnpack/AlignedAllocator.h",
963 ] + WEIGHTS_PACK_HDRS + MICROKERNEL_TEST_HDRS,
964 deps = MICROKERNEL_TEST_DEPS,
965)
966
967xnnpack_unit_test(
968 name = "f32_argmaxpool_test",
969 srcs = [
970 "test/f32-argmaxpool.cc",
971 "test/argmaxpool-microkernel-tester.h",
972 "src/xnnpack/AlignedAllocator.h",
973 ] + MICROKERNEL_TEST_HDRS,
974 deps = MICROKERNEL_TEST_DEPS,
975)
976
977xnnpack_unit_test(
978 name = "f32_avgpool_test",
979 srcs = [
980 "test/f32-avgpool.cc",
981 "test/avgpool-microkernel-tester.h",
982 "src/xnnpack/AlignedAllocator.h",
983 ] + MICROKERNEL_TEST_HDRS,
984 deps = MICROKERNEL_TEST_DEPS,
985)
986
987xnnpack_unit_test(
988 name = "f32_clamp_test",
989 srcs = [
990 "test/f32-clamp.cc",
991 "test/clamp-microkernel-tester.h",
992 ] + MICROKERNEL_TEST_HDRS,
993 deps = MICROKERNEL_TEST_DEPS,
994)
995
996xnnpack_unit_test(
997 name = "f32_igemm_test",
998 srcs = [
999 "test/f32-igemm.cc",
1000 "test/gemm-microkernel-tester.h",
1001 "src/xnnpack/AlignedAllocator.h",
1002 ] + WEIGHTS_PACK_HDRS + MICROKERNEL_TEST_HDRS,
1003 deps = MICROKERNEL_TEST_DEPS,
1004)
1005
1006xnnpack_unit_test(
1007 name = "f32_conv_hwc_test",
1008 srcs = [
1009 "test/f32-conv-hwc.cc",
1010 "test/conv-hwc-microkernel-tester.h",
1011 "src/xnnpack/AlignedAllocator.h",
1012 ] + WEIGHTS_PACK_HDRS + MICROKERNEL_TEST_HDRS,
1013 deps = MICROKERNEL_TEST_DEPS,
1014)
1015
1016xnnpack_unit_test(
1017 name = "f32_conv_hwc2spchw_test",
1018 srcs = [
1019 "test/f32-conv-hwc2spchw.cc",
1020 "test/conv-hwc2spchw-microkernel-tester.h",
1021 "src/xnnpack/AlignedAllocator.h",
1022 ] + WEIGHTS_PACK_HDRS + MICROKERNEL_TEST_HDRS,
1023 deps = MICROKERNEL_TEST_DEPS,
1024)
1025
1026xnnpack_unit_test(
1027 name = "f32_dwconv_test",
1028 srcs = [
1029 "test/f32-dwconv.cc",
1030 "test/dwconv-microkernel-tester.h",
1031 "src/xnnpack/AlignedAllocator.h",
1032 ] + WEIGHTS_PACK_HDRS + MICROKERNEL_TEST_HDRS,
1033 deps = MICROKERNEL_TEST_DEPS,
1034)
1035
1036xnnpack_unit_test(
1037 name = "f32_dwconv_spchw_test",
1038 srcs = [
1039 "test/f32-dwconv-spchw.cc",
1040 "test/dwconv-spchw-microkernel-tester.h",
1041 "src/xnnpack/AlignedAllocator.h",
1042 ] + WEIGHTS_PACK_HDRS + MICROKERNEL_TEST_HDRS,
1043 deps = MICROKERNEL_TEST_DEPS,
1044)
1045
1046xnnpack_unit_test(
1047 name = "f32_gavgpool_test",
1048 srcs = [
1049 "test/f32-gavgpool.cc",
1050 "test/gavgpool-microkernel-tester.h",
1051 "src/xnnpack/AlignedAllocator.h",
1052 ] + MICROKERNEL_TEST_HDRS,
1053 deps = MICROKERNEL_TEST_DEPS,
1054)
1055
1056xnnpack_unit_test(
1057 name = "f32_gavgpool_spchw_test",
1058 srcs = [
1059 "test/f32-gavgpool-spchw.cc",
1060 "test/gavgpool-spchw-microkernel-tester.h",
1061 "src/xnnpack/AlignedAllocator.h",
1062 ] + MICROKERNEL_TEST_HDRS,
1063 deps = MICROKERNEL_TEST_DEPS,
1064)
1065
1066xnnpack_unit_test(
1067 name = "f32_gemm_test",
1068 srcs = [
1069 "test/f32-gemm.cc",
1070 "test/gemm-microkernel-tester.h",
1071 "src/xnnpack/AlignedAllocator.h",
1072 ] + WEIGHTS_PACK_HDRS + MICROKERNEL_TEST_HDRS,
1073 deps = MICROKERNEL_TEST_DEPS,
1074)
1075
1076xnnpack_unit_test(
1077 name = "f32_gemminc_test",
1078 srcs = [
1079 "test/f32-gemminc.cc",
1080 "test/gemm-microkernel-tester.h",
1081 "src/xnnpack/AlignedAllocator.h",
1082 ] + WEIGHTS_PACK_HDRS + MICROKERNEL_TEST_HDRS,
1083 deps = MICROKERNEL_TEST_DEPS,
1084)
1085
1086xnnpack_unit_test(
1087 name = "f32_hswish_test",
1088 srcs = [
1089 "test/f32-hswish.cc",
1090 "test/hswish-microkernel-tester.h",
1091 ] + MICROKERNEL_TEST_HDRS,
1092 deps = MICROKERNEL_TEST_DEPS,
1093)
1094
1095xnnpack_unit_test(
1096 name = "f32_maxpool_test",
1097 srcs = [
1098 "test/f32-maxpool.cc",
1099 "test/maxpool-microkernel-tester.h",
1100 ] + MICROKERNEL_TEST_HDRS,
1101 deps = MICROKERNEL_TEST_DEPS,
1102)
1103
1104xnnpack_unit_test(
1105 name = "f32_pavgpool_test",
1106 srcs = [
1107 "test/f32-pavgpool.cc",
1108 "test/avgpool-microkernel-tester.h",
1109 "src/xnnpack/AlignedAllocator.h",
1110 ] + MICROKERNEL_TEST_HDRS,
1111 deps = MICROKERNEL_TEST_DEPS,
1112)
1113
1114xnnpack_unit_test(
1115 name = "f32_ppmm_test",
1116 srcs = [
1117 "test/f32-ppmm.cc",
1118 "test/gemm-microkernel-tester.h",
1119 "src/xnnpack/AlignedAllocator.h",
1120 ] + WEIGHTS_PACK_HDRS + MICROKERNEL_TEST_HDRS,
1121 deps = MICROKERNEL_TEST_DEPS,
1122)
1123
1124xnnpack_unit_test(
1125 name = "f32_prelu_test",
1126 srcs = [
1127 "test/f32-prelu.cc",
1128 "test/prelu-microkernel-tester.h",
1129 "src/xnnpack/AlignedAllocator.h",
1130 ] + MICROKERNEL_TEST_HDRS,
1131 deps = MICROKERNEL_TEST_DEPS,
1132)
1133
1134xnnpack_unit_test(
1135 name = "f32_rmax_test",
1136 srcs = [
1137 "test/f32-rmax.cc",
1138 "test/rmax-microkernel-tester.h",
1139 ] + MICROKERNEL_TEST_HDRS,
1140 deps = MICROKERNEL_TEST_DEPS,
1141)
1142
1143xnnpack_unit_test(
1144 name = "f32_spmm_test",
1145 srcs = [
1146 "test/f32-spmm.cc",
1147 "test/spmm-microkernel-tester.h",
1148 "src/xnnpack/AlignedAllocator.h",
1149 ] + MICROKERNEL_TEST_HDRS,
1150 deps = MICROKERNEL_TEST_DEPS,
1151)
1152
1153xnnpack_unit_test(
1154 name = "f32_vadd_test",
1155 srcs = [
1156 "test/f32-vadd.cc",
1157 "test/vadd-microkernel-tester.h",
1158 ] + MICROKERNEL_TEST_HDRS,
1159 deps = MICROKERNEL_TEST_DEPS,
1160)
1161
1162xnnpack_unit_test(
1163 name = "f32_vsub_test",
1164 srcs = [
1165 "test/f32-vsub.cc",
1166 "test/vsub-microkernel-tester.h",
1167 ] + MICROKERNEL_TEST_HDRS,
1168 deps = MICROKERNEL_TEST_DEPS,
1169)
1170
1171xnnpack_unit_test(
1172 name = "f32_vmul_test",
1173 srcs = [
1174 "test/f32-vmul.cc",
1175 "test/vmul-microkernel-tester.h",
1176 ] + MICROKERNEL_TEST_HDRS,
1177 deps = MICROKERNEL_TEST_DEPS,
1178)
1179
1180xnnpack_unit_test(
1181 name = "f32_vmulcaddc_test",
1182 srcs = [
1183 "test/f32-vmulcaddc.cc",
1184 "test/vmulcaddc-microkernel-tester.h",
1185 "src/xnnpack/AlignedAllocator.h",
1186 ] + WEIGHTS_PACK_HDRS + MICROKERNEL_TEST_HDRS,
1187 deps = MICROKERNEL_TEST_DEPS,
1188)
1189
1190xnnpack_unit_test(
1191 name = "q8_avgpool_test",
1192 srcs = [
1193 "test/q8-avgpool.cc",
1194 "test/avgpool-microkernel-tester.h",
1195 "src/xnnpack/AlignedAllocator.h",
1196 ] + MICROKERNEL_TEST_HDRS,
1197 deps = MICROKERNEL_TEST_DEPS,
1198)
1199
1200xnnpack_unit_test(
1201 name = "q8_igemm_test",
1202 srcs = [
1203 "test/q8-igemm.cc",
1204 "test/gemm-microkernel-tester.h",
1205 "src/xnnpack/AlignedAllocator.h",
1206 ] + WEIGHTS_PACK_HDRS + MICROKERNEL_TEST_HDRS,
1207 deps = MICROKERNEL_TEST_DEPS,
1208)
1209
1210xnnpack_unit_test(
1211 name = "q8_dwconv_test",
1212 srcs = [
1213 "test/q8-dwconv.cc",
1214 "test/dwconv-microkernel-tester.h",
1215 "src/xnnpack/AlignedAllocator.h",
1216 ] + WEIGHTS_PACK_HDRS + MICROKERNEL_TEST_HDRS,
1217 deps = MICROKERNEL_TEST_DEPS,
1218)
1219
1220xnnpack_unit_test(
1221 name = "q8_gavgpool_test",
1222 srcs = [
1223 "test/q8-gavgpool.cc",
1224 "test/gavgpool-microkernel-tester.h",
1225 "src/xnnpack/AlignedAllocator.h",
1226 ] + MICROKERNEL_TEST_HDRS,
1227 deps = MICROKERNEL_TEST_DEPS,
1228)
1229
1230xnnpack_unit_test(
1231 name = "q8_gemm_test",
1232 srcs = [
1233 "test/q8-gemm.cc",
1234 "test/gemm-microkernel-tester.h",
1235 "src/xnnpack/AlignedAllocator.h",
1236 ] + WEIGHTS_PACK_HDRS + MICROKERNEL_TEST_HDRS,
1237 deps = MICROKERNEL_TEST_DEPS,
1238)
1239
1240xnnpack_unit_test(
1241 name = "q8_vadd_test",
1242 srcs = [
1243 "test/q8-vadd.cc",
1244 "test/vadd-microkernel-tester.h",
1245 ] + MICROKERNEL_TEST_HDRS,
1246 deps = MICROKERNEL_TEST_DEPS,
1247)
1248
1249xnnpack_unit_test(
1250 name = "u8_clamp_test",
1251 srcs = [
1252 "test/u8-clamp.cc",
1253 "test/clamp-microkernel-tester.h",
1254 ] + MICROKERNEL_TEST_HDRS,
1255 deps = MICROKERNEL_TEST_DEPS,
1256)
1257
1258xnnpack_unit_test(
1259 name = "u8_lut32norm_test",
1260 srcs = [
1261 "test/u8-lut32norm.cc",
1262 "test/lut-norm-microkernel-tester.h",
1263 ] + MICROKERNEL_TEST_HDRS,
1264 deps = MICROKERNEL_TEST_DEPS,
1265)
1266
1267xnnpack_unit_test(
1268 name = "u8_maxpool_test",
1269 srcs = [
1270 "test/u8-maxpool.cc",
1271 "test/maxpool-microkernel-tester.h",
1272 ] + MICROKERNEL_TEST_HDRS,
1273 deps = MICROKERNEL_TEST_DEPS,
1274)
1275
1276xnnpack_unit_test(
1277 name = "u8_rmax_test",
1278 srcs = [
1279 "test/u8-rmax.cc",
1280 "test/rmax-microkernel-tester.h",
1281 ] + MICROKERNEL_TEST_HDRS,
1282 deps = MICROKERNEL_TEST_DEPS,
1283)
1284
1285xnnpack_unit_test(
1286 name = "x32_packx_test",
1287 srcs = [
1288 "test/x32-packx.cc",
1289 "test/pack-microkernel-tester.h",
1290 "src/xnnpack/AlignedAllocator.h",
1291 ] + MICROKERNEL_TEST_HDRS,
1292 deps = MICROKERNEL_TEST_DEPS,
1293)
1294
1295xnnpack_unit_test(
1296 name = "x32_pad_test",
1297 srcs = [
1298 "test/x32-pad.cc",
1299 "test/pad-microkernel-tester.h",
1300 ] + MICROKERNEL_TEST_HDRS,
1301 deps = MICROKERNEL_TEST_DEPS,
1302)
1303
1304xnnpack_unit_test(
1305 name = "x32_unpool_test",
1306 srcs = [
1307 "test/x32-unpool.cc",
1308 "test/unpool-microkernel-tester.h",
1309 ] + MICROKERNEL_TEST_HDRS,
1310 deps = MICROKERNEL_TEST_DEPS,
1311)
1312
1313xnnpack_unit_test(
1314 name = "x32_zip_test",
1315 srcs = [
1316 "test/x32-zip.cc",
1317 "test/zip-microkernel-tester.h",
1318 ] + MICROKERNEL_TEST_HDRS,
1319 deps = MICROKERNEL_TEST_DEPS,
1320)
1321
1322xnnpack_unit_test(
1323 name = "x8_lut_test",
1324 srcs = [
1325 "test/x8-lut.cc",
1326 "test/lut-microkernel-tester.h",
1327 ] + MICROKERNEL_TEST_HDRS,
1328 deps = MICROKERNEL_TEST_DEPS,
1329)
1330
1331xnnpack_unit_test(
1332 name = "x8_zip_test",
1333 srcs = [
1334 "test/x8-zip.cc",
1335 "test/zip-microkernel-tester.h",
1336 ] + MICROKERNEL_TEST_HDRS,
1337 deps = MICROKERNEL_TEST_DEPS,
1338)
1339
1340########################### Size test for the library ##########################
1341
1342xnnpack_binary(
1343 name = "size_test",
1344 srcs = ["test/size.c"],
1345 deps = [":XNNPACK"],
1346)
1347
1348########################### Unit tests for operators ###########################
1349
1350xnnpack_unit_test(
1351 name = "add_test",
1352 srcs = [
1353 "test/add.cc",
1354 "test/add-operator-tester.h",
1355 ],
1356 deps = OPERATOR_TEST_DEPS,
1357)
1358
1359xnnpack_unit_test(
1360 name = "argmax_pooling_test",
1361 srcs = [
1362 "test/argmax-pooling.cc",
1363 "test/argmax-pooling-operator-tester.h",
1364 ] + OPERATOR_TEST_PARAMS_HDRS,
1365 deps = OPERATOR_TEST_DEPS,
1366)
1367
1368xnnpack_unit_test(
1369 name = "average_pooling_test",
1370 srcs = [
1371 "test/average-pooling.cc",
1372 "test/average-pooling-operator-tester.h",
1373 ] + OPERATOR_TEST_PARAMS_HDRS,
1374 deps = OPERATOR_TEST_DEPS,
1375)
1376
1377xnnpack_unit_test(
1378 name = "channel_pad_test",
1379 srcs = [
1380 "test/channel-pad.cc",
1381 "test/channel-pad-operator-tester.h",
1382 ] + OPERATOR_TEST_PARAMS_HDRS,
1383 deps = OPERATOR_TEST_DEPS,
1384)
1385
1386xnnpack_unit_test(
1387 name = "channel_shuffle_test",
1388 srcs = [
1389 "test/channel-shuffle.cc",
1390 "test/channel-shuffle-operator-tester.h",
1391 ],
1392 deps = OPERATOR_TEST_DEPS,
1393)
1394
1395xnnpack_unit_test(
1396 name = "clamp_test",
1397 srcs = [
1398 "test/clamp.cc",
1399 "test/clamp-operator-tester.h",
1400 ],
1401 deps = OPERATOR_TEST_DEPS,
1402)
1403
1404xnnpack_unit_test(
1405 name = "convolution_test",
1406 srcs = [
1407 "test/convolution.cc",
1408 "test/convolution-operator-tester.h",
1409 ],
1410 deps = OPERATOR_TEST_DEPS,
1411)
1412
1413xnnpack_unit_test(
1414 name = "convolution_spnchw_test",
1415 srcs = [
1416 "test/convolution-spnchw.cc",
1417 "test/convolution-spnchw-operator-tester.h",
1418 ],
1419 deps = OPERATOR_TEST_DEPS,
1420)
1421
1422xnnpack_unit_test(
1423 name = "deconvolution_test",
1424 srcs = [
1425 "test/deconvolution.cc",
1426 "test/deconvolution-operator-tester.h",
1427 ] + OPERATOR_TEST_PARAMS_HDRS,
1428 deps = OPERATOR_TEST_DEPS,
1429)
1430
1431xnnpack_unit_test(
1432 name = "fully_connected_test",
1433 srcs = [
1434 "test/fully-connected.cc",
1435 "test/fully-connected-operator-tester.h",
1436 ],
1437 deps = OPERATOR_TEST_DEPS,
1438)
1439
1440xnnpack_unit_test(
1441 name = "global_average_pooling_test",
1442 srcs = [
1443 "test/global-average-pooling.cc",
1444 "test/global-average-pooling-operator-tester.h",
1445 ] + OPERATOR_TEST_PARAMS_HDRS,
1446 deps = OPERATOR_TEST_DEPS,
1447)
1448
1449xnnpack_unit_test(
1450 name = "global_average_pooling_spnchw_test",
1451 srcs = [
1452 "test/global-average-pooling-spnchw.cc",
1453 "test/global-average-pooling-spnchw-operator-tester.h",
1454 ],
1455 deps = OPERATOR_TEST_DEPS,
1456)
1457
1458xnnpack_unit_test(
1459 name = "hardswish_test",
1460 srcs = [
1461 "test/hardswish.cc",
1462 "test/hardswish-operator-tester.h",
1463 ],
1464 deps = OPERATOR_TEST_DEPS,
1465)
1466
1467xnnpack_unit_test(
1468 name = "leaky_relu_test",
1469 srcs = [
1470 "test/leaky-relu.cc",
1471 "test/leaky-relu-operator-tester.h",
1472 ],
1473 deps = OPERATOR_TEST_DEPS,
1474)
1475
1476xnnpack_unit_test(
1477 name = "max_pooling_test",
1478 srcs = [
1479 "test/max-pooling.cc",
1480 "test/max-pooling-operator-tester.h",
1481 ] + OPERATOR_TEST_PARAMS_HDRS,
1482 deps = OPERATOR_TEST_DEPS,
1483)
1484
1485xnnpack_unit_test(
1486 name = "prelu_test",
1487 srcs = [
1488 "test/prelu.cc",
1489 "test/prelu-operator-tester.h",
1490 ] + OPERATOR_TEST_PARAMS_HDRS,
1491 deps = OPERATOR_TEST_DEPS,
1492)
1493
1494xnnpack_unit_test(
1495 name = "sigmoid_test",
1496 srcs = [
1497 "test/sigmoid.cc",
1498 "test/sigmoid-operator-tester.h",
1499 ],
1500 deps = OPERATOR_TEST_DEPS,
1501)
1502
1503xnnpack_unit_test(
1504 name = "softargmax_test",
1505 srcs = [
1506 "test/softargmax.cc",
1507 "test/softargmax-operator-tester.h",
1508 ],
1509 deps = OPERATOR_TEST_DEPS,
1510)
1511
1512xnnpack_unit_test(
1513 name = "unpooling_test",
1514 srcs = [
1515 "test/unpooling.cc",
1516 "test/unpooling-operator-tester.h",
1517 ],
1518 deps = OPERATOR_TEST_DEPS,
1519)
1520
1521############################# Build configurations #############################
1522
1523config_setting(
1524 name = "linux_k8",
1525 values = {
1526 "cpu": "k8",
1527 },
1528)
1529
1530config_setting(
Marat Dukhan4e45e662019-10-03 15:40:24 -07001531 name = "linux_aarch64",
1532 values = {
1533 "cpu": "aarch64",
1534 },
1535)
1536
1537config_setting(
Marat Dukhan08c4a432019-10-03 09:29:21 -07001538 name = "android",
1539 values = {"crosstool_top": "//external:android/crosstool"},
1540)
1541
1542config_setting(
1543 name = "android_armv7",
1544 values = {
1545 "crosstool_top": "//external:android/crosstool",
1546 "cpu": "armeabi-v7a",
1547 },
1548)
1549
1550config_setting(
1551 name = "android_arm64",
1552 values = {
1553 "crosstool_top": "//external:android/crosstool",
1554 "cpu": "arm64-v8a",
1555 },
1556)
1557
1558config_setting(
1559 name = "android_x86",
1560 values = {
1561 "crosstool_top": "//external:android/crosstool",
1562 "cpu": "x86",
1563 },
1564)
1565
1566config_setting(
1567 name = "android_x86_64",
1568 values = {
1569 "crosstool_top": "//external:android/crosstool",
1570 "cpu": "x86_64",
1571 },
1572)
1573
1574config_setting(
Marat Dukhan885ca242019-10-07 09:17:32 -07001575 name = "macos_x86_64",
1576 values = {
1577 "apple_platform_type": "macos",
1578 "cpu": "darwin",
1579 },
1580)
1581
1582config_setting(
Marat Dukhan08c4a432019-10-03 09:29:21 -07001583 name = "emscripten",
Marat Dukhan9d056a42019-10-03 12:13:35 -07001584 values = {"crosstool_top": "//toolchain/emscripten"},
Marat Dukhan08c4a432019-10-03 09:29:21 -07001585)
1586
1587config_setting(
1588 name = "emscripten_wasm",
1589 values = {
Marat Dukhan9d056a42019-10-03 12:13:35 -07001590 "crosstool_top": "//toolchain/emscripten",
Marat Dukhan08c4a432019-10-03 09:29:21 -07001591 "cpu": "wasm",
1592 },
1593)
1594
1595config_setting(
1596 name = "emscripten_wasmsimd",
1597 values = {
Marat Dukhan9d056a42019-10-03 12:13:35 -07001598 "crosstool_top": "//toolchain/emscripten",
Marat Dukhan08c4a432019-10-03 09:29:21 -07001599 "cpu": "wasm",
1600 "features": "wasmsimd",
1601 },
1602)
1603
1604config_setting(
1605 name = "emscripten_asmjs",
1606 values = {
Marat Dukhan9d056a42019-10-03 12:13:35 -07001607 "crosstool_top": "//toolchain/emscripten",
Marat Dukhan08c4a432019-10-03 09:29:21 -07001608 "cpu": "asmjs",
1609 },
1610)
1611
1612# Builds with -c opt
1613config_setting(
1614 name = "debug_build",
1615 values = {
1616 "compilation_mode": "dbg",
1617 },
Marat Dukhan08c4a432019-10-03 09:29:21 -07001618)
1619
1620# Builds with -c dbg
1621config_setting(
1622 name = "optimized_build",
1623 values = {
1624 "compilation_mode": "opt",
1625 },
Marat Dukhan08c4a432019-10-03 09:29:21 -07001626)
1627
1628# Enables usage of assembly kernels.
1629config_setting(
1630 name = "xnn_enable_assembly_explicit_true",
1631 define_values = {"xnn_enable_assembly": "true"},
1632)
1633
1634# Disables usage of assembly kernels.
1635config_setting(
1636 name = "xnn_enable_assembly_explicit_false",
1637 define_values = {"xnn_enable_assembly": "false"},
1638)