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