Marat Dukhan | 08c4a43 | 2019-10-03 09:29:21 -0700 | [diff] [blame] | 1 | # 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 | |
| 9 | licenses(["notice"]) |
| 10 | |
| 11 | exports_files(["LICENSE"]) |
| 12 | |
| 13 | load(":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 | |
| 15 | OPERATOR_BENCHMARK_DEPS = [ |
| 16 | ":XNNPACK", |
| 17 | ":bench_utils", |
| 18 | "@cpuinfo", |
| 19 | "@pthreadpool", |
| 20 | ] |
| 21 | |
| 22 | MICROKERNEL_BENCHMARK_DEPS = [ |
| 23 | ":ukernels", |
| 24 | ":bench_utils", |
Frank Barchard | 7e95597 | 2019-10-11 10:34:25 -0700 | [diff] [blame] | 25 | ":enable_assembly", |
Marat Dukhan | 08c4a43 | 2019-10-03 09:29:21 -0700 | [diff] [blame] | 26 | "@cpuinfo", |
| 27 | "@FP16", |
| 28 | "@pthreadpool", |
| 29 | ] |
| 30 | |
Marat Dukhan | 6adff4e | 2019-10-14 18:32:07 -0700 | [diff] [blame] | 31 | ACCURACY_EVAL_DEPS = [ |
| 32 | ":XNNPACK", |
| 33 | ":ukernels", |
| 34 | "@FP16", |
| 35 | "@pthreadpool", |
| 36 | ] |
| 37 | |
Marat Dukhan | 08c4a43 | 2019-10-03 09:29:21 -0700 | [diff] [blame] | 38 | MICROKERNEL_TEST_DEPS = [ |
| 39 | ":ukernels", |
Frank Barchard | 7e95597 | 2019-10-11 10:34:25 -0700 | [diff] [blame] | 40 | ":enable_assembly", |
Marat Dukhan | 08c4a43 | 2019-10-03 09:29:21 -0700 | [diff] [blame] | 41 | "@cpuinfo", |
| 42 | "@FP16", |
| 43 | "@pthreadpool", |
| 44 | ] |
| 45 | |
| 46 | OPERATOR_TEST_DEPS = [ |
| 47 | ":XNNPACK", |
| 48 | "@pthreadpool", |
| 49 | "@FP16", |
| 50 | ] |
| 51 | |
| 52 | OPERATOR_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 | |
| 74 | SCALAR_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 Elsen | 0cc2c53 | 2019-10-15 04:44:18 -0700 | [diff] [blame] | 88 | "src/f32-dwconv-spchw/3x3p1-scalar.c", |
Erich Elsen | ac4de80 | 2019-10-16 04:35:30 -0700 | [diff] [blame] | 89 | "src/f32-dwconv-spchw/3x3s2p1-scalar.c", |
Erich Elsen | 34dc2c0 | 2019-10-16 05:11:41 -0700 | [diff] [blame] | 90 | "src/f32-gavgpool-spchw/scalar-x1.c", |
Marat Dukhan | 08c4a43 | 2019-10-03 09:29:21 -0700 | [diff] [blame] | 91 | "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 | |
| 154 | PSIMD_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 |
| 214 | NEON_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 Dukhan | 08c4a43 | 2019-10-03 09:29:21 -0700 | [diff] [blame] | 219 | "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 Dukhan | 08c4a43 | 2019-10-03 09:29:21 -0700 | [diff] [blame] | 229 | "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 Dukhan | 08c4a43 | 2019-10-03 09:29:21 -0700 | [diff] [blame] | 235 | "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 | |
| 271 | NEONFMA_UKERNELS = [ |
Frank Barchard | db45b6a | 2019-10-09 16:42:45 -0700 | [diff] [blame] | 272 | "src/f32-igemm/1x8-neonfma-ld64.c", |
Marat Dukhan | 08c4a43 | 2019-10-03 09:29:21 -0700 | [diff] [blame] | 273 | "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 Dukhan | 08c4a43 | 2019-10-03 09:29:21 -0700 | [diff] [blame] | 281 | "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 Dukhan | 08c4a43 | 2019-10-03 09:29:21 -0700 | [diff] [blame] | 287 | "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 | |
| 297 | AARCH64_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 | |
| 325 | AARCH64_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 | |
| 331 | SSE_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 | |
| 378 | SSE2_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 | |
| 405 | AVX_UKERNELS = [ |
| 406 | "src/f32-rmax/avx.c", |
| 407 | ] |
| 408 | |
Marat Dukhan | 6adff4e | 2019-10-14 18:32:07 -0700 | [diff] [blame] | 409 | AVX2_UKERNELS = [ |
| 410 | "src/math/exp-avx2-p5.c", |
| 411 | "src/math/exp-avx2-perm-p3.c", |
| 412 | "src/math/exp-avx2-perm-p4.c", |
| 413 | ] |
| 414 | |
Marat Dukhan | 08c4a43 | 2019-10-03 09:29:21 -0700 | [diff] [blame] | 415 | AVX512F_UKERNELS = [ |
| 416 | "src/f32-rmax/avx512f.c", |
Marat Dukhan | 6adff4e | 2019-10-14 18:32:07 -0700 | [diff] [blame] | 417 | "src/math/exp-avx512f-p5-scalef.c", |
| 418 | "src/math/exp-avx512f-p5.c", |
| 419 | "src/math/exp-avx512f-perm-p3.c", |
Marat Dukhan | 08c4a43 | 2019-10-03 09:29:21 -0700 | [diff] [blame] | 420 | ] |
| 421 | |
| 422 | AARCH32_ASM_UKERNELS = [ |
| 423 | "src/q8-dwconv/up8x9-aarch32-neon.S", |
| 424 | ] |
| 425 | |
| 426 | AARCH64_ASM_UKERNELS = [ |
| 427 | "src/f32-dwconv/up4x9-aarch64-neonfma-cortex-a55.S", |
| 428 | "src/f32-dwconv/up4x9-aarch64-neonfma.S", |
| 429 | "src/f32-gemm/1x12-aarch64-neonfma-cortex-a53.S", |
Frank Barchard | 21be34f | 2019-10-09 19:32:19 -0700 | [diff] [blame] | 430 | "src/f32-gemm/1x8-aarch64-neonfma-cortex-a53.S", |
Marat Dukhan | 08c4a43 | 2019-10-03 09:29:21 -0700 | [diff] [blame] | 431 | "src/f32-gemm/1x8-aarch64-neonfma-cortex-a57.S", |
| 432 | "src/f32-gemm/1x8-aarch64-neonfma-cortex-a75.S", |
| 433 | "src/f32-gemm/4x12-aarch64-neonfma-cortex-a53.S", |
| 434 | "src/f32-gemm/4x8-aarch64-neonfma-cortex-a57.S", |
| 435 | "src/f32-gemm/4x8-aarch64-neonfma-cortex-a75.S", |
| 436 | "src/f32-gemm/4x8-aarch64-neonfma-ld128.S", |
| 437 | "src/f32-gemm/4x8-aarch64-neonfma-ld64.S", |
| 438 | "src/f32-gemm/5x8-aarch64-neonfma-cortex-a75.S", |
| 439 | "src/f32-gemm/6x8-aarch64-neonfma-cortex-a57.S", |
| 440 | "src/f32-gemm/6x8-aarch64-neonfma-cortex-a73.S", |
| 441 | "src/f32-gemm/6x8-aarch64-neonfma-cortex-a75.S", |
| 442 | "src/f32-gemm/6x8-aarch64-neonfma-ld128.S", |
| 443 | "src/f32-gemm/6x8-aarch64-neonfma-ld64.S", |
| 444 | "src/f32-gemminc/1x12-aarch64-neonfma-cortex-a53.S", |
Frank Barchard | 21be34f | 2019-10-09 19:32:19 -0700 | [diff] [blame] | 445 | "src/f32-gemminc/1x8-aarch64-neonfma-cortex-a53.S", |
Marat Dukhan | 08c4a43 | 2019-10-03 09:29:21 -0700 | [diff] [blame] | 446 | "src/f32-gemminc/1x8-aarch64-neonfma-cortex-a57.S", |
| 447 | "src/f32-gemminc/1x8-aarch64-neonfma-cortex-a75.S", |
| 448 | "src/f32-gemminc/4x12-aarch64-neonfma-cortex-a53.S", |
| 449 | "src/f32-gemminc/4x8-aarch64-neonfma-cortex-a57.S", |
| 450 | "src/f32-gemminc/4x8-aarch64-neonfma-cortex-a75.S", |
| 451 | "src/f32-gemminc/4x8-aarch64-neonfma-ld128.S", |
| 452 | "src/f32-gemminc/4x8-aarch64-neonfma-ld64.S", |
| 453 | "src/f32-gemminc/5x8-aarch64-neonfma-cortex-a75.S", |
| 454 | "src/f32-gemminc/6x8-aarch64-neonfma-cortex-a57.S", |
| 455 | "src/f32-gemminc/6x8-aarch64-neonfma-cortex-a73.S", |
| 456 | "src/f32-gemminc/6x8-aarch64-neonfma-cortex-a75.S", |
| 457 | "src/f32-gemminc/6x8-aarch64-neonfma-ld128.S", |
| 458 | "src/f32-gemminc/6x8-aarch64-neonfma-ld64.S", |
| 459 | "src/f32-igemm/1x12-aarch64-neonfma-cortex-a53.S", |
Frank Barchard | 21be34f | 2019-10-09 19:32:19 -0700 | [diff] [blame] | 460 | "src/f32-igemm/1x8-aarch64-neonfma-cortex-a53.S", |
Marat Dukhan | 08c4a43 | 2019-10-03 09:29:21 -0700 | [diff] [blame] | 461 | "src/f32-igemm/1x8-aarch64-neonfma-cortex-a57.S", |
| 462 | "src/f32-igemm/1x8-aarch64-neonfma-cortex-a75.S", |
| 463 | "src/f32-igemm/4x12-aarch64-neonfma-cortex-a53.S", |
| 464 | "src/f32-igemm/4x8-aarch64-neonfma-cortex-a75.S", |
| 465 | "src/f32-igemm/5x8-aarch64-neonfma-cortex-a75.S", |
| 466 | "src/f32-igemm/6x8-aarch64-neonfma-cortex-a57.S", |
| 467 | "src/f32-igemm/6x8-aarch64-neonfma-cortex-a73.S", |
| 468 | "src/f32-igemm/6x8-aarch64-neonfma-cortex-a75.S", |
| 469 | ] |
| 470 | |
| 471 | INTERNAL_MICROKERNEL_HDRS = [ |
| 472 | "src/xnnpack/argmaxpool.h", |
| 473 | "src/xnnpack/avgpool.h", |
| 474 | "src/xnnpack/clamp.h", |
| 475 | "src/xnnpack/common.h", |
| 476 | "src/xnnpack/conv.h", |
| 477 | "src/xnnpack/dwconv.h", |
| 478 | "src/xnnpack/gavgpool.h", |
| 479 | "src/xnnpack/gemm.h", |
| 480 | "src/xnnpack/hswish.h", |
| 481 | "src/xnnpack/igemm.h", |
| 482 | "src/xnnpack/lut.h", |
| 483 | "src/xnnpack/math.h", |
| 484 | "src/xnnpack/maxpool.h", |
| 485 | "src/xnnpack/packx.h", |
| 486 | "src/xnnpack/pad.h", |
| 487 | "src/xnnpack/params.h", |
| 488 | "src/xnnpack/pavgpool.h", |
| 489 | "src/xnnpack/ppmm.h", |
| 490 | "src/xnnpack/prelu.h", |
| 491 | "src/xnnpack/rmax.h", |
| 492 | "src/xnnpack/scalar-utils.h", |
| 493 | "src/xnnpack/spmm.h", |
| 494 | "src/xnnpack/unpool.h", |
| 495 | "src/xnnpack/vadd.h", |
| 496 | "src/xnnpack/vmul.h", |
| 497 | "src/xnnpack/vmulcaddc.h", |
| 498 | "src/xnnpack/vsub.h", |
| 499 | "src/xnnpack/zip.h", |
| 500 | ] |
| 501 | |
| 502 | INTERNAL_HDRS = INTERNAL_MICROKERNEL_HDRS + [ |
| 503 | "include/xnnpack.h", |
| 504 | "src/xnnpack/allocator.h", |
| 505 | "src/xnnpack/compute.h", |
| 506 | "src/xnnpack/im2col.h", |
| 507 | "src/xnnpack/indirection.h", |
Marat Dukhan | 6adff4e | 2019-10-14 18:32:07 -0700 | [diff] [blame] | 508 | "src/xnnpack/math-stubs.h", |
Marat Dukhan | 08c4a43 | 2019-10-03 09:29:21 -0700 | [diff] [blame] | 509 | "src/xnnpack/operator.h", |
| 510 | "src/xnnpack/pack.h", |
Marat Dukhan | 08c4a43 | 2019-10-03 09:29:21 -0700 | [diff] [blame] | 511 | "src/xnnpack/requantization-stubs.h", |
Marat Dukhan | 6adff4e | 2019-10-14 18:32:07 -0700 | [diff] [blame] | 512 | "src/xnnpack/requantization.h", |
| 513 | ] |
| 514 | |
| 515 | ACCURACY_EVAL_HDRS = INTERNAL_MICROKERNEL_HDRS + [ |
| 516 | "src/xnnpack/math-stubs.h", |
Marat Dukhan | 08c4a43 | 2019-10-03 09:29:21 -0700 | [diff] [blame] | 517 | ] |
| 518 | |
| 519 | MICROKERNEL_BENCHMARK_HDRS = INTERNAL_MICROKERNEL_HDRS + [ |
| 520 | "src/xnnpack/requantization.h", |
| 521 | "include/xnnpack.h", |
| 522 | ] |
| 523 | |
| 524 | MICROKERNEL_TEST_HDRS = INTERNAL_MICROKERNEL_HDRS + [ |
| 525 | "src/xnnpack/isa-checks.h", |
| 526 | "src/xnnpack/requantization.h", |
| 527 | "include/xnnpack.h", |
| 528 | ] |
| 529 | |
| 530 | OPERATOR_TEST_PARAMS_HDRS = [ |
| 531 | "src/xnnpack/params.h", |
| 532 | "src/xnnpack/common.h", |
| 533 | ] |
| 534 | |
| 535 | WEIGHTS_PACK_HDRS = [ |
| 536 | "src/xnnpack/pack.h", |
| 537 | "src/xnnpack/operator.h", |
| 538 | "src/xnnpack/compute.h", |
| 539 | ] |
| 540 | |
Marat Dukhan | c8e00eb | 2019-10-04 14:55:26 -0700 | [diff] [blame] | 541 | LOGGING_COPTS = select({ |
| 542 | # No logging in optimized mode |
| 543 | ":optimized_build": ["-DXNN_LOG_LEVEL=0"], |
| 544 | # Full logging in debug mode |
| 545 | ":debug_build": ["-DXNN_LOG_LEVEL=5"], |
| 546 | # Error-only logging in default (fastbuild) mode |
| 547 | "//conditions:default": ["-DXNN_LOG_LEVEL=2"], |
| 548 | }) |
| 549 | |
| 550 | LOGGING_HDRS = [ |
| 551 | "src/xnnpack/log.h", |
| 552 | ] |
| 553 | |
Marat Dukhan | 08c4a43 | 2019-10-03 09:29:21 -0700 | [diff] [blame] | 554 | xnnpack_cc_library( |
| 555 | name = "scalar_ukernels", |
| 556 | srcs = SCALAR_UKERNELS, |
| 557 | hdrs = INTERNAL_HDRS, |
| 558 | aarch32_copts = ["-marm"], |
| 559 | copts = xnnpack_std_copts(), |
| 560 | deps = [ |
| 561 | "@FP16", |
| 562 | "@FXdiv", |
| 563 | ], |
| 564 | ) |
| 565 | |
| 566 | xnnpack_cc_library( |
| 567 | name = "psimd_ukernels", |
| 568 | srcs = PSIMD_UKERNELS, |
| 569 | hdrs = INTERNAL_HDRS, |
| 570 | aarch32_copts = [ |
| 571 | "-marm", |
| 572 | "-mfpu=neon", |
| 573 | ], |
| 574 | copts = xnnpack_std_copts(), |
| 575 | optimized_copts = [ |
| 576 | "-O3", |
| 577 | "-ffast-math", |
| 578 | ], |
| 579 | deps = [ |
| 580 | "@FP16", |
| 581 | "@psimd", |
| 582 | ], |
| 583 | ) |
| 584 | |
| 585 | xnnpack_cc_library( |
| 586 | name = "neon_ukernels", |
| 587 | hdrs = INTERNAL_HDRS, |
| 588 | aarch32_copts = [ |
| 589 | "-marm", |
| 590 | "-mfpu=neon", |
| 591 | ], |
| 592 | aarch32_srcs = NEON_UKERNELS, |
| 593 | aarch64_srcs = NEON_UKERNELS, |
| 594 | copts = xnnpack_std_copts(), |
| 595 | deps = ["@FP16"], |
| 596 | ) |
| 597 | |
| 598 | xnnpack_cc_library( |
| 599 | name = "neonfma_ukernels", |
| 600 | hdrs = INTERNAL_HDRS, |
| 601 | aarch32_copts = [ |
| 602 | "-marm", |
| 603 | "-mfpu=neon-vfpv4", |
| 604 | ], |
| 605 | aarch32_srcs = NEONFMA_UKERNELS, |
| 606 | aarch64_srcs = NEONFMA_UKERNELS + AARCH64_NEONFMA_UKERNELS, |
| 607 | copts = xnnpack_std_copts(), |
| 608 | deps = ["@FP16"], |
| 609 | ) |
| 610 | |
| 611 | xnnpack_cc_library( |
| 612 | name = "neonfp16arith_ukernels", |
| 613 | hdrs = INTERNAL_HDRS, |
| 614 | aarch64_copts = ["-march=armv8.2-a+fp16"], |
| 615 | aarch64_srcs = AARCH64_NEONFP16ARITH_UKERNELS, |
| 616 | copts = xnnpack_std_copts(), |
| 617 | deps = ["@FP16"], |
| 618 | ) |
| 619 | |
| 620 | xnnpack_cc_library( |
| 621 | name = "sse2_ukernels", |
| 622 | hdrs = INTERNAL_HDRS, |
| 623 | copts = xnnpack_std_copts(), |
| 624 | x86_copts = ["-msse2"], |
| 625 | x86_srcs = SSE_UKERNELS + SSE2_UKERNELS, |
| 626 | deps = ["@FP16"], |
| 627 | ) |
| 628 | |
| 629 | xnnpack_cc_library( |
| 630 | name = "avx_ukernels", |
| 631 | hdrs = INTERNAL_HDRS, |
| 632 | copts = xnnpack_std_copts(), |
| 633 | x86_copts = ["-mavx"], |
| 634 | x86_srcs = AVX_UKERNELS, |
| 635 | deps = ["@FP16"], |
| 636 | ) |
| 637 | |
| 638 | xnnpack_cc_library( |
Marat Dukhan | 6adff4e | 2019-10-14 18:32:07 -0700 | [diff] [blame] | 639 | name = "avx2_ukernels", |
| 640 | hdrs = INTERNAL_HDRS, |
| 641 | copts = xnnpack_std_copts(), |
| 642 | x86_copts = [ |
| 643 | "-mfma", |
| 644 | "-mavx2", |
| 645 | ], |
| 646 | x86_srcs = AVX2_UKERNELS, |
| 647 | deps = ["@FP16"], |
| 648 | ) |
| 649 | |
| 650 | xnnpack_cc_library( |
Marat Dukhan | 08c4a43 | 2019-10-03 09:29:21 -0700 | [diff] [blame] | 651 | name = "avx512f_ukernels", |
| 652 | hdrs = INTERNAL_HDRS, |
| 653 | copts = xnnpack_std_copts(), |
| 654 | x86_copts = ["-mavx512f"], |
| 655 | x86_srcs = AVX512F_UKERNELS, |
| 656 | deps = ["@FP16"], |
| 657 | ) |
| 658 | |
| 659 | xnnpack_cc_library( |
| 660 | name = "asm_ukernels", |
| 661 | hdrs = ["src/xnnpack/assembly.h"], |
| 662 | aarch32_srcs = AARCH32_ASM_UKERNELS, |
| 663 | aarch64_srcs = AARCH64_ASM_UKERNELS, |
| 664 | ) |
| 665 | |
| 666 | xnnpack_aggregate_library( |
| 667 | name = "ukernels", |
| 668 | aarch32_deps = [ |
| 669 | ":psimd_ukernels", |
| 670 | ":neon_ukernels", |
| 671 | ":neonfma_ukernels", |
| 672 | ":asm_ukernels", |
| 673 | ], |
| 674 | aarch64_deps = [ |
| 675 | ":psimd_ukernels", |
| 676 | ":neon_ukernels", |
| 677 | ":neonfma_ukernels", |
| 678 | ":neonfp16arith_ukernels", |
| 679 | ":asm_ukernels", |
| 680 | ], |
| 681 | generic_deps = [":scalar_ukernels"], |
| 682 | wasmsimd_deps = [ |
| 683 | ":psimd_ukernels", |
| 684 | ], |
| 685 | x86_deps = [ |
| 686 | ":psimd_ukernels", |
| 687 | ":sse2_ukernels", |
| 688 | ":avx_ukernels", |
Marat Dukhan | 6adff4e | 2019-10-14 18:32:07 -0700 | [diff] [blame] | 689 | ":avx2_ukernels", |
Marat Dukhan | 08c4a43 | 2019-10-03 09:29:21 -0700 | [diff] [blame] | 690 | ":avx512f_ukernels", |
| 691 | ], |
| 692 | ) |
| 693 | |
| 694 | xnnpack_cc_library( |
| 695 | name = "im2col", |
| 696 | srcs = ["src/im2col.c"], |
| 697 | hdrs = [ |
| 698 | "src/xnnpack/common.h", |
| 699 | "src/xnnpack/im2col.h", |
| 700 | ], |
| 701 | copts = xnnpack_std_copts(), |
| 702 | ) |
| 703 | |
| 704 | xnnpack_cc_library( |
| 705 | name = "indirection", |
| 706 | srcs = ["src/indirection.c"], |
| 707 | hdrs = INTERNAL_HDRS, |
| 708 | copts = xnnpack_std_copts(), |
| 709 | deps = [ |
| 710 | "@FP16", |
| 711 | "@FXdiv", |
| 712 | "@pthreadpool", |
| 713 | ], |
| 714 | ) |
| 715 | |
| 716 | xnnpack_cc_library( |
| 717 | name = "operator_run", |
| 718 | srcs = ["src/operator-run.c"], |
Marat Dukhan | c8e00eb | 2019-10-04 14:55:26 -0700 | [diff] [blame] | 719 | hdrs = INTERNAL_HDRS + LOGGING_HDRS, |
| 720 | copts = xnnpack_std_copts() + LOGGING_COPTS + [ |
Marat Dukhan | 08c4a43 | 2019-10-03 09:29:21 -0700 | [diff] [blame] | 721 | # Wrappers for multi-pass microkernels use VLAs for temporary buffers. |
| 722 | "-Wno-vla", |
| 723 | ], |
| 724 | deps = [ |
| 725 | "@FP16", |
| 726 | "@FXdiv", |
| 727 | "@clog", |
| 728 | "@pthreadpool", |
| 729 | ], |
| 730 | ) |
| 731 | |
| 732 | cc_library( |
| 733 | name = "enable_assembly", |
| 734 | defines = select({ |
| 735 | ":xnn_enable_assembly_explicit_true": ["XNN_ENABLE_ASSEMBLY=1"], |
| 736 | ":xnn_enable_assembly_explicit_false": ["XNN_ENABLE_ASSEMBLY=0"], |
Frank Barchard | 810171d | 2019-10-10 10:34:51 -0700 | [diff] [blame] | 737 | "//conditions:default": ["XNN_ENABLE_ASSEMBLY=1"], |
Marat Dukhan | 08c4a43 | 2019-10-03 09:29:21 -0700 | [diff] [blame] | 738 | }), |
| 739 | ) |
| 740 | |
Marat Dukhan | cf056b2 | 2019-10-07 10:26:29 -0700 | [diff] [blame] | 741 | xnnpack_cc_library( |
Marat Dukhan | 08c4a43 | 2019-10-03 09:29:21 -0700 | [diff] [blame] | 742 | name = "operators", |
| 743 | srcs = OPERATOR_SRCS + [ |
Marat Dukhan | 08c4a43 | 2019-10-03 09:29:21 -0700 | [diff] [blame] | 744 | "src/operator-delete.c", |
Marat Dukhan | cf056b2 | 2019-10-07 10:26:29 -0700 | [diff] [blame] | 745 | ], |
| 746 | hdrs = INTERNAL_HDRS + LOGGING_HDRS, |
Marat Dukhan | c8e00eb | 2019-10-04 14:55:26 -0700 | [diff] [blame] | 747 | copts = xnnpack_std_copts() + LOGGING_COPTS + [ |
Marat Dukhan | 08c4a43 | 2019-10-03 09:29:21 -0700 | [diff] [blame] | 748 | "-Isrc", |
| 749 | "-Iinclude", |
| 750 | ] + select({ |
| 751 | ":debug_build": [], |
| 752 | "//conditions:default": xnnpack_min_size_copts(), |
| 753 | }), |
Marat Dukhan | cf056b2 | 2019-10-07 10:26:29 -0700 | [diff] [blame] | 754 | wasm_srcs = ["src/wasm-stubs.c"], |
| 755 | wasmsimd_srcs = ["src/wasm-stubs.c"], |
Marat Dukhan | 08c4a43 | 2019-10-03 09:29:21 -0700 | [diff] [blame] | 756 | deps = [ |
Marat Dukhan | 08c4a43 | 2019-10-03 09:29:21 -0700 | [diff] [blame] | 757 | ":indirection", |
Marat Dukhan | 08c4a43 | 2019-10-03 09:29:21 -0700 | [diff] [blame] | 758 | "@FP16", |
| 759 | "@FXdiv", |
| 760 | "@clog", |
Marat Dukhan | 08c4a43 | 2019-10-03 09:29:21 -0700 | [diff] [blame] | 761 | "@pthreadpool", |
Marat Dukhan | 8fe54e4 | 2019-10-10 14:12:59 -0700 | [diff] [blame] | 762 | ], |
| 763 | ) |
| 764 | |
| 765 | cc_library( |
| 766 | name = "XNNPACK", |
| 767 | srcs = [ |
| 768 | "src/init.c", |
| 769 | ], |
| 770 | copts = xnnpack_std_copts() + LOGGING_COPTS + [ |
| 771 | "-Isrc", |
| 772 | "-Iinclude", |
| 773 | ] + select({ |
| 774 | ":debug_build": [], |
| 775 | "//conditions:default": xnnpack_min_size_copts(), |
| 776 | }), |
| 777 | includes = ["include"], |
| 778 | linkstatic = True, |
| 779 | textual_hdrs = ["include/xnnpack.h"], |
| 780 | visibility = xnnpack_visibility(), |
| 781 | deps = [ |
| 782 | ":enable_assembly", |
| 783 | ":ukernels", |
| 784 | ":operator_run", |
| 785 | ":operators", |
| 786 | "@clog", |
| 787 | "@pthreadpool", |
Marat Dukhan | d343c22 | 2019-10-07 09:22:14 -0700 | [diff] [blame] | 788 | ] + select({ |
| 789 | ":emscripten": [], |
| 790 | "//conditions:default": ["@cpuinfo"], |
| 791 | }), |
Marat Dukhan | 08c4a43 | 2019-10-03 09:29:21 -0700 | [diff] [blame] | 792 | ) |
| 793 | |
| 794 | cc_library( |
Marat Dukhan | 8fe54e4 | 2019-10-10 14:12:59 -0700 | [diff] [blame] | 795 | name = "xnnpack_operators_nhwc_f32", |
| 796 | srcs = [ |
| 797 | "src/init.c", |
| 798 | ], |
| 799 | copts = xnnpack_std_copts() + LOGGING_COPTS + [ |
| 800 | "-Isrc", |
| 801 | "-Iinclude", |
| 802 | ] + select({ |
| 803 | ":debug_build": [], |
| 804 | "//conditions:default": xnnpack_min_size_copts(), |
| 805 | }), |
| 806 | defines = [ |
| 807 | "XNN_NO_Q8_OPERATORS", |
| 808 | "XNN_NO_U8_OPERATORS", |
| 809 | "XNN_NO_X8_OPERATORS", |
| 810 | "XNN_NO_SPNCHW_OPERATORS", |
| 811 | ], |
Marat Dukhan | 08c4a43 | 2019-10-03 09:29:21 -0700 | [diff] [blame] | 812 | includes = ["include"], |
| 813 | linkstatic = True, |
Marat Dukhan | 8fe54e4 | 2019-10-10 14:12:59 -0700 | [diff] [blame] | 814 | textual_hdrs = ["include/xnnpack.h"], |
Marat Dukhan | 08c4a43 | 2019-10-03 09:29:21 -0700 | [diff] [blame] | 815 | visibility = xnnpack_visibility(), |
| 816 | deps = [ |
Marat Dukhan | 8fe54e4 | 2019-10-10 14:12:59 -0700 | [diff] [blame] | 817 | ":enable_assembly", |
| 818 | ":ukernels", |
Marat Dukhan | 08c4a43 | 2019-10-03 09:29:21 -0700 | [diff] [blame] | 819 | ":operator_run", |
| 820 | ":operators", |
Marat Dukhan | 8fe54e4 | 2019-10-10 14:12:59 -0700 | [diff] [blame] | 821 | "@clog", |
Marat Dukhan | 08c4a43 | 2019-10-03 09:29:21 -0700 | [diff] [blame] | 822 | "@pthreadpool", |
Marat Dukhan | 8fe54e4 | 2019-10-10 14:12:59 -0700 | [diff] [blame] | 823 | ] + select({ |
| 824 | ":emscripten": [], |
| 825 | "//conditions:default": ["@cpuinfo"], |
| 826 | }), |
Marat Dukhan | 08c4a43 | 2019-10-03 09:29:21 -0700 | [diff] [blame] | 827 | ) |
| 828 | |
Marat Dukhan | cf056b2 | 2019-10-07 10:26:29 -0700 | [diff] [blame] | 829 | xnnpack_cc_library( |
Marat Dukhan | 08c4a43 | 2019-10-03 09:29:21 -0700 | [diff] [blame] | 830 | name = "bench_utils", |
| 831 | srcs = ["bench/utils.cc"], |
| 832 | hdrs = ["bench/utils.h"], |
| 833 | copts = ["-Wno-unused-result"], |
Marat Dukhan | 08c4a43 | 2019-10-03 09:29:21 -0700 | [diff] [blame] | 834 | deps = ["@cpuinfo"], |
| 835 | ) |
| 836 | |
Frank Barchard | 7e95597 | 2019-10-11 10:34:25 -0700 | [diff] [blame] | 837 | ######################### Benchmarks for micro-kernels ######################### |
Marat Dukhan | 08c4a43 | 2019-10-03 09:29:21 -0700 | [diff] [blame] | 838 | |
| 839 | xnnpack_benchmark( |
| 840 | name = "q8_gemm_bench", |
| 841 | srcs = [ |
| 842 | "bench/gemm.h", |
| 843 | "bench/q8-gemm.cc", |
| 844 | "src/xnnpack/AlignedAllocator.h", |
| 845 | ] + WEIGHTS_PACK_HDRS + MICROKERNEL_BENCHMARK_HDRS, |
| 846 | copts = ["-Wno-unused-function"] + xnnpack_optional_ruy_copts() + xnnpack_optional_gemmlowp_copts(), |
| 847 | deps = MICROKERNEL_BENCHMARK_DEPS + xnnpack_optional_ruy_deps() + xnnpack_optional_gemmlowp_deps(), |
| 848 | ) |
| 849 | |
| 850 | xnnpack_benchmark( |
| 851 | name = "f16_gemm_bench", |
| 852 | srcs = [ |
| 853 | "bench/f16-gemm.cc", |
| 854 | "bench/gemm.h", |
| 855 | "src/xnnpack/AlignedAllocator.h", |
| 856 | ] + WEIGHTS_PACK_HDRS + MICROKERNEL_BENCHMARK_HDRS, |
| 857 | copts = ["-Wno-unused-function"], |
| 858 | deps = MICROKERNEL_BENCHMARK_DEPS, |
| 859 | ) |
| 860 | |
| 861 | xnnpack_benchmark( |
| 862 | name = "f32_igemm_bench", |
| 863 | srcs = [ |
| 864 | "bench/f32-igemm.cc", |
| 865 | "bench/conv.h", |
| 866 | "src/xnnpack/AlignedAllocator.h", |
| 867 | ] + MICROKERNEL_BENCHMARK_HDRS, |
Frank Barchard | 7e95597 | 2019-10-11 10:34:25 -0700 | [diff] [blame] | 868 | deps = MICROKERNEL_BENCHMARK_DEPS + [":indirection"], |
Marat Dukhan | 08c4a43 | 2019-10-03 09:29:21 -0700 | [diff] [blame] | 869 | ) |
| 870 | |
| 871 | xnnpack_benchmark( |
| 872 | name = "f32_conv_hwc_bench", |
| 873 | srcs = [ |
| 874 | "bench/f32-conv-hwc.cc", |
| 875 | "bench/dconv.h", |
| 876 | "src/xnnpack/AlignedAllocator.h", |
| 877 | ] + WEIGHTS_PACK_HDRS + MICROKERNEL_BENCHMARK_HDRS, |
| 878 | copts = ["-Wno-unused-function"], |
| 879 | deps = MICROKERNEL_BENCHMARK_DEPS, |
| 880 | ) |
| 881 | |
| 882 | xnnpack_benchmark( |
| 883 | name = "f32_dwconv_bench", |
| 884 | srcs = [ |
| 885 | "bench/f32-dwconv.cc", |
| 886 | "bench/dwconv.h", |
| 887 | "src/xnnpack/AlignedAllocator.h", |
| 888 | ] + MICROKERNEL_BENCHMARK_HDRS, |
| 889 | deps = MICROKERNEL_BENCHMARK_DEPS + [":indirection"], |
| 890 | ) |
| 891 | |
| 892 | xnnpack_benchmark( |
| 893 | name = "f32_dwconv_spchw_bench", |
| 894 | srcs = [ |
| 895 | "bench/f32-dwconv-spchw.cc", |
| 896 | "bench/dwconv.h", |
| 897 | "src/xnnpack/AlignedAllocator.h", |
| 898 | ] + WEIGHTS_PACK_HDRS + MICROKERNEL_BENCHMARK_HDRS, |
| 899 | deps = MICROKERNEL_BENCHMARK_DEPS + [":indirection"], |
| 900 | ) |
| 901 | |
| 902 | xnnpack_benchmark( |
| 903 | name = "f32_gemm_bench", |
| 904 | srcs = [ |
| 905 | "bench/f32-gemm.cc", |
| 906 | "bench/gemm.h", |
| 907 | "src/xnnpack/AlignedAllocator.h", |
| 908 | ] + WEIGHTS_PACK_HDRS + MICROKERNEL_BENCHMARK_HDRS, |
| 909 | copts = ["-Wno-unused-function"] + xnnpack_optional_ruy_copts(), |
Frank Barchard | 7e95597 | 2019-10-11 10:34:25 -0700 | [diff] [blame] | 910 | deps = MICROKERNEL_BENCHMARK_DEPS + xnnpack_optional_ruy_deps(), |
Marat Dukhan | 08c4a43 | 2019-10-03 09:29:21 -0700 | [diff] [blame] | 911 | ) |
| 912 | |
| 913 | xnnpack_benchmark( |
| 914 | name = "f32_rmax_bench", |
| 915 | srcs = [ |
| 916 | "bench/f32-rmax.cc", |
| 917 | "src/xnnpack/AlignedAllocator.h", |
| 918 | ] + MICROKERNEL_BENCHMARK_HDRS, |
| 919 | deps = MICROKERNEL_BENCHMARK_DEPS, |
| 920 | ) |
| 921 | |
| 922 | xnnpack_benchmark( |
| 923 | name = "f32_spmm_bench", |
| 924 | srcs = [ |
| 925 | "bench/f32-spmm.cc", |
| 926 | "bench/gemm.h", |
| 927 | "src/xnnpack/AlignedAllocator.h", |
| 928 | ] + MICROKERNEL_BENCHMARK_HDRS, |
| 929 | copts = ["-Wno-unused-function"], |
| 930 | deps = MICROKERNEL_BENCHMARK_DEPS, |
| 931 | ) |
| 932 | |
| 933 | xnnpack_benchmark( |
| 934 | name = "f32_im2col_gemm_bench", |
| 935 | srcs = [ |
| 936 | "bench/f32-im2col-gemm.cc", |
| 937 | "bench/conv.h", |
| 938 | "src/xnnpack/AlignedAllocator.h", |
| 939 | ] + WEIGHTS_PACK_HDRS + MICROKERNEL_BENCHMARK_HDRS, |
| 940 | deps = MICROKERNEL_BENCHMARK_DEPS + [":im2col"], |
| 941 | ) |
| 942 | |
| 943 | ########################### Benchmarks for operators ########################### |
| 944 | |
| 945 | xnnpack_benchmark( |
| 946 | name = "add_bench", |
| 947 | srcs = ["bench/add.cc"], |
| 948 | deps = OPERATOR_BENCHMARK_DEPS, |
| 949 | ) |
| 950 | |
| 951 | xnnpack_benchmark( |
| 952 | name = "average_pooling_bench", |
| 953 | srcs = ["bench/average-pooling.cc"], |
| 954 | deps = OPERATOR_BENCHMARK_DEPS, |
| 955 | ) |
| 956 | |
| 957 | xnnpack_benchmark( |
| 958 | name = "channel_shuffle_bench", |
| 959 | srcs = ["bench/channel-shuffle.cc"], |
| 960 | deps = OPERATOR_BENCHMARK_DEPS, |
| 961 | ) |
| 962 | |
| 963 | xnnpack_benchmark( |
| 964 | name = "convolution_bench", |
| 965 | srcs = ["bench/convolution.cc"], |
| 966 | copts = xnnpack_optional_tflite_copts() + xnnpack_optional_armcl_copts(), |
| 967 | deps = OPERATOR_BENCHMARK_DEPS + xnnpack_optional_tflite_deps() + xnnpack_optional_armcl_deps(), |
| 968 | ) |
| 969 | |
| 970 | xnnpack_benchmark( |
| 971 | name = "deconvolution_bench", |
| 972 | srcs = ["bench/deconvolution.cc"], |
| 973 | copts = xnnpack_optional_tflite_copts(), |
| 974 | deps = OPERATOR_BENCHMARK_DEPS + xnnpack_optional_tflite_deps(), |
| 975 | ) |
| 976 | |
| 977 | xnnpack_benchmark( |
| 978 | name = "global_average_pooling_bench", |
| 979 | srcs = ["bench/global-average-pooling.cc"], |
| 980 | deps = OPERATOR_BENCHMARK_DEPS, |
| 981 | ) |
| 982 | |
| 983 | xnnpack_benchmark( |
| 984 | name = "max_pooling_bench", |
| 985 | srcs = ["bench/max-pooling.cc"], |
| 986 | deps = OPERATOR_BENCHMARK_DEPS, |
| 987 | ) |
| 988 | |
| 989 | xnnpack_benchmark( |
| 990 | name = "sigmoid_bench", |
| 991 | srcs = ["bench/sigmoid.cc"], |
| 992 | deps = OPERATOR_BENCHMARK_DEPS, |
| 993 | ) |
| 994 | |
| 995 | xnnpack_benchmark( |
| 996 | name = "softargmax_bench", |
| 997 | srcs = ["bench/softargmax.cc"], |
| 998 | deps = OPERATOR_BENCHMARK_DEPS, |
| 999 | ) |
| 1000 | |
Marat Dukhan | c068bb6 | 2019-10-04 13:24:39 -0700 | [diff] [blame] | 1001 | ############################# End-to-end benchmarks ############################ |
| 1002 | |
| 1003 | cc_library( |
| 1004 | name = "mobilenet_v1", |
| 1005 | srcs = ["models/mobilenet-v1.cc"], |
| 1006 | hdrs = ["models/models.h"], |
| 1007 | linkstatic = True, |
| 1008 | deps = [ |
| 1009 | ":XNNPACK", |
| 1010 | "@pthreadpool", |
| 1011 | ], |
| 1012 | ) |
| 1013 | |
| 1014 | cc_library( |
| 1015 | name = "mobilenet_v2", |
| 1016 | srcs = ["models/mobilenet-v2.cc"], |
| 1017 | hdrs = ["models/models.h"], |
| 1018 | linkstatic = True, |
| 1019 | deps = [ |
| 1020 | ":XNNPACK", |
| 1021 | "@pthreadpool", |
| 1022 | ], |
| 1023 | ) |
| 1024 | |
| 1025 | xnnpack_benchmark( |
| 1026 | name = "end2end_bench", |
| 1027 | srcs = ["bench/end2end.cc"], |
| 1028 | deps = [ |
| 1029 | ":XNNPACK", |
| 1030 | ":mobilenet_v1", |
| 1031 | ":mobilenet_v2", |
| 1032 | "@pthreadpool", |
| 1033 | ], |
| 1034 | ) |
| 1035 | |
Marat Dukhan | 6adff4e | 2019-10-14 18:32:07 -0700 | [diff] [blame] | 1036 | #################### Accuracy evaluation for math functions #################### |
| 1037 | |
| 1038 | xnnpack_benchmark( |
| 1039 | name = "f32_exp_eval", |
| 1040 | srcs = [ |
| 1041 | "eval/f32-exp.cc", |
| 1042 | "src/xnnpack/AlignedAllocator.h", |
| 1043 | ] + ACCURACY_EVAL_HDRS, |
| 1044 | deps = ACCURACY_EVAL_DEPS, |
| 1045 | ) |
| 1046 | |
Marat Dukhan | 08c4a43 | 2019-10-03 09:29:21 -0700 | [diff] [blame] | 1047 | ######################### Unit tests for micro-kernels ######################### |
| 1048 | |
| 1049 | xnnpack_unit_test( |
| 1050 | name = "f16_gemm_test", |
| 1051 | srcs = [ |
| 1052 | "test/f16-gemm.cc", |
| 1053 | "test/gemm-microkernel-tester.h", |
| 1054 | "src/xnnpack/AlignedAllocator.h", |
| 1055 | ] + WEIGHTS_PACK_HDRS + MICROKERNEL_TEST_HDRS, |
| 1056 | deps = MICROKERNEL_TEST_DEPS, |
| 1057 | ) |
| 1058 | |
| 1059 | xnnpack_unit_test( |
| 1060 | name = "f32_argmaxpool_test", |
| 1061 | srcs = [ |
| 1062 | "test/f32-argmaxpool.cc", |
| 1063 | "test/argmaxpool-microkernel-tester.h", |
| 1064 | "src/xnnpack/AlignedAllocator.h", |
| 1065 | ] + MICROKERNEL_TEST_HDRS, |
| 1066 | deps = MICROKERNEL_TEST_DEPS, |
| 1067 | ) |
| 1068 | |
| 1069 | xnnpack_unit_test( |
| 1070 | name = "f32_avgpool_test", |
| 1071 | srcs = [ |
| 1072 | "test/f32-avgpool.cc", |
| 1073 | "test/avgpool-microkernel-tester.h", |
| 1074 | "src/xnnpack/AlignedAllocator.h", |
| 1075 | ] + MICROKERNEL_TEST_HDRS, |
| 1076 | deps = MICROKERNEL_TEST_DEPS, |
| 1077 | ) |
| 1078 | |
| 1079 | xnnpack_unit_test( |
| 1080 | name = "f32_clamp_test", |
| 1081 | srcs = [ |
| 1082 | "test/f32-clamp.cc", |
| 1083 | "test/clamp-microkernel-tester.h", |
| 1084 | ] + MICROKERNEL_TEST_HDRS, |
| 1085 | deps = MICROKERNEL_TEST_DEPS, |
| 1086 | ) |
| 1087 | |
| 1088 | xnnpack_unit_test( |
| 1089 | name = "f32_igemm_test", |
| 1090 | srcs = [ |
| 1091 | "test/f32-igemm.cc", |
| 1092 | "test/gemm-microkernel-tester.h", |
| 1093 | "src/xnnpack/AlignedAllocator.h", |
| 1094 | ] + WEIGHTS_PACK_HDRS + MICROKERNEL_TEST_HDRS, |
| 1095 | deps = MICROKERNEL_TEST_DEPS, |
| 1096 | ) |
| 1097 | |
| 1098 | xnnpack_unit_test( |
| 1099 | name = "f32_conv_hwc_test", |
| 1100 | srcs = [ |
| 1101 | "test/f32-conv-hwc.cc", |
| 1102 | "test/conv-hwc-microkernel-tester.h", |
| 1103 | "src/xnnpack/AlignedAllocator.h", |
| 1104 | ] + WEIGHTS_PACK_HDRS + MICROKERNEL_TEST_HDRS, |
| 1105 | deps = MICROKERNEL_TEST_DEPS, |
| 1106 | ) |
| 1107 | |
| 1108 | xnnpack_unit_test( |
| 1109 | name = "f32_conv_hwc2spchw_test", |
| 1110 | srcs = [ |
| 1111 | "test/f32-conv-hwc2spchw.cc", |
| 1112 | "test/conv-hwc2spchw-microkernel-tester.h", |
| 1113 | "src/xnnpack/AlignedAllocator.h", |
| 1114 | ] + WEIGHTS_PACK_HDRS + MICROKERNEL_TEST_HDRS, |
| 1115 | deps = MICROKERNEL_TEST_DEPS, |
| 1116 | ) |
| 1117 | |
| 1118 | xnnpack_unit_test( |
| 1119 | name = "f32_dwconv_test", |
| 1120 | srcs = [ |
| 1121 | "test/f32-dwconv.cc", |
| 1122 | "test/dwconv-microkernel-tester.h", |
| 1123 | "src/xnnpack/AlignedAllocator.h", |
| 1124 | ] + WEIGHTS_PACK_HDRS + MICROKERNEL_TEST_HDRS, |
| 1125 | deps = MICROKERNEL_TEST_DEPS, |
| 1126 | ) |
| 1127 | |
| 1128 | xnnpack_unit_test( |
| 1129 | name = "f32_dwconv_spchw_test", |
| 1130 | srcs = [ |
| 1131 | "test/f32-dwconv-spchw.cc", |
| 1132 | "test/dwconv-spchw-microkernel-tester.h", |
| 1133 | "src/xnnpack/AlignedAllocator.h", |
| 1134 | ] + WEIGHTS_PACK_HDRS + MICROKERNEL_TEST_HDRS, |
| 1135 | deps = MICROKERNEL_TEST_DEPS, |
| 1136 | ) |
| 1137 | |
| 1138 | xnnpack_unit_test( |
| 1139 | name = "f32_gavgpool_test", |
| 1140 | srcs = [ |
| 1141 | "test/f32-gavgpool.cc", |
| 1142 | "test/gavgpool-microkernel-tester.h", |
| 1143 | "src/xnnpack/AlignedAllocator.h", |
| 1144 | ] + MICROKERNEL_TEST_HDRS, |
| 1145 | deps = MICROKERNEL_TEST_DEPS, |
| 1146 | ) |
| 1147 | |
| 1148 | xnnpack_unit_test( |
| 1149 | name = "f32_gavgpool_spchw_test", |
| 1150 | srcs = [ |
| 1151 | "test/f32-gavgpool-spchw.cc", |
| 1152 | "test/gavgpool-spchw-microkernel-tester.h", |
| 1153 | "src/xnnpack/AlignedAllocator.h", |
| 1154 | ] + MICROKERNEL_TEST_HDRS, |
| 1155 | deps = MICROKERNEL_TEST_DEPS, |
| 1156 | ) |
| 1157 | |
| 1158 | xnnpack_unit_test( |
| 1159 | name = "f32_gemm_test", |
| 1160 | srcs = [ |
| 1161 | "test/f32-gemm.cc", |
| 1162 | "test/gemm-microkernel-tester.h", |
| 1163 | "src/xnnpack/AlignedAllocator.h", |
| 1164 | ] + WEIGHTS_PACK_HDRS + MICROKERNEL_TEST_HDRS, |
| 1165 | deps = MICROKERNEL_TEST_DEPS, |
| 1166 | ) |
| 1167 | |
| 1168 | xnnpack_unit_test( |
| 1169 | name = "f32_gemminc_test", |
| 1170 | srcs = [ |
| 1171 | "test/f32-gemminc.cc", |
| 1172 | "test/gemm-microkernel-tester.h", |
| 1173 | "src/xnnpack/AlignedAllocator.h", |
| 1174 | ] + WEIGHTS_PACK_HDRS + MICROKERNEL_TEST_HDRS, |
| 1175 | deps = MICROKERNEL_TEST_DEPS, |
| 1176 | ) |
| 1177 | |
| 1178 | xnnpack_unit_test( |
| 1179 | name = "f32_hswish_test", |
| 1180 | srcs = [ |
| 1181 | "test/f32-hswish.cc", |
| 1182 | "test/hswish-microkernel-tester.h", |
| 1183 | ] + MICROKERNEL_TEST_HDRS, |
| 1184 | deps = MICROKERNEL_TEST_DEPS, |
| 1185 | ) |
| 1186 | |
| 1187 | xnnpack_unit_test( |
| 1188 | name = "f32_maxpool_test", |
| 1189 | srcs = [ |
| 1190 | "test/f32-maxpool.cc", |
| 1191 | "test/maxpool-microkernel-tester.h", |
| 1192 | ] + MICROKERNEL_TEST_HDRS, |
| 1193 | deps = MICROKERNEL_TEST_DEPS, |
| 1194 | ) |
| 1195 | |
| 1196 | xnnpack_unit_test( |
| 1197 | name = "f32_pavgpool_test", |
| 1198 | srcs = [ |
| 1199 | "test/f32-pavgpool.cc", |
| 1200 | "test/avgpool-microkernel-tester.h", |
| 1201 | "src/xnnpack/AlignedAllocator.h", |
| 1202 | ] + MICROKERNEL_TEST_HDRS, |
| 1203 | deps = MICROKERNEL_TEST_DEPS, |
| 1204 | ) |
| 1205 | |
| 1206 | xnnpack_unit_test( |
| 1207 | name = "f32_ppmm_test", |
| 1208 | srcs = [ |
| 1209 | "test/f32-ppmm.cc", |
| 1210 | "test/gemm-microkernel-tester.h", |
| 1211 | "src/xnnpack/AlignedAllocator.h", |
| 1212 | ] + WEIGHTS_PACK_HDRS + MICROKERNEL_TEST_HDRS, |
| 1213 | deps = MICROKERNEL_TEST_DEPS, |
| 1214 | ) |
| 1215 | |
| 1216 | xnnpack_unit_test( |
| 1217 | name = "f32_prelu_test", |
| 1218 | srcs = [ |
| 1219 | "test/f32-prelu.cc", |
| 1220 | "test/prelu-microkernel-tester.h", |
| 1221 | "src/xnnpack/AlignedAllocator.h", |
| 1222 | ] + MICROKERNEL_TEST_HDRS, |
| 1223 | deps = MICROKERNEL_TEST_DEPS, |
| 1224 | ) |
| 1225 | |
| 1226 | xnnpack_unit_test( |
| 1227 | name = "f32_rmax_test", |
| 1228 | srcs = [ |
| 1229 | "test/f32-rmax.cc", |
| 1230 | "test/rmax-microkernel-tester.h", |
| 1231 | ] + MICROKERNEL_TEST_HDRS, |
| 1232 | deps = MICROKERNEL_TEST_DEPS, |
| 1233 | ) |
| 1234 | |
| 1235 | xnnpack_unit_test( |
| 1236 | name = "f32_spmm_test", |
| 1237 | srcs = [ |
| 1238 | "test/f32-spmm.cc", |
| 1239 | "test/spmm-microkernel-tester.h", |
| 1240 | "src/xnnpack/AlignedAllocator.h", |
| 1241 | ] + MICROKERNEL_TEST_HDRS, |
| 1242 | deps = MICROKERNEL_TEST_DEPS, |
| 1243 | ) |
| 1244 | |
| 1245 | xnnpack_unit_test( |
| 1246 | name = "f32_vadd_test", |
| 1247 | srcs = [ |
| 1248 | "test/f32-vadd.cc", |
| 1249 | "test/vadd-microkernel-tester.h", |
| 1250 | ] + MICROKERNEL_TEST_HDRS, |
| 1251 | deps = MICROKERNEL_TEST_DEPS, |
| 1252 | ) |
| 1253 | |
| 1254 | xnnpack_unit_test( |
| 1255 | name = "f32_vsub_test", |
| 1256 | srcs = [ |
| 1257 | "test/f32-vsub.cc", |
| 1258 | "test/vsub-microkernel-tester.h", |
| 1259 | ] + MICROKERNEL_TEST_HDRS, |
| 1260 | deps = MICROKERNEL_TEST_DEPS, |
| 1261 | ) |
| 1262 | |
| 1263 | xnnpack_unit_test( |
| 1264 | name = "f32_vmul_test", |
| 1265 | srcs = [ |
| 1266 | "test/f32-vmul.cc", |
| 1267 | "test/vmul-microkernel-tester.h", |
| 1268 | ] + MICROKERNEL_TEST_HDRS, |
| 1269 | deps = MICROKERNEL_TEST_DEPS, |
| 1270 | ) |
| 1271 | |
| 1272 | xnnpack_unit_test( |
| 1273 | name = "f32_vmulcaddc_test", |
| 1274 | srcs = [ |
| 1275 | "test/f32-vmulcaddc.cc", |
| 1276 | "test/vmulcaddc-microkernel-tester.h", |
| 1277 | "src/xnnpack/AlignedAllocator.h", |
| 1278 | ] + WEIGHTS_PACK_HDRS + MICROKERNEL_TEST_HDRS, |
| 1279 | deps = MICROKERNEL_TEST_DEPS, |
| 1280 | ) |
| 1281 | |
| 1282 | xnnpack_unit_test( |
| 1283 | name = "q8_avgpool_test", |
| 1284 | srcs = [ |
| 1285 | "test/q8-avgpool.cc", |
| 1286 | "test/avgpool-microkernel-tester.h", |
| 1287 | "src/xnnpack/AlignedAllocator.h", |
| 1288 | ] + MICROKERNEL_TEST_HDRS, |
| 1289 | deps = MICROKERNEL_TEST_DEPS, |
| 1290 | ) |
| 1291 | |
| 1292 | xnnpack_unit_test( |
| 1293 | name = "q8_igemm_test", |
| 1294 | srcs = [ |
| 1295 | "test/q8-igemm.cc", |
| 1296 | "test/gemm-microkernel-tester.h", |
| 1297 | "src/xnnpack/AlignedAllocator.h", |
| 1298 | ] + WEIGHTS_PACK_HDRS + MICROKERNEL_TEST_HDRS, |
| 1299 | deps = MICROKERNEL_TEST_DEPS, |
| 1300 | ) |
| 1301 | |
| 1302 | xnnpack_unit_test( |
| 1303 | name = "q8_dwconv_test", |
| 1304 | srcs = [ |
| 1305 | "test/q8-dwconv.cc", |
| 1306 | "test/dwconv-microkernel-tester.h", |
| 1307 | "src/xnnpack/AlignedAllocator.h", |
| 1308 | ] + WEIGHTS_PACK_HDRS + MICROKERNEL_TEST_HDRS, |
| 1309 | deps = MICROKERNEL_TEST_DEPS, |
| 1310 | ) |
| 1311 | |
| 1312 | xnnpack_unit_test( |
| 1313 | name = "q8_gavgpool_test", |
| 1314 | srcs = [ |
| 1315 | "test/q8-gavgpool.cc", |
| 1316 | "test/gavgpool-microkernel-tester.h", |
| 1317 | "src/xnnpack/AlignedAllocator.h", |
| 1318 | ] + MICROKERNEL_TEST_HDRS, |
| 1319 | deps = MICROKERNEL_TEST_DEPS, |
| 1320 | ) |
| 1321 | |
| 1322 | xnnpack_unit_test( |
| 1323 | name = "q8_gemm_test", |
| 1324 | srcs = [ |
| 1325 | "test/q8-gemm.cc", |
| 1326 | "test/gemm-microkernel-tester.h", |
| 1327 | "src/xnnpack/AlignedAllocator.h", |
| 1328 | ] + WEIGHTS_PACK_HDRS + MICROKERNEL_TEST_HDRS, |
| 1329 | deps = MICROKERNEL_TEST_DEPS, |
| 1330 | ) |
| 1331 | |
| 1332 | xnnpack_unit_test( |
| 1333 | name = "q8_vadd_test", |
| 1334 | srcs = [ |
| 1335 | "test/q8-vadd.cc", |
| 1336 | "test/vadd-microkernel-tester.h", |
| 1337 | ] + MICROKERNEL_TEST_HDRS, |
| 1338 | deps = MICROKERNEL_TEST_DEPS, |
| 1339 | ) |
| 1340 | |
| 1341 | xnnpack_unit_test( |
| 1342 | name = "u8_clamp_test", |
| 1343 | srcs = [ |
| 1344 | "test/u8-clamp.cc", |
| 1345 | "test/clamp-microkernel-tester.h", |
| 1346 | ] + MICROKERNEL_TEST_HDRS, |
| 1347 | deps = MICROKERNEL_TEST_DEPS, |
| 1348 | ) |
| 1349 | |
| 1350 | xnnpack_unit_test( |
| 1351 | name = "u8_lut32norm_test", |
| 1352 | srcs = [ |
| 1353 | "test/u8-lut32norm.cc", |
| 1354 | "test/lut-norm-microkernel-tester.h", |
| 1355 | ] + MICROKERNEL_TEST_HDRS, |
| 1356 | deps = MICROKERNEL_TEST_DEPS, |
| 1357 | ) |
| 1358 | |
| 1359 | xnnpack_unit_test( |
| 1360 | name = "u8_maxpool_test", |
| 1361 | srcs = [ |
| 1362 | "test/u8-maxpool.cc", |
| 1363 | "test/maxpool-microkernel-tester.h", |
| 1364 | ] + MICROKERNEL_TEST_HDRS, |
| 1365 | deps = MICROKERNEL_TEST_DEPS, |
| 1366 | ) |
| 1367 | |
| 1368 | xnnpack_unit_test( |
| 1369 | name = "u8_rmax_test", |
| 1370 | srcs = [ |
| 1371 | "test/u8-rmax.cc", |
| 1372 | "test/rmax-microkernel-tester.h", |
| 1373 | ] + MICROKERNEL_TEST_HDRS, |
| 1374 | deps = MICROKERNEL_TEST_DEPS, |
| 1375 | ) |
| 1376 | |
| 1377 | xnnpack_unit_test( |
| 1378 | name = "x32_packx_test", |
| 1379 | srcs = [ |
| 1380 | "test/x32-packx.cc", |
| 1381 | "test/pack-microkernel-tester.h", |
| 1382 | "src/xnnpack/AlignedAllocator.h", |
| 1383 | ] + MICROKERNEL_TEST_HDRS, |
| 1384 | deps = MICROKERNEL_TEST_DEPS, |
| 1385 | ) |
| 1386 | |
| 1387 | xnnpack_unit_test( |
| 1388 | name = "x32_pad_test", |
| 1389 | srcs = [ |
| 1390 | "test/x32-pad.cc", |
| 1391 | "test/pad-microkernel-tester.h", |
| 1392 | ] + MICROKERNEL_TEST_HDRS, |
| 1393 | deps = MICROKERNEL_TEST_DEPS, |
| 1394 | ) |
| 1395 | |
| 1396 | xnnpack_unit_test( |
| 1397 | name = "x32_unpool_test", |
| 1398 | srcs = [ |
| 1399 | "test/x32-unpool.cc", |
| 1400 | "test/unpool-microkernel-tester.h", |
| 1401 | ] + MICROKERNEL_TEST_HDRS, |
| 1402 | deps = MICROKERNEL_TEST_DEPS, |
| 1403 | ) |
| 1404 | |
| 1405 | xnnpack_unit_test( |
| 1406 | name = "x32_zip_test", |
| 1407 | srcs = [ |
| 1408 | "test/x32-zip.cc", |
| 1409 | "test/zip-microkernel-tester.h", |
| 1410 | ] + MICROKERNEL_TEST_HDRS, |
| 1411 | deps = MICROKERNEL_TEST_DEPS, |
| 1412 | ) |
| 1413 | |
| 1414 | xnnpack_unit_test( |
| 1415 | name = "x8_lut_test", |
| 1416 | srcs = [ |
| 1417 | "test/x8-lut.cc", |
| 1418 | "test/lut-microkernel-tester.h", |
| 1419 | ] + MICROKERNEL_TEST_HDRS, |
| 1420 | deps = MICROKERNEL_TEST_DEPS, |
| 1421 | ) |
| 1422 | |
| 1423 | xnnpack_unit_test( |
| 1424 | name = "x8_zip_test", |
| 1425 | srcs = [ |
| 1426 | "test/x8-zip.cc", |
| 1427 | "test/zip-microkernel-tester.h", |
| 1428 | ] + MICROKERNEL_TEST_HDRS, |
| 1429 | deps = MICROKERNEL_TEST_DEPS, |
| 1430 | ) |
| 1431 | |
| 1432 | ########################### Size test for the library ########################## |
| 1433 | |
| 1434 | xnnpack_binary( |
| 1435 | name = "size_test", |
| 1436 | srcs = ["test/size.c"], |
Marat Dukhan | 8fe54e4 | 2019-10-10 14:12:59 -0700 | [diff] [blame] | 1437 | deps = [":xnnpack_operators_nhwc_f32"], |
Marat Dukhan | 08c4a43 | 2019-10-03 09:29:21 -0700 | [diff] [blame] | 1438 | ) |
| 1439 | |
| 1440 | ########################### Unit tests for operators ########################### |
| 1441 | |
| 1442 | xnnpack_unit_test( |
| 1443 | name = "add_test", |
| 1444 | srcs = [ |
| 1445 | "test/add.cc", |
| 1446 | "test/add-operator-tester.h", |
| 1447 | ], |
| 1448 | deps = OPERATOR_TEST_DEPS, |
| 1449 | ) |
| 1450 | |
| 1451 | xnnpack_unit_test( |
| 1452 | name = "argmax_pooling_test", |
| 1453 | srcs = [ |
| 1454 | "test/argmax-pooling.cc", |
| 1455 | "test/argmax-pooling-operator-tester.h", |
| 1456 | ] + OPERATOR_TEST_PARAMS_HDRS, |
| 1457 | deps = OPERATOR_TEST_DEPS, |
| 1458 | ) |
| 1459 | |
| 1460 | xnnpack_unit_test( |
| 1461 | name = "average_pooling_test", |
| 1462 | srcs = [ |
| 1463 | "test/average-pooling.cc", |
| 1464 | "test/average-pooling-operator-tester.h", |
| 1465 | ] + OPERATOR_TEST_PARAMS_HDRS, |
| 1466 | deps = OPERATOR_TEST_DEPS, |
| 1467 | ) |
| 1468 | |
| 1469 | xnnpack_unit_test( |
| 1470 | name = "channel_pad_test", |
| 1471 | srcs = [ |
| 1472 | "test/channel-pad.cc", |
| 1473 | "test/channel-pad-operator-tester.h", |
| 1474 | ] + OPERATOR_TEST_PARAMS_HDRS, |
| 1475 | deps = OPERATOR_TEST_DEPS, |
| 1476 | ) |
| 1477 | |
| 1478 | xnnpack_unit_test( |
| 1479 | name = "channel_shuffle_test", |
| 1480 | srcs = [ |
| 1481 | "test/channel-shuffle.cc", |
| 1482 | "test/channel-shuffle-operator-tester.h", |
| 1483 | ], |
| 1484 | deps = OPERATOR_TEST_DEPS, |
| 1485 | ) |
| 1486 | |
| 1487 | xnnpack_unit_test( |
| 1488 | name = "clamp_test", |
| 1489 | srcs = [ |
| 1490 | "test/clamp.cc", |
| 1491 | "test/clamp-operator-tester.h", |
| 1492 | ], |
| 1493 | deps = OPERATOR_TEST_DEPS, |
| 1494 | ) |
| 1495 | |
| 1496 | xnnpack_unit_test( |
| 1497 | name = "convolution_test", |
| 1498 | srcs = [ |
| 1499 | "test/convolution.cc", |
| 1500 | "test/convolution-operator-tester.h", |
| 1501 | ], |
| 1502 | deps = OPERATOR_TEST_DEPS, |
| 1503 | ) |
| 1504 | |
| 1505 | xnnpack_unit_test( |
| 1506 | name = "convolution_spnchw_test", |
| 1507 | srcs = [ |
| 1508 | "test/convolution-spnchw.cc", |
| 1509 | "test/convolution-spnchw-operator-tester.h", |
| 1510 | ], |
| 1511 | deps = OPERATOR_TEST_DEPS, |
| 1512 | ) |
| 1513 | |
| 1514 | xnnpack_unit_test( |
| 1515 | name = "deconvolution_test", |
| 1516 | srcs = [ |
| 1517 | "test/deconvolution.cc", |
| 1518 | "test/deconvolution-operator-tester.h", |
| 1519 | ] + OPERATOR_TEST_PARAMS_HDRS, |
| 1520 | deps = OPERATOR_TEST_DEPS, |
| 1521 | ) |
| 1522 | |
| 1523 | xnnpack_unit_test( |
| 1524 | name = "fully_connected_test", |
| 1525 | srcs = [ |
| 1526 | "test/fully-connected.cc", |
| 1527 | "test/fully-connected-operator-tester.h", |
| 1528 | ], |
| 1529 | deps = OPERATOR_TEST_DEPS, |
| 1530 | ) |
| 1531 | |
| 1532 | xnnpack_unit_test( |
| 1533 | name = "global_average_pooling_test", |
| 1534 | srcs = [ |
| 1535 | "test/global-average-pooling.cc", |
| 1536 | "test/global-average-pooling-operator-tester.h", |
| 1537 | ] + OPERATOR_TEST_PARAMS_HDRS, |
| 1538 | deps = OPERATOR_TEST_DEPS, |
| 1539 | ) |
| 1540 | |
| 1541 | xnnpack_unit_test( |
| 1542 | name = "global_average_pooling_spnchw_test", |
| 1543 | srcs = [ |
| 1544 | "test/global-average-pooling-spnchw.cc", |
| 1545 | "test/global-average-pooling-spnchw-operator-tester.h", |
| 1546 | ], |
| 1547 | deps = OPERATOR_TEST_DEPS, |
| 1548 | ) |
| 1549 | |
| 1550 | xnnpack_unit_test( |
| 1551 | name = "hardswish_test", |
| 1552 | srcs = [ |
| 1553 | "test/hardswish.cc", |
| 1554 | "test/hardswish-operator-tester.h", |
| 1555 | ], |
| 1556 | deps = OPERATOR_TEST_DEPS, |
| 1557 | ) |
| 1558 | |
| 1559 | xnnpack_unit_test( |
| 1560 | name = "leaky_relu_test", |
| 1561 | srcs = [ |
| 1562 | "test/leaky-relu.cc", |
| 1563 | "test/leaky-relu-operator-tester.h", |
| 1564 | ], |
| 1565 | deps = OPERATOR_TEST_DEPS, |
| 1566 | ) |
| 1567 | |
| 1568 | xnnpack_unit_test( |
| 1569 | name = "max_pooling_test", |
| 1570 | srcs = [ |
| 1571 | "test/max-pooling.cc", |
| 1572 | "test/max-pooling-operator-tester.h", |
| 1573 | ] + OPERATOR_TEST_PARAMS_HDRS, |
| 1574 | deps = OPERATOR_TEST_DEPS, |
| 1575 | ) |
| 1576 | |
| 1577 | xnnpack_unit_test( |
| 1578 | name = "prelu_test", |
| 1579 | srcs = [ |
| 1580 | "test/prelu.cc", |
| 1581 | "test/prelu-operator-tester.h", |
| 1582 | ] + OPERATOR_TEST_PARAMS_HDRS, |
| 1583 | deps = OPERATOR_TEST_DEPS, |
| 1584 | ) |
| 1585 | |
| 1586 | xnnpack_unit_test( |
| 1587 | name = "sigmoid_test", |
| 1588 | srcs = [ |
| 1589 | "test/sigmoid.cc", |
| 1590 | "test/sigmoid-operator-tester.h", |
| 1591 | ], |
| 1592 | deps = OPERATOR_TEST_DEPS, |
| 1593 | ) |
| 1594 | |
| 1595 | xnnpack_unit_test( |
| 1596 | name = "softargmax_test", |
| 1597 | srcs = [ |
| 1598 | "test/softargmax.cc", |
| 1599 | "test/softargmax-operator-tester.h", |
| 1600 | ], |
| 1601 | deps = OPERATOR_TEST_DEPS, |
| 1602 | ) |
| 1603 | |
| 1604 | xnnpack_unit_test( |
| 1605 | name = "unpooling_test", |
| 1606 | srcs = [ |
| 1607 | "test/unpooling.cc", |
| 1608 | "test/unpooling-operator-tester.h", |
| 1609 | ], |
| 1610 | deps = OPERATOR_TEST_DEPS, |
| 1611 | ) |
| 1612 | |
| 1613 | ############################# Build configurations ############################# |
| 1614 | |
| 1615 | config_setting( |
| 1616 | name = "linux_k8", |
| 1617 | values = { |
| 1618 | "cpu": "k8", |
| 1619 | }, |
| 1620 | ) |
| 1621 | |
| 1622 | config_setting( |
Marat Dukhan | 4e45e66 | 2019-10-03 15:40:24 -0700 | [diff] [blame] | 1623 | name = "linux_aarch64", |
| 1624 | values = { |
| 1625 | "cpu": "aarch64", |
| 1626 | }, |
| 1627 | ) |
| 1628 | |
| 1629 | config_setting( |
Marat Dukhan | 08c4a43 | 2019-10-03 09:29:21 -0700 | [diff] [blame] | 1630 | name = "android", |
| 1631 | values = {"crosstool_top": "//external:android/crosstool"}, |
| 1632 | ) |
| 1633 | |
| 1634 | config_setting( |
| 1635 | name = "android_armv7", |
| 1636 | values = { |
| 1637 | "crosstool_top": "//external:android/crosstool", |
| 1638 | "cpu": "armeabi-v7a", |
| 1639 | }, |
| 1640 | ) |
| 1641 | |
| 1642 | config_setting( |
| 1643 | name = "android_arm64", |
| 1644 | values = { |
| 1645 | "crosstool_top": "//external:android/crosstool", |
| 1646 | "cpu": "arm64-v8a", |
| 1647 | }, |
| 1648 | ) |
| 1649 | |
| 1650 | config_setting( |
| 1651 | name = "android_x86", |
| 1652 | values = { |
| 1653 | "crosstool_top": "//external:android/crosstool", |
| 1654 | "cpu": "x86", |
| 1655 | }, |
| 1656 | ) |
| 1657 | |
| 1658 | config_setting( |
| 1659 | name = "android_x86_64", |
| 1660 | values = { |
| 1661 | "crosstool_top": "//external:android/crosstool", |
| 1662 | "cpu": "x86_64", |
| 1663 | }, |
| 1664 | ) |
| 1665 | |
| 1666 | config_setting( |
Marat Dukhan | 885ca24 | 2019-10-07 09:17:32 -0700 | [diff] [blame] | 1667 | name = "macos_x86_64", |
| 1668 | values = { |
| 1669 | "apple_platform_type": "macos", |
| 1670 | "cpu": "darwin", |
| 1671 | }, |
| 1672 | ) |
| 1673 | |
| 1674 | config_setting( |
Marat Dukhan | 08c4a43 | 2019-10-03 09:29:21 -0700 | [diff] [blame] | 1675 | name = "emscripten", |
Marat Dukhan | 1a729ec | 2019-10-07 09:31:44 -0700 | [diff] [blame] | 1676 | values = {"crosstool_top": "//toolchain:emscripten"}, |
Marat Dukhan | 08c4a43 | 2019-10-03 09:29:21 -0700 | [diff] [blame] | 1677 | ) |
| 1678 | |
| 1679 | config_setting( |
| 1680 | name = "emscripten_wasm", |
| 1681 | values = { |
Marat Dukhan | 1a729ec | 2019-10-07 09:31:44 -0700 | [diff] [blame] | 1682 | "crosstool_top": "//toolchain:emscripten", |
Marat Dukhan | 08c4a43 | 2019-10-03 09:29:21 -0700 | [diff] [blame] | 1683 | "cpu": "wasm", |
| 1684 | }, |
| 1685 | ) |
| 1686 | |
| 1687 | config_setting( |
| 1688 | name = "emscripten_wasmsimd", |
| 1689 | values = { |
Marat Dukhan | 1a729ec | 2019-10-07 09:31:44 -0700 | [diff] [blame] | 1690 | "crosstool_top": "//toolchain:emscripten", |
Marat Dukhan | 08c4a43 | 2019-10-03 09:29:21 -0700 | [diff] [blame] | 1691 | "cpu": "wasm", |
| 1692 | "features": "wasmsimd", |
| 1693 | }, |
| 1694 | ) |
| 1695 | |
| 1696 | config_setting( |
| 1697 | name = "emscripten_asmjs", |
| 1698 | values = { |
Marat Dukhan | 1a729ec | 2019-10-07 09:31:44 -0700 | [diff] [blame] | 1699 | "crosstool_top": "//toolchain:emscripten", |
Marat Dukhan | 08c4a43 | 2019-10-03 09:29:21 -0700 | [diff] [blame] | 1700 | "cpu": "asmjs", |
| 1701 | }, |
| 1702 | ) |
| 1703 | |
Marat Dukhan | 174706e | 2019-10-09 16:33:53 -0700 | [diff] [blame] | 1704 | # Builds with -c dbg |
Marat Dukhan | 08c4a43 | 2019-10-03 09:29:21 -0700 | [diff] [blame] | 1705 | config_setting( |
| 1706 | name = "debug_build", |
| 1707 | values = { |
| 1708 | "compilation_mode": "dbg", |
| 1709 | }, |
Marat Dukhan | 08c4a43 | 2019-10-03 09:29:21 -0700 | [diff] [blame] | 1710 | ) |
| 1711 | |
Marat Dukhan | 174706e | 2019-10-09 16:33:53 -0700 | [diff] [blame] | 1712 | # Builds with -c opt |
Marat Dukhan | 08c4a43 | 2019-10-03 09:29:21 -0700 | [diff] [blame] | 1713 | config_setting( |
| 1714 | name = "optimized_build", |
| 1715 | values = { |
| 1716 | "compilation_mode": "opt", |
| 1717 | }, |
Marat Dukhan | 08c4a43 | 2019-10-03 09:29:21 -0700 | [diff] [blame] | 1718 | ) |
| 1719 | |
| 1720 | # Enables usage of assembly kernels. |
| 1721 | config_setting( |
| 1722 | name = "xnn_enable_assembly_explicit_true", |
| 1723 | define_values = {"xnn_enable_assembly": "true"}, |
| 1724 | ) |
| 1725 | |
| 1726 | # Disables usage of assembly kernels. |
| 1727 | config_setting( |
| 1728 | name = "xnn_enable_assembly_explicit_false", |
| 1729 | define_values = {"xnn_enable_assembly": "false"}, |
| 1730 | ) |