XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -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 | #include <algorithm> |
| 7 | #include <cfloat> |
| 8 | #include <cmath> |
| 9 | #include <functional> |
| 10 | #include <random> |
| 11 | #include <vector> |
| 12 | |
| 13 | #include <cpuinfo.h> |
| 14 | |
| 15 | #include <benchmark/benchmark.h> |
| 16 | #include "bench/dwconv.h" |
| 17 | #include "bench/utils.h" |
| 18 | #include <xnnpack/AlignedAllocator.h> |
Marat Dukhan | 1dadbf7 | 2019-10-01 10:46:20 -0700 | [diff] [blame] | 19 | #include <xnnpack/common.h> |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 20 | #include <xnnpack/dwconv.h> |
| 21 | #include <xnnpack/indirection.h> |
| 22 | #include <xnnpack/operator.h> |
| 23 | #include <xnnpack/pack.h> |
Marat Dukhan | eeaa7bd | 2019-10-25 17:31:25 -0700 | [diff] [blame] | 24 | #include <xnnpack/params-init.h> |
Frank Barchard | e0601b5 | 2019-10-25 17:43:34 -0700 | [diff] [blame] | 25 | #include <xnnpack/params.h> |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 26 | |
| 27 | |
| 28 | static void DWConvBenchmark(benchmark::State& state, |
Marat Dukhan | 163a7e6 | 2020-04-09 04:19:26 -0700 | [diff] [blame] | 29 | xnn_f32_dwconv_minmax_unipass_ukernel_function dwconv, |
Marat Dukhan | c8466f5 | 2019-11-25 18:01:10 -0800 | [diff] [blame] | 30 | uint32_t cr, uint32_t kr, |
| 31 | benchmark::utils::IsaCheckFunction isa_check = nullptr) |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 32 | { |
| 33 | if (!cpuinfo_initialize()) { |
| 34 | state.SkipWithError("cpuinfo initialization failed"); |
| 35 | return; |
| 36 | } |
Marat Dukhan | c8466f5 | 2019-11-25 18:01:10 -0800 | [diff] [blame] | 37 | if (isa_check && !isa_check(state)) { |
| 38 | return; |
| 39 | } |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 40 | |
| 41 | const size_t input_height = state.range(0); |
| 42 | const size_t input_width = state.range(1); |
| 43 | const size_t kernel_height = state.range(2); |
| 44 | const size_t kernel_width = state.range(3); |
| 45 | const size_t padding_height = state.range(4); |
| 46 | const size_t padding_width = state.range(5); |
| 47 | const size_t subsampling = state.range(6); |
| 48 | const size_t dilation = state.range(7); |
| 49 | const size_t channels = state.range(8); |
| 50 | |
| 51 | const size_t kernel_size = kernel_height * kernel_width; |
| 52 | if (kernel_size != kr) { |
| 53 | state.SkipWithError("kernel size mismatch"); |
| 54 | return; |
| 55 | } |
| 56 | |
| 57 | std::random_device random_device; |
| 58 | auto rng = std::mt19937(random_device()); |
Marat Dukhan | 44f0ca7 | 2020-08-02 21:46:58 -0700 | [diff] [blame] | 59 | auto f32rng = std::bind(std::uniform_real_distribution<float>(0.0f, 1.0f), std::ref(rng)); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 60 | |
| 61 | const size_t effective_kernel_height = (kernel_height - 1) * dilation + 1; |
| 62 | const size_t effective_kernel_width = (kernel_width - 1) * dilation + 1; |
| 63 | const size_t padding_left = padding_width / 2; |
| 64 | const size_t padding_top = padding_height / 2; |
| 65 | const size_t output_height = (input_height + padding_height - effective_kernel_height) / subsampling + 1; |
| 66 | const size_t output_width = (input_width + padding_width - effective_kernel_width) / subsampling + 1; |
| 67 | const size_t output_size = output_height * output_width; |
| 68 | const size_t step_width = dilation == 1 ? subsampling : kernel_width; |
Marat Dukhan | 03ff294 | 2019-12-05 09:32:26 -0800 | [diff] [blame] | 69 | const size_t step_height = kernel_size + (output_width - 1) * step_width * kernel_height; |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 70 | |
Marat Dukhan | 4232323 | 2019-10-23 02:09:02 -0700 | [diff] [blame] | 71 | const size_t c_stride = benchmark::utils::RoundUp<size_t>(channels, cr); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 72 | |
Marat Dukhan | ad74a7b | 2019-12-05 06:18:39 -0800 | [diff] [blame] | 73 | std::vector<float> a(channels * input_height * input_width + XNN_EXTRA_BYTES / sizeof(float)); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 74 | std::generate(a.begin(), a.end(), std::ref(f32rng)); |
| 75 | std::vector<float> k(channels * kernel_height * kernel_width); |
| 76 | std::generate(k.begin(), k.end(), std::ref(f32rng)); |
| 77 | std::vector<float> b(channels); |
| 78 | std::generate(b.begin(), b.end(), std::ref(f32rng)); |
| 79 | |
Marat Dukhan | ad74a7b | 2019-12-05 06:18:39 -0800 | [diff] [blame] | 80 | std::vector<float> z(channels + XNN_EXTRA_BYTES / sizeof(float)); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 81 | |
| 82 | const size_t w_elements = (kernel_size + 1) * c_stride; |
| 83 | const size_t i_elements = output_height * step_height; |
| 84 | const size_t c_elements = output_size * channels; |
| 85 | const size_t num_buffers = 1 + |
Marat Dukhan | 4232323 | 2019-10-23 02:09:02 -0700 | [diff] [blame] | 86 | benchmark::utils::DivideRoundUp<size_t>(benchmark::utils::GetMaxCacheSize(), |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 87 | sizeof(float) * (w_elements + c_elements) + sizeof(void*) * i_elements); |
| 88 | |
| 89 | std::vector<float, AlignedAllocator<float, 32>> w(w_elements * num_buffers); |
| 90 | std::fill(w.begin(), w.end(), 0.0f); |
| 91 | xnn_pack_f32_dwconv_ghw_w(kernel_height, kernel_width, channels, cr, |
Marat Dukhan | b42f866 | 2020-07-06 20:46:13 -0700 | [diff] [blame] | 92 | k.data(), b.data(), w.data(), nullptr); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 93 | for (size_t n = 1; n < num_buffers; n++) { |
| 94 | std::copy(w.cbegin(), w.cbegin() + w_elements, w.begin() + n * w_elements); |
| 95 | } |
| 96 | |
| 97 | std::vector<const float*> i(i_elements * num_buffers); |
| 98 | xnn_operator convolution_op = { }; |
| 99 | convolution_op.indirection_buffer = reinterpret_cast<const void**>(i.data()); |
| 100 | convolution_op.input = a.data(); |
| 101 | convolution_op.input_pixel_stride = channels; |
| 102 | convolution_op.zero_buffer = z.data(); |
| 103 | convolution_op.batch_size = 1; |
| 104 | convolution_op.input_height = input_height; |
| 105 | convolution_op.input_width = input_width; |
| 106 | convolution_op.output_height = output_height; |
| 107 | convolution_op.output_width = output_width; |
| 108 | convolution_op.kernel_height = kernel_height; |
| 109 | convolution_op.kernel_width = kernel_width; |
| 110 | convolution_op.stride_height = subsampling; |
| 111 | convolution_op.stride_width = subsampling; |
| 112 | convolution_op.dilation_height = dilation; |
| 113 | convolution_op.dilation_width = dilation; |
| 114 | convolution_op.padding_top = padding_top; |
| 115 | convolution_op.padding_left = padding_left; |
| 116 | |
| 117 | xnn_indirection_init_dwconv2d(&convolution_op, 0, step_height, step_width, 2 /* log2(sizeof(float)) */); |
| 118 | for (size_t n = 1; n < num_buffers; n++) { |
| 119 | std::copy(i.cbegin(), i.cbegin() + i_elements, i.begin() + n * i_elements); |
| 120 | } |
| 121 | |
| 122 | std::vector<float> c(c_elements * num_buffers); |
| 123 | std::fill(c.begin(), c.end(), std::nanf("")); |
| 124 | |
Frank Barchard | e70dbeb | 2020-05-01 15:46:41 -0700 | [diff] [blame] | 125 | xnn_f32_minmax_params params = |
Marat Dukhan | eb09a6b | 2020-04-08 17:34:32 -0700 | [diff] [blame] | 126 | xnn_init_f32_minmax_params(-std::numeric_limits<float>::infinity(), +std::numeric_limits<float>::infinity()); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 127 | |
| 128 | size_t buffer_index = 0; |
| 129 | for (auto _ : state) { |
| 130 | state.PauseTiming(); |
Marat Dukhan | 4232323 | 2019-10-23 02:09:02 -0700 | [diff] [blame] | 131 | benchmark::utils::PrefetchToL1(a.data(), a.size() * sizeof(float)); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 132 | buffer_index = (buffer_index + 1) % num_buffers; |
| 133 | state.ResumeTiming(); |
| 134 | |
| 135 | for (uint32_t y = 0; y < output_height; y++) { |
| 136 | dwconv(channels, output_width, |
| 137 | i.data() + buffer_index * i_elements + step_height * y, |
| 138 | w.data() + buffer_index * w_elements, |
| 139 | c.data() + buffer_index * c_elements + y * output_width * channels, |
| 140 | kernel_height * step_width * sizeof(void*), 0, |
Frank Barchard | d536072 | 2020-05-17 16:10:36 -0700 | [diff] [blame] | 141 | 0, z.data(), ¶ms); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 142 | } |
| 143 | } |
| 144 | |
| 145 | state.counters["Freq"] = benchmark::utils::GetCurrentCpuFrequency(); |
| 146 | state.counters["FLOPS"] = benchmark::Counter( |
| 147 | uint64_t(state.iterations()) * 2 * output_size * channels * kernel_size, |
| 148 | benchmark::Counter::kIsRate); |
| 149 | |
| 150 | state.counters["BYTES"] = benchmark::Counter( |
| 151 | uint64_t(state.iterations()) * (output_size + input_height * input_width + kernel_size + 1 /* bias */) * channels * sizeof(float), |
| 152 | benchmark::Counter::kIsRate); |
| 153 | } |
| 154 | |
Frank Barchard | 7e95597 | 2019-10-11 10:34:25 -0700 | [diff] [blame] | 155 | #if XNN_ARCH_ARM64 && XNN_ENABLE_ASSEMBLY |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 156 | static void f32_dwconv_4x9__aarch64_neonfma(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 157 | DWConvBenchmark(state, xnn_f32_dwconv_minmax_ukernel_up4x9__neon, 4, 9); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 158 | } |
| 159 | |
| 160 | static void f32_dwconv_4x9__aarch64_neonfma_cortex_a55(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 161 | DWConvBenchmark(state, xnn_f32_dwconv_minmax_ukernel_up4x9__neonfma, 4, 9); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 162 | } |
| 163 | |
| 164 | BENCHMARK_DWCONV(f32_dwconv_4x9__aarch64_neonfma) |
| 165 | BENCHMARK_DWCONV(f32_dwconv_4x9__aarch64_neonfma_cortex_a55) |
Marat Dukhan | 1dadbf7 | 2019-10-01 10:46:20 -0700 | [diff] [blame] | 166 | #endif // XNN_ARCH_ARM64 |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 167 | |
Marat Dukhan | 1dadbf7 | 2019-10-01 10:46:20 -0700 | [diff] [blame] | 168 | #if XNN_ARCH_ARM || XNN_ARCH_ARM64 |
Frank Barchard | 2b95ea1 | 2020-06-01 11:58:43 -0700 | [diff] [blame] | 169 | static void f32_dwconv_4x25__neon_acc2(benchmark::State& state, const char* net) { |
| 170 | DWConvBenchmark(state, xnn_f32_dwconv_minmax_ukernel_up4x25__neon_acc2, 4, 25, |
| 171 | benchmark::utils::CheckNEON); |
| 172 | } |
| 173 | |
| 174 | static void f32_dwconv_4x25__neon(benchmark::State& state, const char* net) { |
| 175 | DWConvBenchmark(state, xnn_f32_dwconv_minmax_ukernel_up4x25__neon, 4, 25, |
| 176 | benchmark::utils::CheckNEON); |
| 177 | } |
| 178 | |
| 179 | static void f32_dwconv_4x25__neonfma_acc2(benchmark::State& state, const char* net) { |
| 180 | DWConvBenchmark(state, xnn_f32_dwconv_minmax_ukernel_up4x25__neonfma_acc2, 4, 25, |
| 181 | benchmark::utils::CheckNEONFMA); |
| 182 | } |
| 183 | |
| 184 | static void f32_dwconv_4x25__neonfma(benchmark::State& state, const char* net) { |
| 185 | DWConvBenchmark(state, xnn_f32_dwconv_minmax_ukernel_up4x25__neonfma, 4, 25, |
| 186 | benchmark::utils::CheckNEONFMA); |
| 187 | } |
| 188 | |
| 189 | static void f32_dwconv_4x4__neon_acc2(benchmark::State& state, const char* net) { |
| 190 | DWConvBenchmark(state, xnn_f32_dwconv_minmax_ukernel_up4x4__neon_acc2, 4, 4, |
| 191 | benchmark::utils::CheckNEON); |
| 192 | } |
| 193 | |
| 194 | static void f32_dwconv_4x4__neon(benchmark::State& state, const char* net) { |
| 195 | DWConvBenchmark(state, xnn_f32_dwconv_minmax_ukernel_up4x4__neon, 4, 4, |
| 196 | benchmark::utils::CheckNEON); |
| 197 | } |
| 198 | |
| 199 | static void f32_dwconv_4x4__neonfma_acc2(benchmark::State& state, const char* net) { |
| 200 | DWConvBenchmark(state, xnn_f32_dwconv_minmax_ukernel_up4x4__neonfma_acc2, 4, 4, |
| 201 | benchmark::utils::CheckNEONFMA); |
| 202 | } |
| 203 | |
| 204 | static void f32_dwconv_4x4__neonfma(benchmark::State& state, const char* net) { |
| 205 | DWConvBenchmark(state, xnn_f32_dwconv_minmax_ukernel_up4x4__neonfma, 4, 4, |
| 206 | benchmark::utils::CheckNEONFMA); |
| 207 | } |
| 208 | |
| 209 | static void f32_dwconv_4x9__neon_acc2(benchmark::State& state, const char* net) { |
| 210 | DWConvBenchmark(state, xnn_f32_dwconv_minmax_ukernel_up4x9__neon_acc2, 4, 9, |
| 211 | benchmark::utils::CheckNEON); |
| 212 | } |
| 213 | |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 214 | static void f32_dwconv_4x9__neon(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 215 | DWConvBenchmark(state, xnn_f32_dwconv_minmax_ukernel_up4x9__neon, 4, 9, |
Frank Barchard | 2b95ea1 | 2020-06-01 11:58:43 -0700 | [diff] [blame] | 216 | benchmark::utils::CheckNEON); |
| 217 | } |
| 218 | |
| 219 | static void f32_dwconv_4x9__neonfma_acc2(benchmark::State& state, const char* net) { |
| 220 | DWConvBenchmark(state, xnn_f32_dwconv_minmax_ukernel_up4x9__neonfma_acc2, 4, 9, |
| 221 | benchmark::utils::CheckNEONFMA); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 222 | } |
| 223 | |
| 224 | static void f32_dwconv_4x9__neonfma(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 225 | DWConvBenchmark(state, xnn_f32_dwconv_minmax_ukernel_up4x9__neonfma, 4, 9, |
Frank Barchard | 2b95ea1 | 2020-06-01 11:58:43 -0700 | [diff] [blame] | 226 | benchmark::utils::CheckNEONFMA); |
| 227 | } |
| 228 | |
| 229 | static void f32_dwconv_8x25__neon_acc2(benchmark::State& state, const char* net) { |
| 230 | DWConvBenchmark(state, xnn_f32_dwconv_minmax_ukernel_up8x25__neon_acc2, 8, 25, |
| 231 | benchmark::utils::CheckNEON); |
| 232 | } |
| 233 | |
| 234 | static void f32_dwconv_8x25__neon(benchmark::State& state, const char* net) { |
| 235 | DWConvBenchmark(state, xnn_f32_dwconv_minmax_ukernel_up8x25__neon, 8, 25, |
| 236 | benchmark::utils::CheckNEON); |
| 237 | } |
| 238 | |
| 239 | static void f32_dwconv_8x25__neonfma_acc2(benchmark::State& state, const char* net) { |
| 240 | DWConvBenchmark(state, xnn_f32_dwconv_minmax_ukernel_up8x25__neonfma_acc2, 8, 25, |
| 241 | benchmark::utils::CheckNEONFMA); |
| 242 | } |
| 243 | |
| 244 | static void f32_dwconv_8x25__neonfma(benchmark::State& state, const char* net) { |
| 245 | DWConvBenchmark(state, xnn_f32_dwconv_minmax_ukernel_up8x25__neonfma, 8, 25, |
| 246 | benchmark::utils::CheckNEONFMA); |
| 247 | } |
| 248 | |
| 249 | static void f32_dwconv_8x4__neon_acc2(benchmark::State& state, const char* net) { |
| 250 | DWConvBenchmark(state, xnn_f32_dwconv_minmax_ukernel_up8x4__neon_acc2, 8, 4, |
| 251 | benchmark::utils::CheckNEON); |
| 252 | } |
| 253 | |
| 254 | static void f32_dwconv_8x4__neon(benchmark::State& state, const char* net) { |
| 255 | DWConvBenchmark(state, xnn_f32_dwconv_minmax_ukernel_up8x4__neon, 8, 4, |
| 256 | benchmark::utils::CheckNEON); |
| 257 | } |
| 258 | |
| 259 | static void f32_dwconv_8x4__neonfma_acc2(benchmark::State& state, const char* net) { |
| 260 | DWConvBenchmark(state, xnn_f32_dwconv_minmax_ukernel_up8x4__neonfma_acc2, 8, 4, |
| 261 | benchmark::utils::CheckNEONFMA); |
| 262 | } |
| 263 | |
| 264 | static void f32_dwconv_8x4__neonfma(benchmark::State& state, const char* net) { |
| 265 | DWConvBenchmark(state, xnn_f32_dwconv_minmax_ukernel_up8x4__neonfma, 8, 4, |
| 266 | benchmark::utils::CheckNEONFMA); |
| 267 | } |
| 268 | |
| 269 | static void f32_dwconv_8x9__neon_acc2(benchmark::State& state, const char* net) { |
| 270 | DWConvBenchmark(state, xnn_f32_dwconv_minmax_ukernel_up8x9__neon_acc2, 8, 9, |
| 271 | benchmark::utils::CheckNEON); |
| 272 | } |
| 273 | |
| 274 | static void f32_dwconv_8x9__neon(benchmark::State& state, const char* net) { |
| 275 | DWConvBenchmark(state, xnn_f32_dwconv_minmax_ukernel_up8x9__neon, 8, 9, |
| 276 | benchmark::utils::CheckNEON); |
| 277 | } |
| 278 | |
| 279 | static void f32_dwconv_8x9__neonfma_acc2(benchmark::State& state, const char* net) { |
| 280 | DWConvBenchmark(state, xnn_f32_dwconv_minmax_ukernel_up8x9__neonfma_acc2, 8, 9, |
| 281 | benchmark::utils::CheckNEONFMA); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 282 | } |
| 283 | |
| 284 | static void f32_dwconv_8x9__neonfma(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 285 | DWConvBenchmark(state, xnn_f32_dwconv_minmax_ukernel_up8x9__neonfma, 8, 9, |
Frank Barchard | 2b95ea1 | 2020-06-01 11:58:43 -0700 | [diff] [blame] | 286 | benchmark::utils::CheckNEONFMA); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 287 | } |
| 288 | |
Frank Barchard | 2b95ea1 | 2020-06-01 11:58:43 -0700 | [diff] [blame] | 289 | BENCHMARK_DWCONV(f32_dwconv_4x25__neon_acc2) |
| 290 | BENCHMARK_DWCONV(f32_dwconv_4x25__neon) |
| 291 | BENCHMARK_DWCONV(f32_dwconv_4x25__neonfma_acc2) |
| 292 | BENCHMARK_DWCONV(f32_dwconv_4x25__neonfma) |
| 293 | BENCHMARK_DWCONV(f32_dwconv_4x4__neon_acc2) |
| 294 | BENCHMARK_DWCONV(f32_dwconv_4x4__neon) |
| 295 | BENCHMARK_DWCONV(f32_dwconv_4x4__neonfma_acc2) |
| 296 | BENCHMARK_DWCONV(f32_dwconv_4x4__neonfma) |
| 297 | BENCHMARK_DWCONV(f32_dwconv_4x9__neon_acc2) |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 298 | BENCHMARK_DWCONV(f32_dwconv_4x9__neon) |
Frank Barchard | 2b95ea1 | 2020-06-01 11:58:43 -0700 | [diff] [blame] | 299 | BENCHMARK_DWCONV(f32_dwconv_4x9__neonfma_acc2) |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 300 | BENCHMARK_DWCONV(f32_dwconv_4x9__neonfma) |
Frank Barchard | 2b95ea1 | 2020-06-01 11:58:43 -0700 | [diff] [blame] | 301 | BENCHMARK_DWCONV(f32_dwconv_8x25__neon_acc2) |
| 302 | BENCHMARK_DWCONV(f32_dwconv_8x25__neon) |
| 303 | BENCHMARK_DWCONV(f32_dwconv_8x25__neonfma_acc2) |
| 304 | BENCHMARK_DWCONV(f32_dwconv_8x25__neonfma) |
| 305 | BENCHMARK_DWCONV(f32_dwconv_8x4__neon_acc2) |
| 306 | BENCHMARK_DWCONV(f32_dwconv_8x4__neon) |
| 307 | BENCHMARK_DWCONV(f32_dwconv_8x4__neonfma_acc2) |
| 308 | BENCHMARK_DWCONV(f32_dwconv_8x4__neonfma) |
| 309 | BENCHMARK_DWCONV(f32_dwconv_8x9__neon_acc2) |
| 310 | BENCHMARK_DWCONV(f32_dwconv_8x9__neon) |
| 311 | BENCHMARK_DWCONV(f32_dwconv_8x9__neonfma_acc2) |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 312 | BENCHMARK_DWCONV(f32_dwconv_8x9__neonfma) |
Marat Dukhan | 1dadbf7 | 2019-10-01 10:46:20 -0700 | [diff] [blame] | 313 | #endif // XNN_ARCH_ARM || XNN_ARCH_ARM64 |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 314 | |
| 315 | |
Frank Barchard | 2b95ea1 | 2020-06-01 11:58:43 -0700 | [diff] [blame] | 316 | |
Marat Dukhan | 1dadbf7 | 2019-10-01 10:46:20 -0700 | [diff] [blame] | 317 | #if XNN_ARCH_X86 || XNN_ARCH_X86_64 |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 318 | static void f32_dwconv_4x4__sse(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 319 | DWConvBenchmark(state, xnn_f32_dwconv_minmax_ukernel_up4x4__sse, 4, 4); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 320 | } |
| 321 | |
| 322 | static void f32_dwconv_4x9__sse(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 323 | DWConvBenchmark(state, xnn_f32_dwconv_minmax_ukernel_up4x9__sse, 4, 9); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 324 | } |
| 325 | |
| 326 | static void f32_dwconv_4x25__sse(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 327 | DWConvBenchmark(state, xnn_f32_dwconv_minmax_ukernel_up4x25__sse, 4, 25); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 328 | } |
| 329 | |
| 330 | BENCHMARK_DWCONV(f32_dwconv_4x4__sse) |
| 331 | BENCHMARK_DWCONV(f32_dwconv_4x9__sse) |
| 332 | BENCHMARK_DWCONV(f32_dwconv_4x25__sse) |
Marat Dukhan | 1dadbf7 | 2019-10-01 10:46:20 -0700 | [diff] [blame] | 333 | #endif // XNN_ARCH_X86 || XNN_ARCH_X86_64 |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 334 | |
| 335 | |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 336 | static void f32_dwconv_1x4__scalar(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 337 | DWConvBenchmark(state, xnn_f32_dwconv_minmax_ukernel_up1x4__scalar, 1, 4); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 338 | } |
| 339 | |
| 340 | static void f32_dwconv_1x9__scalar(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 341 | DWConvBenchmark(state, xnn_f32_dwconv_minmax_ukernel_up1x9__scalar, 1, 9); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 342 | } |
| 343 | |
| 344 | static void f32_dwconv_1x25__scalar(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 345 | DWConvBenchmark(state, xnn_f32_dwconv_minmax_ukernel_up1x25__scalar, 1, 25); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 346 | } |
| 347 | |
| 348 | BENCHMARK_DWCONV(f32_dwconv_1x4__scalar) |
| 349 | BENCHMARK_DWCONV(f32_dwconv_1x9__scalar) |
| 350 | BENCHMARK_DWCONV(f32_dwconv_1x25__scalar) |
| 351 | |
| 352 | #ifndef XNNPACK_BENCHMARK_NO_MAIN |
| 353 | BENCHMARK_MAIN(); |
| 354 | #endif |