XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 1 | // Copyright (c) Facebook, Inc. and its affiliates. |
| 2 | // All rights reserved. |
| 3 | // |
| 4 | // Copyright 2019 Google LLC |
| 5 | // |
| 6 | // This source code is licensed under the BSD-style license found in the |
| 7 | // LICENSE file in the root directory of this source tree. |
| 8 | |
| 9 | #include <algorithm> |
| 10 | #include <cfloat> |
| 11 | #include <chrono> |
| 12 | #include <cmath> |
| 13 | #include <functional> |
| 14 | #include <mutex> |
| 15 | #include <random> |
| 16 | #include <vector> |
| 17 | |
| 18 | #include <cpuinfo.h> |
| 19 | |
Frank Barchard | bb4c18b | 2019-09-30 11:05:52 -0700 | [diff] [blame] | 20 | #include <benchmark/benchmark.h> |
Marat Dukhan | 33f0c7a | 2019-10-01 13:33:08 -0700 | [diff] [blame] | 21 | #ifdef BENCHMARK_RUY |
Benoit Jacob | b038fdc | 2020-03-25 12:14:20 -0700 | [diff] [blame] | 22 | #include "ruy/ruy.h" |
Marat Dukhan | 33f0c7a | 2019-10-01 13:33:08 -0700 | [diff] [blame] | 23 | #endif // BENCHMARK_RUY |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 24 | #include "bench/gemm.h" |
Frank Barchard | bb4c18b | 2019-09-30 11:05:52 -0700 | [diff] [blame] | 25 | #include "bench/utils.h" |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 26 | #include <xnnpack/AlignedAllocator.h> |
Marat Dukhan | 1dadbf7 | 2019-10-01 10:46:20 -0700 | [diff] [blame] | 27 | #include <xnnpack/common.h> |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 28 | #include <xnnpack/gemm.h> |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 29 | #include <xnnpack/pack.h> |
Frank Barchard | bb4c18b | 2019-09-30 11:05:52 -0700 | [diff] [blame] | 30 | #include <xnnpack/packx.h> |
Marat Dukhan | eeaa7bd | 2019-10-25 17:31:25 -0700 | [diff] [blame] | 31 | #include <xnnpack/params-init.h> |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 32 | #include <xnnpack/params.h> |
| 33 | #include <xnnpack/ppmm.h> |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 34 | |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 35 | |
| 36 | static void GEMMBenchmark(benchmark::State& state, |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 37 | xnn_f32_gemm_minmax_ukernel_function gemm, |
Marat Dukhan | c8466f5 | 2019-11-25 18:01:10 -0800 | [diff] [blame] | 38 | size_t mr, size_t nr, size_t kr, size_t sr, |
| 39 | benchmark::utils::IsaCheckFunction isa_check = nullptr) |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 40 | { |
| 41 | if (!cpuinfo_initialize()) { |
| 42 | state.SkipWithError("cpuinfo initialization failed"); |
| 43 | return; |
| 44 | } |
Marat Dukhan | c8466f5 | 2019-11-25 18:01:10 -0800 | [diff] [blame] | 45 | if (isa_check && !isa_check(state)) { |
| 46 | return; |
| 47 | } |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 48 | |
| 49 | const size_t mc = state.range(0); |
| 50 | const size_t nc = state.range(1); |
| 51 | const size_t kc = state.range(2); |
| 52 | |
Marat Dukhan | 4232323 | 2019-10-23 02:09:02 -0700 | [diff] [blame] | 53 | const size_t nc_stride = benchmark::utils::RoundUp(nc, nr); |
| 54 | const size_t kc_stride = benchmark::utils::RoundUp(kc, kr); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 55 | |
| 56 | std::random_device random_device; |
| 57 | auto rng = std::mt19937(random_device()); |
| 58 | auto f32rng = std::bind(std::uniform_real_distribution<float>(), rng); |
| 59 | |
| 60 | std::vector<float> a(mc * kc); |
| 61 | std::generate(a.begin(), a.end(), std::ref(f32rng)); |
| 62 | std::vector<float> k(nc * kc); |
| 63 | std::generate(k.begin(), k.end(), std::ref(f32rng)); |
| 64 | std::vector<float> b(nc); |
| 65 | std::generate(b.begin(), b.end(), std::ref(f32rng)); |
| 66 | |
| 67 | const size_t w_elements = nc_stride * kc_stride + nc_stride; |
| 68 | const size_t c_elements = mc * nc; |
| 69 | const size_t num_buffers = 1 + |
Marat Dukhan | 4232323 | 2019-10-23 02:09:02 -0700 | [diff] [blame] | 70 | benchmark::utils::DivideRoundUp<size_t>(benchmark::utils::GetMaxCacheSize(), |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 71 | sizeof(float) * (w_elements + c_elements)); |
| 72 | |
| 73 | std::vector<float, AlignedAllocator<float, 32>> w(w_elements * num_buffers); |
| 74 | std::fill(w.begin(), w.end(), 0.0f); |
Marat Dukhan | b42f866 | 2020-07-06 20:46:13 -0700 | [diff] [blame] | 75 | xnn_pack_f32_gemm_goi_w(1 /* groups */, nc, kc, nr, kr, sr, k.data(), b.data(), w.data(), nullptr); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 76 | std::vector<float> c(c_elements * num_buffers); |
| 77 | std::fill(c.begin(), c.end(), std::nanf("")); |
| 78 | |
Frank Barchard | e70dbeb | 2020-05-01 15:46:41 -0700 | [diff] [blame] | 79 | xnn_f32_minmax_params params = |
Marat Dukhan | eb09a6b | 2020-04-08 17:34:32 -0700 | [diff] [blame] | 80 | 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] | 81 | |
| 82 | size_t buffer_index = 0; |
| 83 | for (auto _ : state) { |
| 84 | // Use circular buffers (exceeding cache size) and prefetch to control cache state: |
| 85 | // - A is always in L1 cache (if fits, otherwise L2, L3, etc) |
| 86 | // - W is not in cache (for any cache level) |
| 87 | // - C is not in cache (for any cache level) |
| 88 | state.PauseTiming(); |
Marat Dukhan | 4232323 | 2019-10-23 02:09:02 -0700 | [diff] [blame] | 89 | benchmark::utils::PrefetchToL1(a.data(), a.size() * sizeof(float)); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 90 | buffer_index = (buffer_index + 1) % num_buffers; |
| 91 | state.ResumeTiming(); |
| 92 | |
| 93 | for (uint32_t m = 0; m < mc; m += mr) { |
| 94 | const uint32_t mb = min(mc - m, mr); |
| 95 | gemm( |
| 96 | mb, nc, kc * sizeof(float), |
| 97 | a.data() + m * kc, kc * sizeof(float), |
| 98 | w.data() + buffer_index * nc_stride * (kc_stride + 1), |
| 99 | c.data() + (buffer_index * mc + m) * nc, nc * sizeof(float), nr * sizeof(float), |
Frank Barchard | e70dbeb | 2020-05-01 15:46:41 -0700 | [diff] [blame] | 100 | ¶ms); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 101 | } |
| 102 | } |
| 103 | |
| 104 | state.counters["Freq"] = benchmark::utils::GetCurrentCpuFrequency(); |
| 105 | state.counters["FLOPS"] = benchmark::Counter( |
| 106 | uint64_t(state.iterations()) * 2 * mc * nc * kc, benchmark::Counter::kIsRate); |
| 107 | } |
| 108 | |
| 109 | static void PPMM1PBenchmark(benchmark::State& state, |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 110 | xnn_f32_ppmm_minmax_ukernel_function ppmm, |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 111 | xnn_x32_packx_ukernel_function packx, |
Marat Dukhan | c8466f5 | 2019-11-25 18:01:10 -0800 | [diff] [blame] | 112 | size_t mr, size_t nr, |
| 113 | benchmark::utils::IsaCheckFunction isa_check = nullptr) |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 114 | { |
| 115 | if (!cpuinfo_initialize()) { |
| 116 | state.SkipWithError("cpuinfo initialization failed"); |
| 117 | return; |
| 118 | } |
Marat Dukhan | c8466f5 | 2019-11-25 18:01:10 -0800 | [diff] [blame] | 119 | if (isa_check && !isa_check(state)) { |
| 120 | return; |
| 121 | } |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 122 | |
| 123 | const size_t mc = state.range(0); |
| 124 | const size_t nc = state.range(1); |
| 125 | const size_t kc = state.range(2); |
| 126 | |
Marat Dukhan | 4232323 | 2019-10-23 02:09:02 -0700 | [diff] [blame] | 127 | const size_t nc_stride = benchmark::utils::RoundUp(nc, nr); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 128 | |
| 129 | std::random_device random_device; |
| 130 | auto rng = std::mt19937(random_device()); |
| 131 | auto f32rng = std::bind(std::uniform_real_distribution<float>(), rng); |
| 132 | |
| 133 | std::vector<float> a(mc * kc); |
| 134 | std::generate(a.begin(), a.end(), std::ref(f32rng)); |
| 135 | std::vector<float> k(nc * kc); |
| 136 | std::generate(k.begin(), k.end(), std::ref(f32rng)); |
| 137 | std::vector<float> b(nc); |
| 138 | std::generate(b.begin(), b.end(), std::ref(f32rng)); |
| 139 | |
| 140 | std::vector<uint32_t, AlignedAllocator<uint32_t, 32>> t(mr * kc); |
| 141 | |
| 142 | const size_t w_elements = nc_stride * kc + nc_stride; |
| 143 | const size_t c_elements = mc * nc; |
| 144 | const size_t num_buffers = 1 + |
Marat Dukhan | 4232323 | 2019-10-23 02:09:02 -0700 | [diff] [blame] | 145 | benchmark::utils::DivideRoundUp<size_t>(benchmark::utils::GetMaxCacheSize(), |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 146 | sizeof(float) * (w_elements + c_elements)); |
| 147 | |
| 148 | std::vector<float, AlignedAllocator<float, 32>> w(w_elements * num_buffers); |
| 149 | std::fill(w.begin(), w.end(), 0.0f); |
Marat Dukhan | b42f866 | 2020-07-06 20:46:13 -0700 | [diff] [blame] | 150 | xnn_pack_f32_gemm_goi_w(1 /* groups */, nc, kc, nr, 1 /* kr */, 1 /* sr */, k.data(), b.data(), w.data(), nullptr); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 151 | std::vector<float> c(c_elements * num_buffers); |
| 152 | std::fill(c.begin(), c.end(), std::nanf("")); |
| 153 | |
Frank Barchard | e70dbeb | 2020-05-01 15:46:41 -0700 | [diff] [blame] | 154 | xnn_f32_minmax_params params = |
Marat Dukhan | eb09a6b | 2020-04-08 17:34:32 -0700 | [diff] [blame] | 155 | 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] | 156 | |
| 157 | size_t buffer_index = 0; |
| 158 | for (auto _ : state) { |
| 159 | // Use circular buffers (exceeding cache size) and prefetch to control cache state: |
| 160 | // - A is always in L1 cache (if fits, otherwise L2, L3, etc) |
| 161 | // - W is not in cache (for any cache level) |
| 162 | // - C is not in cache (for any cache level) |
| 163 | state.PauseTiming(); |
Marat Dukhan | 4232323 | 2019-10-23 02:09:02 -0700 | [diff] [blame] | 164 | benchmark::utils::PrefetchToL1(a.data(), a.size() * sizeof(float)); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 165 | buffer_index = (buffer_index + 1) % num_buffers; |
| 166 | state.ResumeTiming(); |
| 167 | |
| 168 | for (uint32_t m = 0; m < mc; m += mr) { |
| 169 | const uint32_t mb = min(mc - m, mr); |
| 170 | packx(mb, kc, reinterpret_cast<const uint32_t*>(a.data() + m * kc), kc, t.data()); |
| 171 | ppmm( |
| 172 | mb, nc, kc * sizeof(float), |
| 173 | reinterpret_cast<const float*>(t.data()), |
| 174 | w.data() + nc_stride * buffer_index * (kc + 1), |
| 175 | c.data() + (mc * buffer_index + m) * nc, nc * sizeof(float), nr * sizeof(float), |
Frank Barchard | e70dbeb | 2020-05-01 15:46:41 -0700 | [diff] [blame] | 176 | ¶ms); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 177 | } |
| 178 | } |
| 179 | |
| 180 | state.counters["Freq"] = benchmark::utils::GetCurrentCpuFrequency(); |
| 181 | state.counters["FLOPS"] = benchmark::Counter( |
| 182 | uint64_t(state.iterations()) * 2 * mc * nc * kc, benchmark::Counter::kIsRate); |
| 183 | } |
| 184 | |
| 185 | static void PPMM2PBenchmark(benchmark::State& state, |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 186 | xnn_f32_ppmm_minmax_ukernel_function ppmm, |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 187 | xnn_x32_packx_ukernel_function packx, |
Marat Dukhan | c8466f5 | 2019-11-25 18:01:10 -0800 | [diff] [blame] | 188 | size_t mr, size_t nr, |
| 189 | benchmark::utils::IsaCheckFunction isa_check = nullptr) |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 190 | { |
| 191 | if (!cpuinfo_initialize()) { |
| 192 | state.SkipWithError("cpuinfo initialization failed"); |
| 193 | return; |
| 194 | } |
Marat Dukhan | c8466f5 | 2019-11-25 18:01:10 -0800 | [diff] [blame] | 195 | if (isa_check && !isa_check(state)) { |
| 196 | return; |
| 197 | } |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 198 | |
| 199 | const size_t mc = state.range(0); |
| 200 | const size_t nc = state.range(1); |
| 201 | const size_t kc = state.range(2); |
| 202 | |
Marat Dukhan | 4232323 | 2019-10-23 02:09:02 -0700 | [diff] [blame] | 203 | const size_t mc_stride = benchmark::utils::RoundUp(mc, mr); |
| 204 | const size_t nc_stride = benchmark::utils::RoundUp(nc, nr); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 205 | |
| 206 | std::random_device random_device; |
| 207 | auto rng = std::mt19937(random_device()); |
| 208 | auto f32rng = std::bind(std::uniform_real_distribution<float>(), rng); |
| 209 | |
| 210 | std::vector<float> a(mc * kc); |
| 211 | std::generate(a.begin(), a.end(), std::ref(f32rng)); |
| 212 | std::vector<float> k(nc * kc); |
| 213 | std::generate(k.begin(), k.end(), std::ref(f32rng)); |
| 214 | std::vector<float> b(nc); |
| 215 | std::generate(b.begin(), b.end(), std::ref(f32rng)); |
| 216 | |
| 217 | std::vector<uint32_t, AlignedAllocator<uint32_t, 32>> t(mc_stride * kc); |
| 218 | |
| 219 | const size_t w_elements = nc_stride * kc + nc_stride; |
| 220 | const size_t c_elements = mc * nc; |
| 221 | const size_t num_buffers = 1 + |
Marat Dukhan | 4232323 | 2019-10-23 02:09:02 -0700 | [diff] [blame] | 222 | benchmark::utils::DivideRoundUp<size_t>(benchmark::utils::GetMaxCacheSize(), |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 223 | sizeof(float) * (w_elements + c_elements)); |
| 224 | |
| 225 | std::vector<float, AlignedAllocator<float, 32>> w(w_elements * num_buffers); |
| 226 | std::fill(w.begin(), w.end(), 0.0f); |
Marat Dukhan | b42f866 | 2020-07-06 20:46:13 -0700 | [diff] [blame] | 227 | xnn_pack_f32_gemm_goi_w(1 /* groups */, nc, kc, nr, 1 /* kr */, 1 /* sr */, k.data(), b.data(), w.data(), nullptr); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 228 | std::vector<float> c(c_elements * num_buffers); |
| 229 | std::fill(c.begin(), c.end(), std::nanf("")); |
| 230 | |
Frank Barchard | e70dbeb | 2020-05-01 15:46:41 -0700 | [diff] [blame] | 231 | xnn_f32_minmax_params params = |
Marat Dukhan | eb09a6b | 2020-04-08 17:34:32 -0700 | [diff] [blame] | 232 | 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] | 233 | |
| 234 | size_t buffer_index = 0; |
| 235 | for (auto _ : state) { |
| 236 | // Use circular buffers (exceeding cache size) and prefetch to control cache state: |
| 237 | // - A is always in L1 cache (if fits, otherwise L2, L3, etc) |
| 238 | // - W is not in cache (for any cache level) |
| 239 | // - C is not in cache (for any cache level) |
| 240 | state.PauseTiming(); |
Marat Dukhan | 4232323 | 2019-10-23 02:09:02 -0700 | [diff] [blame] | 241 | benchmark::utils::PrefetchToL1(a.data(), a.size() * sizeof(float)); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 242 | buffer_index = (buffer_index + 1) % num_buffers; |
| 243 | state.ResumeTiming(); |
| 244 | |
| 245 | for (uint32_t m = 0; m < mc; m += mr) { |
| 246 | const uint32_t mb = min(mc - m, mr); |
| 247 | packx(mb, kc, reinterpret_cast<const uint32_t*>(a.data() + m * kc), kc, t.data() + m * kc); |
| 248 | } |
| 249 | for (uint32_t m = 0; m < mc; m += mr) { |
| 250 | const uint32_t mb = min(mc - m, mr); |
| 251 | ppmm( |
| 252 | mb, nc, kc * sizeof(float), |
| 253 | reinterpret_cast<const float*>(t.data() + m * kc), |
| 254 | w.data() + nc_stride * buffer_index * (kc + 1), |
| 255 | c.data() + (mc * buffer_index + m) * nc, nc * sizeof(float), nr * sizeof(float), |
Frank Barchard | e70dbeb | 2020-05-01 15:46:41 -0700 | [diff] [blame] | 256 | ¶ms); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 257 | } |
| 258 | } |
| 259 | |
| 260 | state.counters["Freq"] = benchmark::utils::GetCurrentCpuFrequency(); |
| 261 | state.counters["FLOPS"] = benchmark::Counter( |
| 262 | uint64_t(state.iterations()) * 2 * mc * nc * kc, benchmark::Counter::kIsRate); |
| 263 | } |
| 264 | |
Marat Dukhan | 33f0c7a | 2019-10-01 13:33:08 -0700 | [diff] [blame] | 265 | #ifdef BENCHMARK_RUY |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 266 | static void RuyBenchmark(benchmark::State& state, uint32_t threads) |
| 267 | { |
| 268 | std::random_device random_device; |
| 269 | auto rng = std::mt19937(random_device()); |
| 270 | auto f32rng = std::bind(std::uniform_real_distribution<float>(), rng); |
| 271 | |
| 272 | const size_t mc = state.range(0); |
| 273 | const size_t nc = state.range(1); |
| 274 | const size_t kc = state.range(2); |
| 275 | |
| 276 | const size_t num_buffers = 1 + |
Marat Dukhan | 4232323 | 2019-10-23 02:09:02 -0700 | [diff] [blame] | 277 | benchmark::utils::DivideRoundUp<size_t>(benchmark::utils::GetMaxCacheSize(), |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 278 | sizeof(float) * (nc * (mc + kc + 1))); |
| 279 | |
| 280 | std::vector<float> a(mc * kc); |
| 281 | std::generate(a.begin(), a.end(), std::ref(f32rng)); |
| 282 | std::vector<float> k(num_buffers * nc * kc); |
| 283 | std::generate(k.begin(), k.end(), std::ref(f32rng)); |
| 284 | std::vector<float> b(num_buffers * nc); |
| 285 | std::generate(b.begin(), b.end(), std::ref(f32rng)); |
| 286 | std::vector<float> c(num_buffers * nc * mc); |
| 287 | std::fill(c.begin(), c.end(), std::nanf("")); |
| 288 | |
| 289 | // Note: context must be static to avoid the cost of re-creating it for each benchmark. |
| 290 | static ruy::Context context; |
Benoit Jacob | 349701a | 2020-04-15 19:35:24 -0700 | [diff] [blame] | 291 | context.set_max_num_threads(threads); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 292 | |
| 293 | ruy::Matrix<float> ruy_a; |
Benoit Jacob | 349701a | 2020-04-15 19:35:24 -0700 | [diff] [blame] | 294 | ruy::MakeSimpleLayout(nc, kc, ruy::Order::kRowMajor, ruy_a.mutable_layout()); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 295 | ruy::Matrix<float> ruy_b; |
Benoit Jacob | 349701a | 2020-04-15 19:35:24 -0700 | [diff] [blame] | 296 | ruy::MakeSimpleLayout(kc, mc, ruy::Order::kColMajor, ruy_b.mutable_layout()); |
| 297 | ruy_b.set_data(a.data()); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 298 | ruy::Matrix<float> ruy_c; |
Benoit Jacob | 349701a | 2020-04-15 19:35:24 -0700 | [diff] [blame] | 299 | ruy::MakeSimpleLayout(nc, mc, ruy::Order::kColMajor, ruy_c.mutable_layout()); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 300 | |
Benoit Jacob | b026e22 | 2020-04-16 12:30:03 -0700 | [diff] [blame] | 301 | ruy::MulParams<float, float> mul_params; |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 302 | |
| 303 | // ruy::Context uses deferred initialization, which affects percieved GEMM performance. Initialization happens during |
| 304 | // the first GEMM calls, and per Benoit Jacob it takes up to ~250 milliseconds for performance to stabilize. |
| 305 | // Thus, on the first benchmark, we compute GEMM for 500 milliseconds (to be safe) without recording performance, and |
| 306 | // keep the ruy::Context object initialized (by being static) between subsequent benchmarks. |
| 307 | static std::once_flag warmup; |
| 308 | std::call_once(warmup, [&](){ |
| 309 | auto start = std::chrono::steady_clock::now(); |
| 310 | do { |
Benoit Jacob | 349701a | 2020-04-15 19:35:24 -0700 | [diff] [blame] | 311 | ruy_a.set_data(k.data()); |
| 312 | ruy_c.set_data(c.data()); |
Benoit Jacob | b026e22 | 2020-04-16 12:30:03 -0700 | [diff] [blame] | 313 | mul_params.set_bias(b.data()); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 314 | |
Benoit Jacob | b026e22 | 2020-04-16 12:30:03 -0700 | [diff] [blame] | 315 | ruy::Mul(ruy_a, ruy_b, mul_params, &context, &ruy_c); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 316 | } while (std::chrono::duration<double>(std::chrono::steady_clock::now() - start).count() < 0.5); |
| 317 | }); |
| 318 | |
| 319 | size_t buffer_index = 0; |
| 320 | for (auto _ : state) { |
| 321 | // Use circular buffers (exceeding cache size) and prefetch to control cache state: |
| 322 | // - A is always in L1 cache (if fits, otherwise L2, L3, etc) |
| 323 | // - K is not in cache (for any cache level) |
| 324 | // - B is not in cache (for any cache level) |
| 325 | // - C is not in cache (for any cache level) |
| 326 | state.PauseTiming(); |
Marat Dukhan | 4232323 | 2019-10-23 02:09:02 -0700 | [diff] [blame] | 327 | benchmark::utils::PrefetchToL1(a.data(), a.size() * sizeof(float)); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 328 | buffer_index = (buffer_index + 1) % num_buffers; |
| 329 | state.ResumeTiming(); |
| 330 | |
Benoit Jacob | 349701a | 2020-04-15 19:35:24 -0700 | [diff] [blame] | 331 | ruy_a.set_data(k.data() + buffer_index * nc * kc); |
| 332 | ruy_c.set_data(c.data() + buffer_index * mc * nc); |
Benoit Jacob | b026e22 | 2020-04-16 12:30:03 -0700 | [diff] [blame] | 333 | mul_params.set_bias(b.data() + buffer_index * nc); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 334 | |
Benoit Jacob | b026e22 | 2020-04-16 12:30:03 -0700 | [diff] [blame] | 335 | ruy::Mul(ruy_a, ruy_b, mul_params, &context, &ruy_c); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 336 | } |
| 337 | |
| 338 | state.counters["Freq"] = benchmark::utils::GetCurrentCpuFrequency(); |
| 339 | state.counters["FLOPS"] = benchmark::Counter( |
| 340 | uint64_t(state.iterations()) * 2 * mc * nc * kc, benchmark::Counter::kIsRate); |
| 341 | } |
| 342 | |
| 343 | static void ruy_st(benchmark::State& state, const char* net) |
| 344 | { |
| 345 | RuyBenchmark(state, 1); |
| 346 | } |
Marat Dukhan | 33f0c7a | 2019-10-01 13:33:08 -0700 | [diff] [blame] | 347 | #endif // BENCHMARK_RUY |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 348 | |
| 349 | |
Frank Barchard | dbafc58 | 2019-10-09 16:30:48 -0700 | [diff] [blame] | 350 | #if XNN_ARCH_ARM64 && XNN_ENABLE_ASSEMBLY |
Frank Barchard | 3cb54f9 | 2020-04-10 10:46:08 -0700 | [diff] [blame] | 351 | static void f32_gemm_1x8__aarch64_neonfma_ld64(benchmark::State& state, const char* net) { |
| 352 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_1x8__aarch64_neonfma_ld64, 1, 8, 1, 1); |
| 353 | } |
Frank Barchard | 95bebc9 | 2019-11-15 18:18:28 -0800 | [diff] [blame] | 354 | static void f32_gemm_1x12__aarch64_neonfma_cortex_a53(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 355 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_1x12__aarch64_neonfma_cortex_a53, 1, 12, 1, 1); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 356 | } |
Frank Barchard | 95bebc9 | 2019-11-15 18:18:28 -0800 | [diff] [blame] | 357 | static void f32_gemm_1x8__aarch64_neonfma_cortex_a53(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 358 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_1x8__aarch64_neonfma_cortex_a53, 1, 8, 1, 1); |
Frank Barchard | 21be34f | 2019-10-09 19:32:19 -0700 | [diff] [blame] | 359 | } |
Frank Barchard | 95bebc9 | 2019-11-15 18:18:28 -0800 | [diff] [blame] | 360 | static void f32_gemm_1x8__aarch64_neonfma_cortex_a57(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 361 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_1x8__aarch64_neonfma_cortex_a57, 1, 8, 1, 1); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 362 | } |
Frank Barchard | 95bebc9 | 2019-11-15 18:18:28 -0800 | [diff] [blame] | 363 | static void f32_gemm_1x8__aarch64_neonfma_cortex_a75(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 364 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_1x8__aarch64_neonfma_cortex_a75, 1, 8, 1, 1); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 365 | } |
Frank Barchard | 95bebc9 | 2019-11-15 18:18:28 -0800 | [diff] [blame] | 366 | static void f32_gemm_4x12__aarch64_neonfma_cortex_a53(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 367 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_4x12__aarch64_neonfma_cortex_a53, 4, 12, 1, 1); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 368 | } |
Frank Barchard | 95bebc9 | 2019-11-15 18:18:28 -0800 | [diff] [blame] | 369 | static void f32_gemm_4x8__aarch64_neonfma_cortex_a53(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 370 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_4x8__aarch64_neonfma_cortex_a53, 4, 8, 1, 1); |
Frank Barchard | 46fb807 | 2019-10-25 12:54:22 -0700 | [diff] [blame] | 371 | } |
Frank Barchard | 8fb9055 | 2020-03-16 11:36:09 -0700 | [diff] [blame] | 372 | static void f32_gemm_4x8__aarch64_neonfma_cortex_a55(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 373 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_4x8__aarch64_neonfma_cortex_a55, 4, 8, 1, 1); |
Frank Barchard | 8fb9055 | 2020-03-16 11:36:09 -0700 | [diff] [blame] | 374 | } |
Frank Barchard | 95bebc9 | 2019-11-15 18:18:28 -0800 | [diff] [blame] | 375 | static void f32_gemm_4x8__aarch64_neonfma_cortex_a57(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 376 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_4x8__aarch64_neonfma_cortex_a57, 4, 8, 1, 1); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 377 | } |
Frank Barchard | 95bebc9 | 2019-11-15 18:18:28 -0800 | [diff] [blame] | 378 | static void f32_gemm_4x8__aarch64_neonfma_cortex_a75(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 379 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_4x8__aarch64_neonfma_cortex_a75, 4, 8, 1, 1); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 380 | } |
Frank Barchard | 95bebc9 | 2019-11-15 18:18:28 -0800 | [diff] [blame] | 381 | static void f32_gemm_4x8__aarch64_neonfma_ld64(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 382 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_4x8__aarch64_neonfma_ld64, 4, 8, 1, 1); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 383 | } |
Frank Barchard | 95bebc9 | 2019-11-15 18:18:28 -0800 | [diff] [blame] | 384 | static void f32_gemm_4x8__aarch64_neonfma_ld128(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 385 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_4x8__aarch64_neonfma_ld128, 4, 8, 1, 1); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 386 | } |
Frank Barchard | 387c2d1 | 2019-12-16 19:14:07 -0800 | [diff] [blame] | 387 | static void f32_gemm_5x8__aarch64_neonfma_cortex_a57(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 388 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_5x8__aarch64_neonfma_cortex_a57, 5, 8, 1, 1); |
Frank Barchard | 387c2d1 | 2019-12-16 19:14:07 -0800 | [diff] [blame] | 389 | } |
Frank Barchard | 95bebc9 | 2019-11-15 18:18:28 -0800 | [diff] [blame] | 390 | static void f32_gemm_5x8__aarch64_neonfma_cortex_a75(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 391 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_5x8__aarch64_neonfma_cortex_a75, 5, 8, 1, 1); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 392 | } |
Frank Barchard | 95bebc9 | 2019-11-15 18:18:28 -0800 | [diff] [blame] | 393 | static void f32_gemm_6x8__aarch64_neonfma_ld64(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 394 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_6x8__aarch64_neonfma_ld64, 6, 8, 1, 1); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 395 | } |
Frank Barchard | 95bebc9 | 2019-11-15 18:18:28 -0800 | [diff] [blame] | 396 | static void f32_gemm_6x8__aarch64_neonfma_ld128(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 397 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_6x8__aarch64_neonfma_ld128, 6, 8, 1, 1); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 398 | } |
Frank Barchard | 95bebc9 | 2019-11-15 18:18:28 -0800 | [diff] [blame] | 399 | static void f32_gemm_6x8__aarch64_neonfma_cortex_a53(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 400 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_6x8__aarch64_neonfma_cortex_a53, 6, 8, 1, 1); |
Frank Barchard | a7fb855 | 2019-10-23 17:14:17 -0700 | [diff] [blame] | 401 | } |
Frank Barchard | 91e1999 | 2020-03-09 18:46:14 -0700 | [diff] [blame] | 402 | static void f32_gemm_6x8__aarch64_neonfma_cortex_a55(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 403 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_6x8__aarch64_neonfma_cortex_a55, 6, 8, 1, 1); |
Frank Barchard | 91e1999 | 2020-03-09 18:46:14 -0700 | [diff] [blame] | 404 | } |
Frank Barchard | 95bebc9 | 2019-11-15 18:18:28 -0800 | [diff] [blame] | 405 | static void f32_gemm_6x8__aarch64_neonfma_cortex_a73(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 406 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_6x8__aarch64_neonfma_cortex_a73, 6, 8, 1, 1); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 407 | } |
Frank Barchard | 387c2d1 | 2019-12-16 19:14:07 -0800 | [diff] [blame] | 408 | static void f32_gemm_6x8__aarch64_neonfma_cortex_a57(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 409 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_6x8__aarch64_neonfma_cortex_a57, 6, 8, 1, 1); |
Frank Barchard | 387c2d1 | 2019-12-16 19:14:07 -0800 | [diff] [blame] | 410 | } |
Frank Barchard | 95bebc9 | 2019-11-15 18:18:28 -0800 | [diff] [blame] | 411 | static void f32_gemm_6x8__aarch64_neonfma_cortex_a75(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 412 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_6x8__aarch64_neonfma_cortex_a75, 6, 8, 1, 1); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 413 | } |
Frank Barchard | 91317c5 | 2019-11-22 10:54:35 -0800 | [diff] [blame] | 414 | static void f32_gemm_1x8__neonfma_lane_ld64(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 415 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_1x8__neonfma_lane_ld64, 1, 8, 1, 1); |
Frank Barchard | 91317c5 | 2019-11-22 10:54:35 -0800 | [diff] [blame] | 416 | } |
Frank Barchard | 91317c5 | 2019-11-22 10:54:35 -0800 | [diff] [blame] | 417 | static void f32_gemm_4x8__neonfma_lane_ld64(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 418 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_4x8__neonfma_lane_ld64, 4, 8, 1, 1); |
Frank Barchard | 91317c5 | 2019-11-22 10:54:35 -0800 | [diff] [blame] | 419 | } |
Frank Barchard | 91317c5 | 2019-11-22 10:54:35 -0800 | [diff] [blame] | 420 | static void f32_gemm_4x8__neonfma_lane_ld128(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 421 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_4x8__neonfma_lane_ld128, 4, 8, 1, 1); |
Frank Barchard | 91317c5 | 2019-11-22 10:54:35 -0800 | [diff] [blame] | 422 | } |
Frank Barchard | 91317c5 | 2019-11-22 10:54:35 -0800 | [diff] [blame] | 423 | static void f32_gemm_5x8__neonfma_lane_ld64(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 424 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_5x8__neonfma_lane_ld64, 5, 8, 1, 1); |
Frank Barchard | 91317c5 | 2019-11-22 10:54:35 -0800 | [diff] [blame] | 425 | } |
Frank Barchard | 91317c5 | 2019-11-22 10:54:35 -0800 | [diff] [blame] | 426 | static void f32_gemm_6x8__neonfma_lane_ld64(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 427 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_6x8__neonfma_lane_ld64, 6, 8, 1, 1); |
Frank Barchard | 91317c5 | 2019-11-22 10:54:35 -0800 | [diff] [blame] | 428 | } |
Frank Barchard | 69172d9 | 2019-11-26 16:22:39 -0800 | [diff] [blame] | 429 | static void f32_gemm_6x8__neonfma_lane_ld128(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 430 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_6x8__neonfma_lane_ld128, 6, 8, 1, 1); |
Frank Barchard | 5243bb0 | 2019-11-22 16:37:50 -0800 | [diff] [blame] | 431 | } |
Frank Barchard | 3cb54f9 | 2020-04-10 10:46:08 -0700 | [diff] [blame] | 432 | BENCHMARK_GEMM(f32_gemm_1x8__aarch64_neonfma_ld64) |
Frank Barchard | 95bebc9 | 2019-11-15 18:18:28 -0800 | [diff] [blame] | 433 | BENCHMARK_GEMM(f32_gemm_1x12__aarch64_neonfma_cortex_a53) |
| 434 | BENCHMARK_GEMM(f32_gemm_1x8__aarch64_neonfma_cortex_a53) |
| 435 | BENCHMARK_GEMM(f32_gemm_1x8__aarch64_neonfma_cortex_a57) |
| 436 | BENCHMARK_GEMM(f32_gemm_1x8__aarch64_neonfma_cortex_a75) |
| 437 | BENCHMARK_GEMM(f32_gemm_4x12__aarch64_neonfma_cortex_a53) |
| 438 | BENCHMARK_GEMM(f32_gemm_4x8__aarch64_neonfma_cortex_a53) |
Frank Barchard | 8fb9055 | 2020-03-16 11:36:09 -0700 | [diff] [blame] | 439 | BENCHMARK_GEMM(f32_gemm_4x8__aarch64_neonfma_cortex_a55) |
Frank Barchard | 95bebc9 | 2019-11-15 18:18:28 -0800 | [diff] [blame] | 440 | BENCHMARK_GEMM(f32_gemm_4x8__aarch64_neonfma_cortex_a57) |
| 441 | BENCHMARK_GEMM(f32_gemm_4x8__aarch64_neonfma_cortex_a75) |
| 442 | BENCHMARK_GEMM(f32_gemm_4x8__aarch64_neonfma_ld128) |
| 443 | BENCHMARK_GEMM(f32_gemm_4x8__aarch64_neonfma_ld64) |
Frank Barchard | 387c2d1 | 2019-12-16 19:14:07 -0800 | [diff] [blame] | 444 | BENCHMARK_GEMM(f32_gemm_5x8__aarch64_neonfma_cortex_a57) |
Frank Barchard | 95bebc9 | 2019-11-15 18:18:28 -0800 | [diff] [blame] | 445 | BENCHMARK_GEMM(f32_gemm_5x8__aarch64_neonfma_cortex_a75) |
| 446 | BENCHMARK_GEMM(f32_gemm_6x8__aarch64_neonfma_cortex_a53) |
Frank Barchard | 91e1999 | 2020-03-09 18:46:14 -0700 | [diff] [blame] | 447 | BENCHMARK_GEMM(f32_gemm_6x8__aarch64_neonfma_cortex_a55) |
Frank Barchard | 95bebc9 | 2019-11-15 18:18:28 -0800 | [diff] [blame] | 448 | BENCHMARK_GEMM(f32_gemm_6x8__aarch64_neonfma_cortex_a73) |
Frank Barchard | 387c2d1 | 2019-12-16 19:14:07 -0800 | [diff] [blame] | 449 | BENCHMARK_GEMM(f32_gemm_6x8__aarch64_neonfma_cortex_a57) |
Frank Barchard | 95bebc9 | 2019-11-15 18:18:28 -0800 | [diff] [blame] | 450 | BENCHMARK_GEMM(f32_gemm_6x8__aarch64_neonfma_cortex_a75) |
| 451 | BENCHMARK_GEMM(f32_gemm_6x8__aarch64_neonfma_ld64) |
| 452 | BENCHMARK_GEMM(f32_gemm_6x8__aarch64_neonfma_ld128) |
Frank Barchard | 91317c5 | 2019-11-22 10:54:35 -0800 | [diff] [blame] | 453 | BENCHMARK_GEMM(f32_gemm_1x8__neonfma_lane_ld64) |
Frank Barchard | 91317c5 | 2019-11-22 10:54:35 -0800 | [diff] [blame] | 454 | BENCHMARK_GEMM(f32_gemm_4x8__neonfma_lane_ld64) |
Frank Barchard | 69172d9 | 2019-11-26 16:22:39 -0800 | [diff] [blame] | 455 | BENCHMARK_GEMM(f32_gemm_4x8__neonfma_lane_ld128) |
Frank Barchard | 91317c5 | 2019-11-22 10:54:35 -0800 | [diff] [blame] | 456 | BENCHMARK_GEMM(f32_gemm_5x8__neonfma_lane_ld64) |
| 457 | BENCHMARK_GEMM(f32_gemm_6x8__neonfma_lane_ld64) |
Frank Barchard | 69172d9 | 2019-11-26 16:22:39 -0800 | [diff] [blame] | 458 | BENCHMARK_GEMM(f32_gemm_6x8__neonfma_lane_ld128) |
Marat Dukhan | 1dadbf7 | 2019-10-01 10:46:20 -0700 | [diff] [blame] | 459 | #endif // XNN_ARCH_ARM64 |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 460 | |
Frank Barchard | 8b0f026 | 2019-11-27 23:18:40 -0800 | [diff] [blame] | 461 | #if XNN_ARCH_ARM && XNN_ENABLE_ASSEMBLY |
Marat Dukhan | 3b98f6b | 2020-05-17 10:09:22 -0700 | [diff] [blame] | 462 | static void f32_gemm_4x4__aarch32_vfp_ld64(benchmark::State& state, const char* net) { |
| 463 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_4x4__aarch32_vfp_ld64, 4, 4, 1, 1, benchmark::utils::CheckVFP); |
| 464 | } |
Frank Barchard | 8b0f026 | 2019-11-27 23:18:40 -0800 | [diff] [blame] | 465 | static void f32_gemm_4x8__aarch32_neon_ld64(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 466 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_4x8__aarch32_neon_ld64, 4, 8, 1, 1, benchmark::utils::CheckNEON); |
Frank Barchard | 3e237f2 | 2019-12-04 23:08:51 -0800 | [diff] [blame] | 467 | } |
Frank Barchard | 490febe | 2020-07-16 18:42:17 -0700 | [diff] [blame] | 468 | static void f32_gemm_4x8__aarch32_neon_cortex_a7(benchmark::State& state, const char* net) { |
| 469 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_4x8__aarch32_neon_cortex_a7, 4, 8, 1, 1, benchmark::utils::CheckNEON); |
Frank Barchard | 569561d | 2020-06-17 13:11:12 -0700 | [diff] [blame] | 470 | } |
Frank Barchard | 1391604 | 2019-12-11 10:56:34 -0800 | [diff] [blame] | 471 | static void f32_gemm_4x8__aarch32_neon_cortex_a53(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 472 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_4x8__aarch32_neon_cortex_a53, 4, 8, 1, 1, benchmark::utils::CheckNEON); |
Frank Barchard | 1391604 | 2019-12-11 10:56:34 -0800 | [diff] [blame] | 473 | } |
Frank Barchard | b7dd29e | 2020-03-11 12:37:10 -0700 | [diff] [blame] | 474 | static void f32_gemm_4x8__aarch32_neon_cortex_a55(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 475 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_4x8__aarch32_neon_cortex_a55, 4, 8, 1, 1, benchmark::utils::CheckNEON); |
Frank Barchard | b7dd29e | 2020-03-11 12:37:10 -0700 | [diff] [blame] | 476 | } |
Frank Barchard | 3e237f2 | 2019-12-04 23:08:51 -0800 | [diff] [blame] | 477 | static void f32_gemm_4x8__aarch32_neon_cortex_a75(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 478 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_4x8__aarch32_neon_cortex_a75, 4, 8, 1, 1, benchmark::utils::CheckNEON); |
Frank Barchard | 8b0f026 | 2019-11-27 23:18:40 -0800 | [diff] [blame] | 479 | } |
Frank Barchard | 9f7d555 | 2019-12-12 10:58:10 -0800 | [diff] [blame] | 480 | static void f32_gemm_4x8__aarch32_neon_pld_cortex_a75(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 481 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_4x8__aarch32_neon_pld_cortex_a75, 4, 8, 1, 1, benchmark::utils::CheckNEON); |
Frank Barchard | 9f7d555 | 2019-12-12 10:58:10 -0800 | [diff] [blame] | 482 | } |
Frank Barchard | 8b0f026 | 2019-11-27 23:18:40 -0800 | [diff] [blame] | 483 | |
Marat Dukhan | 3b98f6b | 2020-05-17 10:09:22 -0700 | [diff] [blame] | 484 | BENCHMARK_GEMM(f32_gemm_4x4__aarch32_vfp_ld64) |
Frank Barchard | 8b0f026 | 2019-11-27 23:18:40 -0800 | [diff] [blame] | 485 | BENCHMARK_GEMM(f32_gemm_4x8__aarch32_neon_ld64) |
Frank Barchard | 490febe | 2020-07-16 18:42:17 -0700 | [diff] [blame] | 486 | BENCHMARK_GEMM(f32_gemm_4x8__aarch32_neon_cortex_a7) |
Frank Barchard | 1391604 | 2019-12-11 10:56:34 -0800 | [diff] [blame] | 487 | BENCHMARK_GEMM(f32_gemm_4x8__aarch32_neon_cortex_a53) |
Frank Barchard | b7dd29e | 2020-03-11 12:37:10 -0700 | [diff] [blame] | 488 | BENCHMARK_GEMM(f32_gemm_4x8__aarch32_neon_cortex_a55) |
Frank Barchard | 3e237f2 | 2019-12-04 23:08:51 -0800 | [diff] [blame] | 489 | BENCHMARK_GEMM(f32_gemm_4x8__aarch32_neon_cortex_a75) |
Frank Barchard | 9f7d555 | 2019-12-12 10:58:10 -0800 | [diff] [blame] | 490 | BENCHMARK_GEMM(f32_gemm_4x8__aarch32_neon_pld_cortex_a75) |
Frank Barchard | 8b0f026 | 2019-11-27 23:18:40 -0800 | [diff] [blame] | 491 | #endif // XNN_ARCH_ARM |
| 492 | |
Marat Dukhan | 1dadbf7 | 2019-10-01 10:46:20 -0700 | [diff] [blame] | 493 | #if XNN_ARCH_ARM || XNN_ARCH_ARM64 |
Frank Barchard | 91317c5 | 2019-11-22 10:54:35 -0800 | [diff] [blame] | 494 | static void f32_gemm_1x8__neon_lane_ld64(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 495 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_1x8__neon_lane_ld64, 1, 8, 1, 1, benchmark::utils::CheckNEON); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 496 | } |
Frank Barchard | 91317c5 | 2019-11-22 10:54:35 -0800 | [diff] [blame] | 497 | static void f32_gemm_4x8__neon_lane_ld64(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 498 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_4x8__neon_lane_ld64, 4, 8, 1, 1, benchmark::utils::CheckNEON); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 499 | } |
Frank Barchard | 91317c5 | 2019-11-22 10:54:35 -0800 | [diff] [blame] | 500 | static void f32_gemm_4x8__neon_lane_ld128(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 501 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_4x8__neon_lane_ld128, 4, 8, 1, 1, benchmark::utils::CheckNEON); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 502 | } |
Frank Barchard | 91317c5 | 2019-11-22 10:54:35 -0800 | [diff] [blame] | 503 | static void f32_gemm_5x8__neon_lane_ld64(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 504 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_5x8__neon_lane_ld64, 5, 8, 1, 1, benchmark::utils::CheckNEON); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 505 | } |
Frank Barchard | 91317c5 | 2019-11-22 10:54:35 -0800 | [diff] [blame] | 506 | static void f32_gemm_6x8__neon_lane_ld64(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 507 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_6x8__neon_lane_ld64, 6, 8, 1, 1, benchmark::utils::CheckNEON); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 508 | } |
Frank Barchard | 69172d9 | 2019-11-26 16:22:39 -0800 | [diff] [blame] | 509 | static void f32_gemm_6x8__neon_lane_ld128(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 510 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_6x8__neon_lane_ld128, 6, 8, 1, 1, benchmark::utils::CheckNEON); |
Frank Barchard | 69172d9 | 2019-11-26 16:22:39 -0800 | [diff] [blame] | 511 | } |
| 512 | static void f32_gemm_1x8__neonfma_dup_ld64(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 513 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_1x8__neonfma_dup_ld64, 1, 8, 1, 1, benchmark::utils::CheckNEONFMA); |
Frank Barchard | 69172d9 | 2019-11-26 16:22:39 -0800 | [diff] [blame] | 514 | } |
| 515 | static void f32_gemm_4x8__neonfma_dup_ld64(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 516 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_4x8__neonfma_dup_ld64, 4, 8, 1, 1, benchmark::utils::CheckNEONFMA); |
Frank Barchard | 69172d9 | 2019-11-26 16:22:39 -0800 | [diff] [blame] | 517 | } |
| 518 | static void f32_gemm_4x8__neonfma_dup_ld128(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 519 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_4x8__neonfma_dup_ld128, 4, 8, 1, 1, benchmark::utils::CheckNEONFMA); |
Frank Barchard | 69172d9 | 2019-11-26 16:22:39 -0800 | [diff] [blame] | 520 | } |
| 521 | static void f32_gemm_6x8__neonfma_dup_ld64(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 522 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_6x8__neonfma_dup_ld64, 6, 8, 1, 1, benchmark::utils::CheckNEONFMA); |
Frank Barchard | 69172d9 | 2019-11-26 16:22:39 -0800 | [diff] [blame] | 523 | } |
| 524 | static void f32_gemm_6x8__neonfma_dup_ld128(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 525 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_6x8__neonfma_dup_ld128, 6, 8, 1, 1, benchmark::utils::CheckNEONFMA); |
Frank Barchard | 69172d9 | 2019-11-26 16:22:39 -0800 | [diff] [blame] | 526 | } |
Frank Barchard | df06d80 | 2019-11-20 15:53:46 -0800 | [diff] [blame] | 527 | static void f32_gemm_1x8s4__neon(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 528 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_1x8s4__neon, 1, 8, 1, 4, benchmark::utils::CheckNEON); |
Frank Barchard | df06d80 | 2019-11-20 15:53:46 -0800 | [diff] [blame] | 529 | } |
Frank Barchard | df06d80 | 2019-11-20 15:53:46 -0800 | [diff] [blame] | 530 | static void f32_gemm_1x8s4__neonfma(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 531 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_1x8s4__neonfma, 1, 8, 1, 4, benchmark::utils::CheckNEONFMA); |
Frank Barchard | df06d80 | 2019-11-20 15:53:46 -0800 | [diff] [blame] | 532 | } |
Frank Barchard | df06d80 | 2019-11-20 15:53:46 -0800 | [diff] [blame] | 533 | static void f32_gemm_4x8s4__neon(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 534 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_4x8s4__neon, 4, 8, 1, 4, benchmark::utils::CheckNEON); |
Frank Barchard | df06d80 | 2019-11-20 15:53:46 -0800 | [diff] [blame] | 535 | } |
Frank Barchard | df06d80 | 2019-11-20 15:53:46 -0800 | [diff] [blame] | 536 | static void f32_gemm_4x8s4__neonfma(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 537 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_4x8s4__neonfma, 4, 8, 1, 4, benchmark::utils::CheckNEONFMA); |
Frank Barchard | df06d80 | 2019-11-20 15:53:46 -0800 | [diff] [blame] | 538 | } |
Frank Barchard | df06d80 | 2019-11-20 15:53:46 -0800 | [diff] [blame] | 539 | static void f32_gemm_6x8s4__neon(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 540 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_6x8s4__neon, 6, 8, 1, 4, benchmark::utils::CheckNEON); |
Frank Barchard | df06d80 | 2019-11-20 15:53:46 -0800 | [diff] [blame] | 541 | } |
Frank Barchard | df06d80 | 2019-11-20 15:53:46 -0800 | [diff] [blame] | 542 | static void f32_gemm_6x8s4__neonfma(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 543 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_6x8s4__neonfma, 6, 8, 1, 4, benchmark::utils::CheckNEONFMA); |
Frank Barchard | df06d80 | 2019-11-20 15:53:46 -0800 | [diff] [blame] | 544 | } |
Frank Barchard | df06d80 | 2019-11-20 15:53:46 -0800 | [diff] [blame] | 545 | static void f32_gemm_8x8s4__neon(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 546 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_8x8s4__neon, 8, 8, 1, 4, benchmark::utils::CheckNEON); |
Frank Barchard | df06d80 | 2019-11-20 15:53:46 -0800 | [diff] [blame] | 547 | } |
Frank Barchard | df06d80 | 2019-11-20 15:53:46 -0800 | [diff] [blame] | 548 | static void f32_gemm_8x8s4__neonfma(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 549 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_8x8s4__neonfma, 8, 8, 1, 4, benchmark::utils::CheckNEONFMA); |
Frank Barchard | df06d80 | 2019-11-20 15:53:46 -0800 | [diff] [blame] | 550 | } |
Frank Barchard | 95bebc9 | 2019-11-15 18:18:28 -0800 | [diff] [blame] | 551 | static void f32_ppmm_4x8_unipass__neonfma(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 552 | PPMM1PBenchmark(state, xnn_f32_ppmm_minmax_ukernel_4x8__neonfma, xnn_x32_packx_ukernel_4x__neon_st4, 4, 8, benchmark::utils::CheckNEONFMA); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 553 | } |
Frank Barchard | 95bebc9 | 2019-11-15 18:18:28 -0800 | [diff] [blame] | 554 | static void f32_ppmm_4x8_twopass__neonfma(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 555 | PPMM2PBenchmark(state, xnn_f32_ppmm_minmax_ukernel_4x8__neonfma, xnn_x32_packx_ukernel_4x__neon_st4, 4, 8, benchmark::utils::CheckNEONFMA); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 556 | } |
| 557 | |
Frank Barchard | 91317c5 | 2019-11-22 10:54:35 -0800 | [diff] [blame] | 558 | BENCHMARK_GEMM(f32_gemm_1x8__neon_lane_ld64) |
Frank Barchard | 91317c5 | 2019-11-22 10:54:35 -0800 | [diff] [blame] | 559 | BENCHMARK_GEMM(f32_gemm_4x8__neon_lane_ld64) |
Frank Barchard | 69172d9 | 2019-11-26 16:22:39 -0800 | [diff] [blame] | 560 | BENCHMARK_GEMM(f32_gemm_4x8__neon_lane_ld128) |
Frank Barchard | 91317c5 | 2019-11-22 10:54:35 -0800 | [diff] [blame] | 561 | BENCHMARK_GEMM(f32_gemm_5x8__neon_lane_ld64) |
Frank Barchard | 69172d9 | 2019-11-26 16:22:39 -0800 | [diff] [blame] | 562 | BENCHMARK_GEMM(f32_gemm_6x8__neon_lane_ld64) |
| 563 | BENCHMARK_GEMM(f32_gemm_6x8__neon_lane_ld128) |
| 564 | BENCHMARK_GEMM(f32_gemm_1x8__neonfma_dup_ld64) |
| 565 | BENCHMARK_GEMM(f32_gemm_4x8__neonfma_dup_ld128) |
| 566 | BENCHMARK_GEMM(f32_gemm_4x8__neonfma_dup_ld64) |
| 567 | BENCHMARK_GEMM(f32_gemm_6x8__neonfma_dup_ld64) |
| 568 | BENCHMARK_GEMM(f32_gemm_6x8__neonfma_dup_ld128) |
Frank Barchard | df06d80 | 2019-11-20 15:53:46 -0800 | [diff] [blame] | 569 | BENCHMARK_GEMM(f32_gemm_1x8s4__neon) |
| 570 | BENCHMARK_GEMM(f32_gemm_1x8s4__neonfma) |
| 571 | BENCHMARK_GEMM(f32_gemm_4x8s4__neon) |
| 572 | BENCHMARK_GEMM(f32_gemm_4x8s4__neonfma) |
| 573 | BENCHMARK_GEMM(f32_gemm_6x8s4__neon) |
| 574 | BENCHMARK_GEMM(f32_gemm_6x8s4__neonfma) |
| 575 | BENCHMARK_GEMM(f32_gemm_8x8s4__neon) |
| 576 | BENCHMARK_GEMM(f32_gemm_8x8s4__neonfma) |
Frank Barchard | 95bebc9 | 2019-11-15 18:18:28 -0800 | [diff] [blame] | 577 | BENCHMARK_GEMM(f32_ppmm_4x8_unipass__neonfma) |
| 578 | BENCHMARK_GEMM(f32_ppmm_4x8_twopass__neonfma) |
Marat Dukhan | 1dadbf7 | 2019-10-01 10:46:20 -0700 | [diff] [blame] | 579 | #endif // XNN_ARCH_ARM || XNN_ARCH_ARM64 |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 580 | |
Marat Dukhan | 1dadbf7 | 2019-10-01 10:46:20 -0700 | [diff] [blame] | 581 | #if XNN_ARCH_X86 || XNN_ARCH_X86_64 |
Frank Barchard | 95bebc9 | 2019-11-15 18:18:28 -0800 | [diff] [blame] | 582 | static void f32_gemm_1x8__sse_load1(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 583 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_1x8__sse_load1, 1, 8, 1, 1); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 584 | } |
Frank Barchard | 95bebc9 | 2019-11-15 18:18:28 -0800 | [diff] [blame] | 585 | static void f32_gemm_4x8__sse_load1(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 586 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_4x8__sse_load1, 4, 8, 1, 1); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 587 | } |
| 588 | |
Frank Barchard | 95bebc9 | 2019-11-15 18:18:28 -0800 | [diff] [blame] | 589 | static void f32_gemm_1x8__sse_dup(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 590 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_1x8__sse_dup, 1, 8, 1, 1); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 591 | } |
Frank Barchard | 95bebc9 | 2019-11-15 18:18:28 -0800 | [diff] [blame] | 592 | static void f32_gemm_4x8__sse_dup(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 593 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_4x8__sse_dup, 4, 8, 1, 1); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 594 | } |
| 595 | |
Frank Barchard | 95bebc9 | 2019-11-15 18:18:28 -0800 | [diff] [blame] | 596 | static void f32_gemm_1x8s4__sse(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 597 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_1x8s4__sse, 1, 8, 1, 4); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 598 | } |
Frank Barchard | 95bebc9 | 2019-11-15 18:18:28 -0800 | [diff] [blame] | 599 | static void f32_gemm_4x8s4__sse(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 600 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_4x8s4__sse, 4, 8, 1, 4); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 601 | } |
| 602 | |
Frank Barchard | 95bebc9 | 2019-11-15 18:18:28 -0800 | [diff] [blame] | 603 | static void f32_ppmm_4x8_unipass__sse(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 604 | PPMM1PBenchmark(state, xnn_f32_ppmm_minmax_ukernel_4x8__sse, xnn_x32_packx_ukernel_4x__sse, 4, 8); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 605 | } |
Frank Barchard | 95bebc9 | 2019-11-15 18:18:28 -0800 | [diff] [blame] | 606 | static void f32_ppmm_4x8_twopass__sse(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 607 | PPMM2PBenchmark(state, xnn_f32_ppmm_minmax_ukernel_4x8__sse, xnn_x32_packx_ukernel_4x__sse, 4, 8); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 608 | } |
| 609 | |
Marat Dukhan | fda12b8 | 2019-11-21 12:27:59 -0800 | [diff] [blame] | 610 | static void f32_gemm_1x8__avx_broadcast(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 611 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_1x8__avx_broadcast, 1, 8, 1, 1, benchmark::utils::CheckAVX); |
Marat Dukhan | fda12b8 | 2019-11-21 12:27:59 -0800 | [diff] [blame] | 612 | } |
Marat Dukhan | fda12b8 | 2019-11-21 12:27:59 -0800 | [diff] [blame] | 613 | static void f32_gemm_4x8__avx_broadcast(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 614 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_4x8__avx_broadcast, 4, 8, 1, 1, benchmark::utils::CheckAVX); |
Marat Dukhan | fda12b8 | 2019-11-21 12:27:59 -0800 | [diff] [blame] | 615 | } |
Marat Dukhan | fda12b8 | 2019-11-21 12:27:59 -0800 | [diff] [blame] | 616 | static void f32_gemm_5x8__avx_broadcast(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 617 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_5x8__avx_broadcast, 5, 8, 1, 1, benchmark::utils::CheckAVX); |
Marat Dukhan | fda12b8 | 2019-11-21 12:27:59 -0800 | [diff] [blame] | 618 | } |
Marat Dukhan | fda12b8 | 2019-11-21 12:27:59 -0800 | [diff] [blame] | 619 | static void f32_gemm_6x8__avx_broadcast(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 620 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_6x8__avx_broadcast, 6, 8, 1, 1, benchmark::utils::CheckAVX); |
Marat Dukhan | fda12b8 | 2019-11-21 12:27:59 -0800 | [diff] [blame] | 621 | } |
Marat Dukhan | fda12b8 | 2019-11-21 12:27:59 -0800 | [diff] [blame] | 622 | static void f32_gemm_7x8__avx_broadcast(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 623 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_7x8__avx_broadcast, 7, 8, 1, 1, benchmark::utils::CheckAVX); |
Marat Dukhan | fda12b8 | 2019-11-21 12:27:59 -0800 | [diff] [blame] | 624 | } |
Marat Dukhan | 2712132 | 2019-12-09 14:57:40 -0800 | [diff] [blame] | 625 | static void f32_gemm_1x16__avx_broadcast(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 626 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_1x16__avx_broadcast, 1, 16, 1, 1, benchmark::utils::CheckAVX); |
Marat Dukhan | 2712132 | 2019-12-09 14:57:40 -0800 | [diff] [blame] | 627 | } |
| 628 | static void f32_gemm_3x16__avx_broadcast(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 629 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_3x16__avx_broadcast, 4, 16, 1, 1, benchmark::utils::CheckAVX); |
Marat Dukhan | 2712132 | 2019-12-09 14:57:40 -0800 | [diff] [blame] | 630 | } |
| 631 | static void f32_gemm_4x16__avx_broadcast(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 632 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_4x16__avx_broadcast, 4, 16, 1, 1, benchmark::utils::CheckAVX); |
Marat Dukhan | 2712132 | 2019-12-09 14:57:40 -0800 | [diff] [blame] | 633 | } |
| 634 | static void f32_gemm_5x16__avx_broadcast(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 635 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_5x16__avx_broadcast, 5, 16, 1, 1, benchmark::utils::CheckAVX); |
Marat Dukhan | 2712132 | 2019-12-09 14:57:40 -0800 | [diff] [blame] | 636 | } |
Marat Dukhan | fda12b8 | 2019-11-21 12:27:59 -0800 | [diff] [blame] | 637 | |
| 638 | static void f32_gemm_1x8__fma3_broadcast(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 639 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_1x8__fma3_broadcast, 1, 8, 1, 1, benchmark::utils::CheckFMA3); |
Marat Dukhan | fda12b8 | 2019-11-21 12:27:59 -0800 | [diff] [blame] | 640 | } |
Marat Dukhan | fda12b8 | 2019-11-21 12:27:59 -0800 | [diff] [blame] | 641 | static void f32_gemm_4x8__fma3_broadcast(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 642 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_4x8__fma3_broadcast, 4, 8, 1, 1, benchmark::utils::CheckFMA3); |
Marat Dukhan | fda12b8 | 2019-11-21 12:27:59 -0800 | [diff] [blame] | 643 | } |
Marat Dukhan | fda12b8 | 2019-11-21 12:27:59 -0800 | [diff] [blame] | 644 | static void f32_gemm_5x8__fma3_broadcast(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 645 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_5x8__fma3_broadcast, 5, 8, 1, 1, benchmark::utils::CheckFMA3); |
Marat Dukhan | fda12b8 | 2019-11-21 12:27:59 -0800 | [diff] [blame] | 646 | } |
Marat Dukhan | fda12b8 | 2019-11-21 12:27:59 -0800 | [diff] [blame] | 647 | static void f32_gemm_6x8__fma3_broadcast(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 648 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_6x8__fma3_broadcast, 6, 8, 1, 1, benchmark::utils::CheckFMA3); |
Marat Dukhan | fda12b8 | 2019-11-21 12:27:59 -0800 | [diff] [blame] | 649 | } |
Marat Dukhan | fda12b8 | 2019-11-21 12:27:59 -0800 | [diff] [blame] | 650 | static void f32_gemm_7x8__fma3_broadcast(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 651 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_7x8__fma3_broadcast, 7, 8, 1, 1, benchmark::utils::CheckFMA3); |
Marat Dukhan | fda12b8 | 2019-11-21 12:27:59 -0800 | [diff] [blame] | 652 | } |
Marat Dukhan | fda12b8 | 2019-11-21 12:27:59 -0800 | [diff] [blame] | 653 | static void f32_gemm_8x8__fma3_broadcast(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 654 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_8x8__fma3_broadcast, 8, 8, 1, 1, benchmark::utils::CheckFMA3); |
Marat Dukhan | fda12b8 | 2019-11-21 12:27:59 -0800 | [diff] [blame] | 655 | } |
Marat Dukhan | 2712132 | 2019-12-09 14:57:40 -0800 | [diff] [blame] | 656 | static void f32_gemm_1x16__fma3_broadcast(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 657 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_1x16__fma3_broadcast, 1, 16, 1, 1, benchmark::utils::CheckFMA3); |
Marat Dukhan | 2712132 | 2019-12-09 14:57:40 -0800 | [diff] [blame] | 658 | } |
| 659 | static void f32_gemm_3x16__fma3_broadcast(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 660 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_3x16__fma3_broadcast, 4, 16, 1, 1, benchmark::utils::CheckFMA3); |
Marat Dukhan | 2712132 | 2019-12-09 14:57:40 -0800 | [diff] [blame] | 661 | } |
| 662 | static void f32_gemm_4x16__fma3_broadcast(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 663 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_4x16__fma3_broadcast, 4, 16, 1, 1, benchmark::utils::CheckFMA3); |
Marat Dukhan | 2712132 | 2019-12-09 14:57:40 -0800 | [diff] [blame] | 664 | } |
| 665 | static void f32_gemm_5x16__fma3_broadcast(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 666 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_5x16__fma3_broadcast, 5, 16, 1, 1, benchmark::utils::CheckFMA3); |
Marat Dukhan | 2712132 | 2019-12-09 14:57:40 -0800 | [diff] [blame] | 667 | } |
| 668 | |
| 669 | static void f32_gemm_1x16s4__fma3_broadcast(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 670 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_1x16s4__fma3_broadcast, 1, 16, 1, 4, benchmark::utils::CheckFMA3); |
Marat Dukhan | 2712132 | 2019-12-09 14:57:40 -0800 | [diff] [blame] | 671 | } |
| 672 | static void f32_gemm_3x16s4__fma3_broadcast(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 673 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_3x16s4__fma3_broadcast, 4, 16, 1, 4, benchmark::utils::CheckFMA3); |
Marat Dukhan | 2712132 | 2019-12-09 14:57:40 -0800 | [diff] [blame] | 674 | } |
| 675 | static void f32_gemm_4x16s4__fma3_broadcast(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 676 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_4x16s4__fma3_broadcast, 4, 16, 1, 4, benchmark::utils::CheckFMA3); |
Marat Dukhan | 2712132 | 2019-12-09 14:57:40 -0800 | [diff] [blame] | 677 | } |
| 678 | static void f32_gemm_5x16s4__fma3_broadcast(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 679 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_5x16s4__fma3_broadcast, 5, 16, 1, 4, benchmark::utils::CheckFMA3); |
Marat Dukhan | 2712132 | 2019-12-09 14:57:40 -0800 | [diff] [blame] | 680 | } |
Marat Dukhan | fda12b8 | 2019-11-21 12:27:59 -0800 | [diff] [blame] | 681 | |
Marat Dukhan | 0f349c4 | 2019-11-27 11:58:54 -0800 | [diff] [blame] | 682 | static void f32_gemm_1x16__avx512f_broadcast(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 683 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_1x16__avx512f_broadcast, 1, 16, 1, 1, benchmark::utils::CheckAVX512F); |
Marat Dukhan | 0f349c4 | 2019-11-27 11:58:54 -0800 | [diff] [blame] | 684 | } |
| 685 | static void f32_gemm_4x16__avx512f_broadcast(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 686 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_4x16__avx512f_broadcast, 4, 16, 1, 1, benchmark::utils::CheckAVX512F); |
Marat Dukhan | 0f349c4 | 2019-11-27 11:58:54 -0800 | [diff] [blame] | 687 | } |
| 688 | static void f32_gemm_5x16__avx512f_broadcast(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 689 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_5x16__avx512f_broadcast, 5, 16, 1, 1, benchmark::utils::CheckAVX512F); |
Marat Dukhan | 0f349c4 | 2019-11-27 11:58:54 -0800 | [diff] [blame] | 690 | } |
| 691 | static void f32_gemm_6x16__avx512f_broadcast(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 692 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_6x16__avx512f_broadcast, 6, 16, 1, 1, benchmark::utils::CheckAVX512F); |
Marat Dukhan | 0f349c4 | 2019-11-27 11:58:54 -0800 | [diff] [blame] | 693 | } |
| 694 | static void f32_gemm_7x16__avx512f_broadcast(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 695 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_7x16__avx512f_broadcast, 7, 16, 1, 1, benchmark::utils::CheckAVX512F); |
Marat Dukhan | 0f349c4 | 2019-11-27 11:58:54 -0800 | [diff] [blame] | 696 | } |
| 697 | static void f32_gemm_8x16__avx512f_broadcast(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 698 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_8x16__avx512f_broadcast, 8, 16, 1, 1, benchmark::utils::CheckAVX512F); |
Marat Dukhan | 0f349c4 | 2019-11-27 11:58:54 -0800 | [diff] [blame] | 699 | } |
| 700 | |
Frank Barchard | 95bebc9 | 2019-11-15 18:18:28 -0800 | [diff] [blame] | 701 | BENCHMARK_GEMM(f32_gemm_1x8__sse_load1) |
| 702 | BENCHMARK_GEMM(f32_gemm_4x8__sse_load1) |
Marat Dukhan | 0f349c4 | 2019-11-27 11:58:54 -0800 | [diff] [blame] | 703 | |
Frank Barchard | 95bebc9 | 2019-11-15 18:18:28 -0800 | [diff] [blame] | 704 | BENCHMARK_GEMM(f32_gemm_1x8__sse_dup) |
| 705 | BENCHMARK_GEMM(f32_gemm_4x8__sse_dup) |
Marat Dukhan | 0f349c4 | 2019-11-27 11:58:54 -0800 | [diff] [blame] | 706 | |
Frank Barchard | 95bebc9 | 2019-11-15 18:18:28 -0800 | [diff] [blame] | 707 | BENCHMARK_GEMM(f32_gemm_1x8s4__sse) |
| 708 | BENCHMARK_GEMM(f32_gemm_4x8s4__sse) |
Marat Dukhan | 0f349c4 | 2019-11-27 11:58:54 -0800 | [diff] [blame] | 709 | |
Frank Barchard | 95bebc9 | 2019-11-15 18:18:28 -0800 | [diff] [blame] | 710 | BENCHMARK_GEMM(f32_ppmm_4x8_unipass__sse) |
| 711 | BENCHMARK_GEMM(f32_ppmm_4x8_twopass__sse) |
Marat Dukhan | 0f349c4 | 2019-11-27 11:58:54 -0800 | [diff] [blame] | 712 | |
Marat Dukhan | fda12b8 | 2019-11-21 12:27:59 -0800 | [diff] [blame] | 713 | BENCHMARK_GEMM(f32_gemm_1x8__avx_broadcast) |
| 714 | BENCHMARK_GEMM(f32_gemm_4x8__avx_broadcast) |
| 715 | BENCHMARK_GEMM(f32_gemm_5x8__avx_broadcast) |
| 716 | BENCHMARK_GEMM(f32_gemm_6x8__avx_broadcast) |
| 717 | BENCHMARK_GEMM(f32_gemm_7x8__avx_broadcast) |
Marat Dukhan | 2712132 | 2019-12-09 14:57:40 -0800 | [diff] [blame] | 718 | BENCHMARK_GEMM(f32_gemm_1x16__avx_broadcast) |
| 719 | BENCHMARK_GEMM(f32_gemm_3x16__avx_broadcast) |
| 720 | BENCHMARK_GEMM(f32_gemm_4x16__avx_broadcast) |
| 721 | BENCHMARK_GEMM(f32_gemm_5x16__avx_broadcast) |
Marat Dukhan | 0f349c4 | 2019-11-27 11:58:54 -0800 | [diff] [blame] | 722 | |
Marat Dukhan | fda12b8 | 2019-11-21 12:27:59 -0800 | [diff] [blame] | 723 | BENCHMARK_GEMM(f32_gemm_1x8__fma3_broadcast) |
| 724 | BENCHMARK_GEMM(f32_gemm_4x8__fma3_broadcast) |
| 725 | BENCHMARK_GEMM(f32_gemm_5x8__fma3_broadcast) |
| 726 | BENCHMARK_GEMM(f32_gemm_6x8__fma3_broadcast) |
| 727 | BENCHMARK_GEMM(f32_gemm_7x8__fma3_broadcast) |
| 728 | BENCHMARK_GEMM(f32_gemm_8x8__fma3_broadcast) |
Marat Dukhan | 2712132 | 2019-12-09 14:57:40 -0800 | [diff] [blame] | 729 | BENCHMARK_GEMM(f32_gemm_1x16__fma3_broadcast) |
| 730 | BENCHMARK_GEMM(f32_gemm_3x16__fma3_broadcast) |
| 731 | BENCHMARK_GEMM(f32_gemm_4x16__fma3_broadcast) |
| 732 | BENCHMARK_GEMM(f32_gemm_5x16__fma3_broadcast) |
| 733 | |
| 734 | BENCHMARK_GEMM(f32_gemm_1x16s4__fma3_broadcast) |
| 735 | BENCHMARK_GEMM(f32_gemm_3x16s4__fma3_broadcast) |
| 736 | BENCHMARK_GEMM(f32_gemm_4x16s4__fma3_broadcast) |
| 737 | BENCHMARK_GEMM(f32_gemm_5x16s4__fma3_broadcast) |
Marat Dukhan | 0f349c4 | 2019-11-27 11:58:54 -0800 | [diff] [blame] | 738 | |
| 739 | BENCHMARK_GEMM(f32_gemm_1x16__avx512f_broadcast) |
| 740 | BENCHMARK_GEMM(f32_gemm_4x16__avx512f_broadcast) |
| 741 | BENCHMARK_GEMM(f32_gemm_5x16__avx512f_broadcast) |
| 742 | BENCHMARK_GEMM(f32_gemm_6x16__avx512f_broadcast) |
| 743 | BENCHMARK_GEMM(f32_gemm_7x16__avx512f_broadcast) |
| 744 | BENCHMARK_GEMM(f32_gemm_8x16__avx512f_broadcast) |
Marat Dukhan | 1dadbf7 | 2019-10-01 10:46:20 -0700 | [diff] [blame] | 745 | #endif // XNN_ARCH_X86 || XNN_ARCH_X86_64 |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 746 | |
Marat Dukhan | 1bbf96b | 2020-06-15 23:01:20 -0700 | [diff] [blame] | 747 | #if XNN_ARCH_WASMSIMD |
| 748 | static void f32_gemm_3x8__wasmsimd_loadsplat_arm(benchmark::State& state, const char* net) { |
| 749 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_3x8__wasmsimd_loadsplat_arm, 3, 8, 1, 1); |
| 750 | } |
| 751 | |
| 752 | static void f32_gemm_4x8__wasmsimd_loadsplat_arm(benchmark::State& state, const char* net) { |
| 753 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_4x8__wasmsimd_loadsplat_arm, 4, 8, 1, 1); |
| 754 | } |
| 755 | |
| 756 | static void f32_gemm_5x8__wasmsimd_loadsplat_arm(benchmark::State& state, const char* net) { |
| 757 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_5x8__wasmsimd_loadsplat_arm, 5, 8, 1, 1); |
| 758 | } |
| 759 | |
| 760 | static void f32_gemm_6x8__wasmsimd_loadsplat_arm(benchmark::State& state, const char* net) { |
| 761 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_6x8__wasmsimd_loadsplat_arm, 6, 8, 1, 1); |
| 762 | } |
| 763 | |
| 764 | static void f32_gemm_3x8__wasmsimd_loadsplat_x86(benchmark::State& state, const char* net) { |
| 765 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_3x8__wasmsimd_loadsplat_x86, 3, 8, 1, 1); |
| 766 | } |
| 767 | |
| 768 | static void f32_gemm_4x8__wasmsimd_loadsplat_x86(benchmark::State& state, const char* net) { |
| 769 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_4x8__wasmsimd_loadsplat_x86, 4, 8, 1, 1); |
| 770 | } |
| 771 | |
| 772 | static void f32_gemm_5x8__wasmsimd_loadsplat_x86(benchmark::State& state, const char* net) { |
| 773 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_5x8__wasmsimd_loadsplat_x86, 5, 8, 1, 1); |
| 774 | } |
| 775 | |
| 776 | static void f32_gemm_6x8__wasmsimd_loadsplat_x86(benchmark::State& state, const char* net) { |
| 777 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_6x8__wasmsimd_loadsplat_x86, 6, 8, 1, 1); |
| 778 | } |
| 779 | |
| 780 | static void f32_gemm_3x8__wasmsimd_splat_arm(benchmark::State& state, const char* net) { |
| 781 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_3x8__wasmsimd_splat_arm, 3, 8, 1, 1); |
| 782 | } |
| 783 | |
| 784 | static void f32_gemm_4x8__wasmsimd_splat_arm(benchmark::State& state, const char* net) { |
| 785 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_4x8__wasmsimd_splat_arm, 4, 8, 1, 1); |
| 786 | } |
| 787 | |
| 788 | static void f32_gemm_5x8__wasmsimd_splat_arm(benchmark::State& state, const char* net) { |
| 789 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_5x8__wasmsimd_splat_arm, 5, 8, 1, 1); |
| 790 | } |
| 791 | |
| 792 | static void f32_gemm_6x8__wasmsimd_splat_arm(benchmark::State& state, const char* net) { |
| 793 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_6x8__wasmsimd_splat_arm, 6, 8, 1, 1); |
| 794 | } |
| 795 | |
| 796 | static void f32_gemm_3x8__wasmsimd_splat_x86(benchmark::State& state, const char* net) { |
| 797 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_3x8__wasmsimd_splat_x86, 3, 8, 1, 1); |
| 798 | } |
| 799 | |
| 800 | static void f32_gemm_4x8__wasmsimd_splat_x86(benchmark::State& state, const char* net) { |
| 801 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_4x8__wasmsimd_splat_x86, 4, 8, 1, 1); |
| 802 | } |
| 803 | |
| 804 | static void f32_gemm_5x8__wasmsimd_splat_x86(benchmark::State& state, const char* net) { |
| 805 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_5x8__wasmsimd_splat_x86, 5, 8, 1, 1); |
| 806 | } |
| 807 | |
| 808 | static void f32_gemm_6x8__wasmsimd_splat_x86(benchmark::State& state, const char* net) { |
| 809 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_6x8__wasmsimd_splat_x86, 6, 8, 1, 1); |
| 810 | } |
| 811 | |
| 812 | static void f32_gemm_3x8s4__wasmsimd_arm(benchmark::State& state, const char* net) { |
| 813 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_3x8s4__wasmsimd_arm, 3, 8, 1, 4); |
| 814 | } |
| 815 | |
| 816 | static void f32_gemm_4x8s4__wasmsimd_arm(benchmark::State& state, const char* net) { |
| 817 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_4x8s4__wasmsimd_arm, 4, 8, 1, 4); |
| 818 | } |
| 819 | |
| 820 | static void f32_gemm_5x8s4__wasmsimd_arm(benchmark::State& state, const char* net) { |
| 821 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_5x8s4__wasmsimd_arm, 5, 8, 1, 4); |
| 822 | } |
| 823 | |
| 824 | static void f32_gemm_6x8s4__wasmsimd_arm(benchmark::State& state, const char* net) { |
| 825 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_6x8s4__wasmsimd_arm, 6, 8, 1, 4); |
| 826 | } |
| 827 | |
| 828 | static void f32_gemm_3x8s4__wasmsimd_x86(benchmark::State& state, const char* net) { |
| 829 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_3x8s4__wasmsimd_x86, 3, 8, 1, 4); |
| 830 | } |
| 831 | |
| 832 | static void f32_gemm_4x8s4__wasmsimd_x86(benchmark::State& state, const char* net) { |
| 833 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_4x8s4__wasmsimd_x86, 4, 8, 1, 4); |
| 834 | } |
| 835 | |
| 836 | static void f32_gemm_5x8s4__wasmsimd_x86(benchmark::State& state, const char* net) { |
| 837 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_5x8s4__wasmsimd_x86, 5, 8, 1, 4); |
| 838 | } |
| 839 | |
| 840 | static void f32_gemm_6x8s4__wasmsimd_x86(benchmark::State& state, const char* net) { |
| 841 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_6x8s4__wasmsimd_x86, 6, 8, 1, 4); |
| 842 | } |
| 843 | |
Marat Dukhan | 0d0d882 | 2020-07-23 23:37:56 -0700 | [diff] [blame] | 844 | static void f32_ppmm_4x8_unipass__wasmsimd_splat_arm(benchmark::State& state, const char* net) { |
| 845 | PPMM1PBenchmark(state, xnn_f32_ppmm_minmax_ukernel_4x8__wasmsimd_splat_arm, xnn_x32_packx_ukernel_4x__wasmsimd, 4, 8); |
| 846 | } |
| 847 | static void f32_ppmm_4x8_unipass__wasmsimd_splat_x86(benchmark::State& state, const char* net) { |
| 848 | PPMM1PBenchmark(state, xnn_f32_ppmm_minmax_ukernel_4x8__wasmsimd_splat_x86, xnn_x32_packx_ukernel_4x__wasmsimd, 4, 8); |
| 849 | } |
| 850 | |
| 851 | static void f32_ppmm_4x8_twopass__wasmsimd_splat_arm(benchmark::State& state, const char* net) { |
| 852 | PPMM2PBenchmark(state, xnn_f32_ppmm_minmax_ukernel_4x8__wasmsimd_splat_arm, xnn_x32_packx_ukernel_4x__wasmsimd, 4, 8); |
| 853 | } |
| 854 | static void f32_ppmm_4x8_twopass__wasmsimd_splat_x86(benchmark::State& state, const char* net) { |
| 855 | PPMM2PBenchmark(state, xnn_f32_ppmm_minmax_ukernel_4x8__wasmsimd_splat_x86, xnn_x32_packx_ukernel_4x__wasmsimd, 4, 8); |
| 856 | } |
| 857 | |
Marat Dukhan | 1bbf96b | 2020-06-15 23:01:20 -0700 | [diff] [blame] | 858 | BENCHMARK_GEMM(f32_gemm_3x8__wasmsimd_loadsplat_arm) |
| 859 | BENCHMARK_GEMM(f32_gemm_4x8__wasmsimd_loadsplat_arm) |
| 860 | BENCHMARK_GEMM(f32_gemm_5x8__wasmsimd_loadsplat_arm) |
| 861 | BENCHMARK_GEMM(f32_gemm_6x8__wasmsimd_loadsplat_arm) |
| 862 | BENCHMARK_GEMM(f32_gemm_3x8__wasmsimd_loadsplat_x86) |
| 863 | BENCHMARK_GEMM(f32_gemm_4x8__wasmsimd_loadsplat_x86) |
| 864 | BENCHMARK_GEMM(f32_gemm_5x8__wasmsimd_loadsplat_x86) |
| 865 | BENCHMARK_GEMM(f32_gemm_6x8__wasmsimd_loadsplat_x86) |
| 866 | BENCHMARK_GEMM(f32_gemm_3x8__wasmsimd_splat_arm) |
| 867 | BENCHMARK_GEMM(f32_gemm_4x8__wasmsimd_splat_arm) |
| 868 | BENCHMARK_GEMM(f32_gemm_5x8__wasmsimd_splat_arm) |
| 869 | BENCHMARK_GEMM(f32_gemm_6x8__wasmsimd_splat_arm) |
| 870 | BENCHMARK_GEMM(f32_gemm_3x8__wasmsimd_splat_x86) |
| 871 | BENCHMARK_GEMM(f32_gemm_4x8__wasmsimd_splat_x86) |
| 872 | BENCHMARK_GEMM(f32_gemm_5x8__wasmsimd_splat_x86) |
| 873 | BENCHMARK_GEMM(f32_gemm_6x8__wasmsimd_splat_x86) |
| 874 | BENCHMARK_GEMM(f32_gemm_3x8s4__wasmsimd_arm) |
| 875 | BENCHMARK_GEMM(f32_gemm_4x8s4__wasmsimd_arm) |
| 876 | BENCHMARK_GEMM(f32_gemm_5x8s4__wasmsimd_arm) |
| 877 | BENCHMARK_GEMM(f32_gemm_6x8s4__wasmsimd_arm) |
| 878 | BENCHMARK_GEMM(f32_gemm_3x8s4__wasmsimd_x86) |
| 879 | BENCHMARK_GEMM(f32_gemm_4x8s4__wasmsimd_x86) |
| 880 | BENCHMARK_GEMM(f32_gemm_5x8s4__wasmsimd_x86) |
| 881 | BENCHMARK_GEMM(f32_gemm_6x8s4__wasmsimd_x86) |
Marat Dukhan | 0d0d882 | 2020-07-23 23:37:56 -0700 | [diff] [blame] | 882 | BENCHMARK_GEMM(f32_ppmm_4x8_unipass__wasmsimd_splat_arm) |
| 883 | BENCHMARK_GEMM(f32_ppmm_4x8_unipass__wasmsimd_splat_x86) |
| 884 | BENCHMARK_GEMM(f32_ppmm_4x8_twopass__wasmsimd_splat_arm) |
| 885 | BENCHMARK_GEMM(f32_ppmm_4x8_twopass__wasmsimd_splat_x86) |
Marat Dukhan | 1bbf96b | 2020-06-15 23:01:20 -0700 | [diff] [blame] | 886 | #endif // XNN_ARCH_WASMSIMD |
| 887 | |
Frank Barchard | 95bebc9 | 2019-11-15 18:18:28 -0800 | [diff] [blame] | 888 | static void f32_gemm_1x4__scalar(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 889 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_1x4__scalar, 1, 4, 1, 1); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 890 | } |
| 891 | |
Frank Barchard | 95bebc9 | 2019-11-15 18:18:28 -0800 | [diff] [blame] | 892 | static void f32_gemm_2x4__scalar(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 893 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_2x4__scalar, 2, 4, 1, 1); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 894 | } |
| 895 | |
Frank Barchard | 95bebc9 | 2019-11-15 18:18:28 -0800 | [diff] [blame] | 896 | static void f32_gemm_4x4__scalar(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 897 | GEMMBenchmark(state, xnn_f32_gemm_minmax_ukernel_4x4__scalar, 4, 4, 1, 1); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 898 | } |
| 899 | |
Frank Barchard | 95bebc9 | 2019-11-15 18:18:28 -0800 | [diff] [blame] | 900 | static void f32_ppmm_2x4_unipass__scalar(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 901 | PPMM1PBenchmark(state, xnn_f32_ppmm_minmax_ukernel_2x4__scalar, xnn_x32_packx_ukernel_2x__scalar, 2, 4); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 902 | } |
| 903 | |
Frank Barchard | 95bebc9 | 2019-11-15 18:18:28 -0800 | [diff] [blame] | 904 | static void f32_ppmm_4x2_unipass__scalar(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 905 | PPMM1PBenchmark(state, xnn_f32_ppmm_minmax_ukernel_4x2__scalar, xnn_x32_packx_ukernel_4x__scalar, 4, 2); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 906 | } |
| 907 | |
Frank Barchard | 95bebc9 | 2019-11-15 18:18:28 -0800 | [diff] [blame] | 908 | static void f32_ppmm_4x4_unipass__scalar(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 909 | PPMM1PBenchmark(state, xnn_f32_ppmm_minmax_ukernel_4x4__scalar, xnn_x32_packx_ukernel_4x__scalar, 4, 4); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 910 | } |
| 911 | |
Frank Barchard | 95bebc9 | 2019-11-15 18:18:28 -0800 | [diff] [blame] | 912 | static void f32_ppmm_3x3_unipass__scalar(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 913 | PPMM1PBenchmark(state, xnn_f32_ppmm_minmax_ukernel_3x3__scalar, xnn_x32_packx_ukernel_3x__scalar, 3, 3); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 914 | } |
| 915 | |
Frank Barchard | 95bebc9 | 2019-11-15 18:18:28 -0800 | [diff] [blame] | 916 | static void f32_ppmm_2x4_twopass__scalar(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 917 | PPMM2PBenchmark(state, xnn_f32_ppmm_minmax_ukernel_2x4__scalar, xnn_x32_packx_ukernel_2x__scalar, 2, 4); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 918 | } |
| 919 | |
Frank Barchard | 95bebc9 | 2019-11-15 18:18:28 -0800 | [diff] [blame] | 920 | static void f32_ppmm_4x2_twopass__scalar(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 921 | PPMM2PBenchmark(state, xnn_f32_ppmm_minmax_ukernel_4x2__scalar, xnn_x32_packx_ukernel_4x__scalar, 4, 2); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 922 | } |
| 923 | |
Frank Barchard | 95bebc9 | 2019-11-15 18:18:28 -0800 | [diff] [blame] | 924 | static void f32_ppmm_4x4_twopass__scalar(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 925 | PPMM2PBenchmark(state, xnn_f32_ppmm_minmax_ukernel_4x4__scalar, xnn_x32_packx_ukernel_4x__scalar, 4, 4); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 926 | } |
| 927 | |
Frank Barchard | 95bebc9 | 2019-11-15 18:18:28 -0800 | [diff] [blame] | 928 | static void f32_ppmm_3x3_twopass__scalar(benchmark::State& state, const char* net) { |
Marat Dukhan | de06f49 | 2020-04-09 00:19:31 -0700 | [diff] [blame] | 929 | PPMM2PBenchmark(state, xnn_f32_ppmm_minmax_ukernel_3x3__scalar, xnn_x32_packx_ukernel_3x__scalar, 3, 3); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 930 | } |
| 931 | |
Frank Barchard | 95bebc9 | 2019-11-15 18:18:28 -0800 | [diff] [blame] | 932 | BENCHMARK_GEMM(f32_gemm_1x4__scalar) |
| 933 | BENCHMARK_GEMM(f32_gemm_2x4__scalar) |
| 934 | BENCHMARK_GEMM(f32_gemm_4x4__scalar) |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 935 | |
Frank Barchard | 95bebc9 | 2019-11-15 18:18:28 -0800 | [diff] [blame] | 936 | BENCHMARK_GEMM(f32_ppmm_2x4_unipass__scalar) |
| 937 | BENCHMARK_GEMM(f32_ppmm_4x2_unipass__scalar) |
| 938 | BENCHMARK_GEMM(f32_ppmm_4x4_unipass__scalar) |
| 939 | BENCHMARK_GEMM(f32_ppmm_3x3_unipass__scalar) |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 940 | |
Frank Barchard | 95bebc9 | 2019-11-15 18:18:28 -0800 | [diff] [blame] | 941 | BENCHMARK_GEMM(f32_ppmm_2x4_twopass__scalar) |
| 942 | BENCHMARK_GEMM(f32_ppmm_4x2_twopass__scalar) |
| 943 | BENCHMARK_GEMM(f32_ppmm_4x4_twopass__scalar) |
| 944 | BENCHMARK_GEMM(f32_ppmm_3x3_twopass__scalar) |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 945 | |
Marat Dukhan | 33f0c7a | 2019-10-01 13:33:08 -0700 | [diff] [blame] | 946 | #ifdef BENCHMARK_RUY |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 947 | BENCHMARK_GEMM(ruy_st) |
Marat Dukhan | 33f0c7a | 2019-10-01 13:33:08 -0700 | [diff] [blame] | 948 | #endif // BENCHMARK_RUY |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 949 | |
| 950 | #ifndef XNNPACK_BENCHMARK_NO_MAIN |
| 951 | BENCHMARK_MAIN(); |
| 952 | #endif |