Marat Dukhan | f4db2f3 | 2020-06-30 10:55:30 -0700 | [diff] [blame] | 1 | // Copyright 2020 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 <cmath> |
| 8 | #include <functional> |
| 9 | #include <random> |
| 10 | #include <vector> |
| 11 | |
| 12 | #include <benchmark/benchmark.h> |
| 13 | #include "bench/utils.h" |
| 14 | |
| 15 | #include <xnnpack/AlignedAllocator.h> |
| 16 | #include <xnnpack/common.h> |
Marat Dukhan | f4db2f3 | 2020-06-30 10:55:30 -0700 | [diff] [blame] | 17 | #include <xnnpack/params.h> |
| 18 | #include <xnnpack/params-init.h> |
Marat Dukhan | 5aeb32b | 2021-08-06 22:08:39 -0700 | [diff] [blame] | 19 | #include <xnnpack/vunary.h> |
Marat Dukhan | f4db2f3 | 2020-06-30 10:55:30 -0700 | [diff] [blame] | 20 | |
| 21 | |
| 22 | static void f32_vsqrt( |
| 23 | benchmark::State& state, |
| 24 | xnn_f32_vsqrt_ukernel_function vsqrt, |
| 25 | benchmark::utils::IsaCheckFunction isa_check = nullptr) |
| 26 | { |
| 27 | if (isa_check && !isa_check(state)) { |
| 28 | return; |
| 29 | } |
| 30 | |
Marat Dukhan | 5aeb32b | 2021-08-06 22:08:39 -0700 | [diff] [blame] | 31 | const size_t num_elements = state.range(0); |
| 32 | std::vector<float, AlignedAllocator<float, 64>> input(num_elements); |
| 33 | std::vector<float, AlignedAllocator<float, 64>> output(num_elements); |
Marat Dukhan | f4db2f3 | 2020-06-30 10:55:30 -0700 | [diff] [blame] | 34 | |
| 35 | std::random_device random_device; |
| 36 | auto rng = std::mt19937(random_device()); |
| 37 | auto f32rng = std::bind(std::uniform_real_distribution<float>(0.0f, 10.0f), std::ref(rng)); |
| 38 | std::generate(input.begin(), input.end(), std::ref(f32rng)); |
| 39 | std::fill(output.begin(), output.end(), std::nanf("")); |
| 40 | |
Marat Dukhan | f56f4c4 | 2021-05-17 01:47:20 -0700 | [diff] [blame] | 41 | union xnn_f32_sqrt_params params; |
| 42 | xnn_init_f32_sqrt_params(¶ms); |
Marat Dukhan | f4db2f3 | 2020-06-30 10:55:30 -0700 | [diff] [blame] | 43 | for (auto _ : state) { |
Marat Dukhan | 5aeb32b | 2021-08-06 22:08:39 -0700 | [diff] [blame] | 44 | vsqrt(num_elements * sizeof(float), input.data(), output.data(), ¶ms); |
Marat Dukhan | f4db2f3 | 2020-06-30 10:55:30 -0700 | [diff] [blame] | 45 | } |
| 46 | |
| 47 | const uint64_t cpu_frequency = benchmark::utils::GetCurrentCpuFrequency(); |
| 48 | if (cpu_frequency != 0) { |
| 49 | state.counters["cpufreq"] = cpu_frequency; |
| 50 | } |
| 51 | |
Marat Dukhan | 5aeb32b | 2021-08-06 22:08:39 -0700 | [diff] [blame] | 52 | const size_t elements_per_iteration = num_elements; |
Marat Dukhan | f4db2f3 | 2020-06-30 10:55:30 -0700 | [diff] [blame] | 53 | state.counters["elements"] = |
| 54 | benchmark::Counter(uint64_t(state.iterations()) * elements_per_iteration, benchmark::Counter::kIsRate); |
| 55 | |
Marat Dukhan | 5aeb32b | 2021-08-06 22:08:39 -0700 | [diff] [blame] | 56 | const size_t bytes_per_iteration = 2 * num_elements * sizeof(float); |
Marat Dukhan | f4db2f3 | 2020-06-30 10:55:30 -0700 | [diff] [blame] | 57 | state.counters["bytes"] = |
| 58 | benchmark::Counter(uint64_t(state.iterations()) * bytes_per_iteration, benchmark::Counter::kIsRate); |
| 59 | } |
| 60 | |
| 61 | #if XNN_ARCH_ARM64 |
Marat Dukhan | 5aeb32b | 2021-08-06 22:08:39 -0700 | [diff] [blame] | 62 | BENCHMARK_CAPTURE(f32_vsqrt, neon_sqrt_x4, |
| 63 | xnn_f32_vsqrt_ukernel__neon_sqrt_x4) |
| 64 | ->Apply(benchmark::utils::UnaryElementwiseParameters<float, float>) |
Marat Dukhan | f4db2f3 | 2020-06-30 10:55:30 -0700 | [diff] [blame] | 65 | ->UseRealTime(); |
Marat Dukhan | 5aeb32b | 2021-08-06 22:08:39 -0700 | [diff] [blame] | 66 | BENCHMARK_CAPTURE(f32_vsqrt, neon_sqrt_x8, |
| 67 | xnn_f32_vsqrt_ukernel__neon_sqrt_x8) |
| 68 | ->Apply(benchmark::utils::UnaryElementwiseParameters<float, float>) |
Marat Dukhan | f4db2f3 | 2020-06-30 10:55:30 -0700 | [diff] [blame] | 69 | ->UseRealTime(); |
| 70 | #endif // XNN_ARCH_ARM64 |
| 71 | |
| 72 | #if XNN_ARCH_ARM64 || XNN_ARCH_ARM64 |
Marat Dukhan | 5aeb32b | 2021-08-06 22:08:39 -0700 | [diff] [blame] | 73 | BENCHMARK_CAPTURE(f32_vsqrt, neonfma_nr1rsqrts1fma1adj_x4, |
| 74 | xnn_f32_vsqrt_ukernel__neonfma_nr1rsqrts1fma1adj_x4, |
| 75 | benchmark::utils::CheckNEONFMA) |
| 76 | ->Apply(benchmark::utils::UnaryElementwiseParameters<float, float>) |
Marat Dukhan | f4db2f3 | 2020-06-30 10:55:30 -0700 | [diff] [blame] | 77 | ->UseRealTime(); |
Marat Dukhan | 5aeb32b | 2021-08-06 22:08:39 -0700 | [diff] [blame] | 78 | BENCHMARK_CAPTURE(f32_vsqrt, neonfma_nr1rsqrts1fma1adj_x8, |
| 79 | xnn_f32_vsqrt_ukernel__neonfma_nr1rsqrts1fma1adj_x8, |
| 80 | benchmark::utils::CheckNEONFMA) |
| 81 | ->Apply(benchmark::utils::UnaryElementwiseParameters<float, float>) |
Marat Dukhan | f4db2f3 | 2020-06-30 10:55:30 -0700 | [diff] [blame] | 82 | ->UseRealTime(); |
Marat Dukhan | 5aeb32b | 2021-08-06 22:08:39 -0700 | [diff] [blame] | 83 | BENCHMARK_CAPTURE(f32_vsqrt, neonfma_nr1rsqrts1fma1adj_x12, |
| 84 | xnn_f32_vsqrt_ukernel__neonfma_nr1rsqrts1fma1adj_x12, |
| 85 | benchmark::utils::CheckNEONFMA) |
| 86 | ->Apply(benchmark::utils::UnaryElementwiseParameters<float, float>) |
Marat Dukhan | f4db2f3 | 2020-06-30 10:55:30 -0700 | [diff] [blame] | 87 | ->UseRealTime(); |
Marat Dukhan | 5aeb32b | 2021-08-06 22:08:39 -0700 | [diff] [blame] | 88 | BENCHMARK_CAPTURE(f32_vsqrt, neonfma_nr1rsqrts1fma1adj_x16, |
| 89 | xnn_f32_vsqrt_ukernel__neonfma_nr1rsqrts1fma1adj_x16, |
| 90 | benchmark::utils::CheckNEONFMA) |
| 91 | ->Apply(benchmark::utils::UnaryElementwiseParameters<float, float>) |
Marat Dukhan | f4db2f3 | 2020-06-30 10:55:30 -0700 | [diff] [blame] | 92 | ->UseRealTime(); |
Marat Dukhan | 5aeb32b | 2021-08-06 22:08:39 -0700 | [diff] [blame] | 93 | BENCHMARK_CAPTURE(f32_vsqrt, neonfma_nr1rsqrts1fma1adj_x20, |
| 94 | xnn_f32_vsqrt_ukernel__neonfma_nr1rsqrts1fma1adj_x20, |
| 95 | benchmark::utils::CheckNEONFMA) |
| 96 | ->Apply(benchmark::utils::UnaryElementwiseParameters<float, float>) |
Marat Dukhan | f4db2f3 | 2020-06-30 10:55:30 -0700 | [diff] [blame] | 97 | ->UseRealTime(); |
Marat Dukhan | 5aeb32b | 2021-08-06 22:08:39 -0700 | [diff] [blame] | 98 | BENCHMARK_CAPTURE(f32_vsqrt, neonfma_nr1rsqrts1fma1adj_x24, |
| 99 | xnn_f32_vsqrt_ukernel__neonfma_nr1rsqrts1fma1adj_x24, |
| 100 | benchmark::utils::CheckNEONFMA) |
| 101 | ->Apply(benchmark::utils::UnaryElementwiseParameters<float, float>) |
Marat Dukhan | f4db2f3 | 2020-06-30 10:55:30 -0700 | [diff] [blame] | 102 | ->UseRealTime(); |
Marat Dukhan | 5aeb32b | 2021-08-06 22:08:39 -0700 | [diff] [blame] | 103 | BENCHMARK_CAPTURE(f32_vsqrt, neonfma_nr1rsqrts1fma1adj_x28, |
| 104 | xnn_f32_vsqrt_ukernel__neonfma_nr1rsqrts1fma1adj_x28, |
| 105 | benchmark::utils::CheckNEONFMA) |
| 106 | ->Apply(benchmark::utils::UnaryElementwiseParameters<float, float>) |
Marat Dukhan | f4db2f3 | 2020-06-30 10:55:30 -0700 | [diff] [blame] | 107 | ->UseRealTime(); |
Marat Dukhan | 5aeb32b | 2021-08-06 22:08:39 -0700 | [diff] [blame] | 108 | BENCHMARK_CAPTURE(f32_vsqrt, neonfma_nr1rsqrts1fma1adj_x32, |
| 109 | xnn_f32_vsqrt_ukernel__neonfma_nr1rsqrts1fma1adj_x32, |
| 110 | benchmark::utils::CheckNEONFMA) |
| 111 | ->Apply(benchmark::utils::UnaryElementwiseParameters<float, float>) |
Marat Dukhan | f4db2f3 | 2020-06-30 10:55:30 -0700 | [diff] [blame] | 112 | ->UseRealTime(); |
Marat Dukhan | 5aeb32b | 2021-08-06 22:08:39 -0700 | [diff] [blame] | 113 | BENCHMARK_CAPTURE(f32_vsqrt, neonfma_nr1rsqrts1fma1adj_x36, |
| 114 | xnn_f32_vsqrt_ukernel__neonfma_nr1rsqrts1fma1adj_x36, |
| 115 | benchmark::utils::CheckNEONFMA) |
| 116 | ->Apply(benchmark::utils::UnaryElementwiseParameters<float, float>) |
Marat Dukhan | f4db2f3 | 2020-06-30 10:55:30 -0700 | [diff] [blame] | 117 | ->UseRealTime(); |
Marat Dukhan | 5aeb32b | 2021-08-06 22:08:39 -0700 | [diff] [blame] | 118 | BENCHMARK_CAPTURE(f32_vsqrt, neonfma_nr1rsqrts1fma1adj_x40, |
| 119 | xnn_f32_vsqrt_ukernel__neonfma_nr1rsqrts1fma1adj_x40, |
| 120 | benchmark::utils::CheckNEONFMA) |
| 121 | ->Apply(benchmark::utils::UnaryElementwiseParameters<float, float>) |
Marat Dukhan | f4db2f3 | 2020-06-30 10:55:30 -0700 | [diff] [blame] | 122 | ->UseRealTime(); |
| 123 | |
Marat Dukhan | 5aeb32b | 2021-08-06 22:08:39 -0700 | [diff] [blame] | 124 | BENCHMARK_CAPTURE(f32_vsqrt, neonfma_nr2fma1adj_x4, |
| 125 | xnn_f32_vsqrt_ukernel__neonfma_nr2fma1adj_x4, |
| 126 | benchmark::utils::CheckNEONFMA) |
| 127 | ->Apply(benchmark::utils::UnaryElementwiseParameters<float, float>) |
Marat Dukhan | f4db2f3 | 2020-06-30 10:55:30 -0700 | [diff] [blame] | 128 | ->UseRealTime(); |
Marat Dukhan | 5aeb32b | 2021-08-06 22:08:39 -0700 | [diff] [blame] | 129 | BENCHMARK_CAPTURE(f32_vsqrt, neonfma_nr2fma1adj_x8, |
| 130 | xnn_f32_vsqrt_ukernel__neonfma_nr2fma1adj_x8, |
| 131 | benchmark::utils::CheckNEONFMA) |
| 132 | ->Apply(benchmark::utils::UnaryElementwiseParameters<float, float>) |
Marat Dukhan | f4db2f3 | 2020-06-30 10:55:30 -0700 | [diff] [blame] | 133 | ->UseRealTime(); |
Marat Dukhan | 5aeb32b | 2021-08-06 22:08:39 -0700 | [diff] [blame] | 134 | BENCHMARK_CAPTURE(f32_vsqrt, neonfma_nr2fma1adj_x12, |
| 135 | xnn_f32_vsqrt_ukernel__neonfma_nr2fma1adj_x12, |
| 136 | benchmark::utils::CheckNEONFMA) |
| 137 | ->Apply(benchmark::utils::UnaryElementwiseParameters<float, float>) |
Marat Dukhan | f4db2f3 | 2020-06-30 10:55:30 -0700 | [diff] [blame] | 138 | ->UseRealTime(); |
Marat Dukhan | 5aeb32b | 2021-08-06 22:08:39 -0700 | [diff] [blame] | 139 | BENCHMARK_CAPTURE(f32_vsqrt, neonfma_nr2fma1adj_x16, |
| 140 | xnn_f32_vsqrt_ukernel__neonfma_nr2fma1adj_x16, |
| 141 | benchmark::utils::CheckNEONFMA) |
| 142 | ->Apply(benchmark::utils::UnaryElementwiseParameters<float, float>) |
Marat Dukhan | f4db2f3 | 2020-06-30 10:55:30 -0700 | [diff] [blame] | 143 | ->UseRealTime(); |
Marat Dukhan | 5aeb32b | 2021-08-06 22:08:39 -0700 | [diff] [blame] | 144 | BENCHMARK_CAPTURE(f32_vsqrt, neonfma_nr2fma1adj_x20, |
| 145 | xnn_f32_vsqrt_ukernel__neonfma_nr2fma1adj_x20, |
| 146 | benchmark::utils::CheckNEONFMA) |
| 147 | ->Apply(benchmark::utils::UnaryElementwiseParameters<float, float>) |
Marat Dukhan | f4db2f3 | 2020-06-30 10:55:30 -0700 | [diff] [blame] | 148 | ->UseRealTime(); |
Marat Dukhan | 5aeb32b | 2021-08-06 22:08:39 -0700 | [diff] [blame] | 149 | BENCHMARK_CAPTURE(f32_vsqrt, neonfma_nr2fma1adj_x24, |
| 150 | xnn_f32_vsqrt_ukernel__neonfma_nr2fma1adj_x24, |
| 151 | benchmark::utils::CheckNEONFMA) |
| 152 | ->Apply(benchmark::utils::UnaryElementwiseParameters<float, float>) |
Marat Dukhan | f4db2f3 | 2020-06-30 10:55:30 -0700 | [diff] [blame] | 153 | ->UseRealTime(); |
Marat Dukhan | 5aeb32b | 2021-08-06 22:08:39 -0700 | [diff] [blame] | 154 | BENCHMARK_CAPTURE(f32_vsqrt, neonfma_nr2fma1adj_x28, |
| 155 | xnn_f32_vsqrt_ukernel__neonfma_nr2fma1adj_x28, |
| 156 | benchmark::utils::CheckNEONFMA) |
| 157 | ->Apply(benchmark::utils::UnaryElementwiseParameters<float, float>) |
Marat Dukhan | f4db2f3 | 2020-06-30 10:55:30 -0700 | [diff] [blame] | 158 | ->UseRealTime(); |
Marat Dukhan | 5aeb32b | 2021-08-06 22:08:39 -0700 | [diff] [blame] | 159 | BENCHMARK_CAPTURE(f32_vsqrt, neonfma_nr2fma1adj_x32, |
| 160 | xnn_f32_vsqrt_ukernel__neonfma_nr2fma1adj_x32, |
| 161 | benchmark::utils::CheckNEONFMA) |
| 162 | ->Apply(benchmark::utils::UnaryElementwiseParameters<float, float>) |
Marat Dukhan | f4db2f3 | 2020-06-30 10:55:30 -0700 | [diff] [blame] | 163 | ->UseRealTime(); |
Marat Dukhan | 5aeb32b | 2021-08-06 22:08:39 -0700 | [diff] [blame] | 164 | BENCHMARK_CAPTURE(f32_vsqrt, neonfma_nr2fma1adj_x36, |
| 165 | xnn_f32_vsqrt_ukernel__neonfma_nr2fma1adj_x36, |
| 166 | benchmark::utils::CheckNEONFMA) |
| 167 | ->Apply(benchmark::utils::UnaryElementwiseParameters<float, float>) |
Marat Dukhan | f4db2f3 | 2020-06-30 10:55:30 -0700 | [diff] [blame] | 168 | ->UseRealTime(); |
Marat Dukhan | 5aeb32b | 2021-08-06 22:08:39 -0700 | [diff] [blame] | 169 | BENCHMARK_CAPTURE(f32_vsqrt, neonfma_nr2fma1adj_x40, |
| 170 | xnn_f32_vsqrt_ukernel__neonfma_nr2fma1adj_x40, |
| 171 | benchmark::utils::CheckNEONFMA) |
| 172 | ->Apply(benchmark::utils::UnaryElementwiseParameters<float, float>) |
Marat Dukhan | f4db2f3 | 2020-06-30 10:55:30 -0700 | [diff] [blame] | 173 | ->UseRealTime(); |
| 174 | #endif // XNN_ARCH_ARM64 || XNN_ARCH_ARM64 |
| 175 | |
| 176 | #if XNN_ARCH_X86 || XNN_ARCH_X86_64 |
Marat Dukhan | 5aeb32b | 2021-08-06 22:08:39 -0700 | [diff] [blame] | 177 | BENCHMARK_CAPTURE(f32_vsqrt, sse_sqrt_x4, |
| 178 | xnn_f32_vsqrt_ukernel__sse_sqrt_x4) |
| 179 | ->Apply(benchmark::utils::UnaryElementwiseParameters<float, float>) |
Marat Dukhan | f4db2f3 | 2020-06-30 10:55:30 -0700 | [diff] [blame] | 180 | ->UseRealTime(); |
Marat Dukhan | 5aeb32b | 2021-08-06 22:08:39 -0700 | [diff] [blame] | 181 | BENCHMARK_CAPTURE(f32_vsqrt, sse_sqrt_x8, |
| 182 | xnn_f32_vsqrt_ukernel__sse_sqrt_x8) |
| 183 | ->Apply(benchmark::utils::UnaryElementwiseParameters<float, float>) |
Marat Dukhan | f4db2f3 | 2020-06-30 10:55:30 -0700 | [diff] [blame] | 184 | ->UseRealTime(); |
| 185 | |
Marat Dukhan | 5aeb32b | 2021-08-06 22:08:39 -0700 | [diff] [blame] | 186 | BENCHMARK_CAPTURE(f32_vsqrt, avx_sqrt_x8, |
| 187 | xnn_f32_vsqrt_ukernel__avx_sqrt_x8, |
| 188 | benchmark::utils::CheckAVX) |
| 189 | ->Apply(benchmark::utils::UnaryElementwiseParameters<float, float>) |
Marat Dukhan | f4db2f3 | 2020-06-30 10:55:30 -0700 | [diff] [blame] | 190 | ->UseRealTime(); |
Marat Dukhan | 5aeb32b | 2021-08-06 22:08:39 -0700 | [diff] [blame] | 191 | BENCHMARK_CAPTURE(f32_vsqrt, avx_sqrt_x16, |
| 192 | xnn_f32_vsqrt_ukernel__avx_sqrt_x16, |
| 193 | benchmark::utils::CheckAVX) |
| 194 | ->Apply(benchmark::utils::UnaryElementwiseParameters<float, float>) |
Marat Dukhan | f4db2f3 | 2020-06-30 10:55:30 -0700 | [diff] [blame] | 195 | ->UseRealTime(); |
| 196 | |
Marat Dukhan | 5aeb32b | 2021-08-06 22:08:39 -0700 | [diff] [blame] | 197 | BENCHMARK_CAPTURE(f32_vsqrt, fma3_nr1fma1adj_x8, |
| 198 | xnn_f32_vsqrt_ukernel__fma3_nr1fma1adj_x8, |
| 199 | benchmark::utils::CheckFMA3) |
| 200 | ->Apply(benchmark::utils::UnaryElementwiseParameters<float, float>) |
Marat Dukhan | f4db2f3 | 2020-06-30 10:55:30 -0700 | [diff] [blame] | 201 | ->UseRealTime(); |
Marat Dukhan | 5aeb32b | 2021-08-06 22:08:39 -0700 | [diff] [blame] | 202 | BENCHMARK_CAPTURE(f32_vsqrt, fma3_nr1fma1adj_x16, |
| 203 | xnn_f32_vsqrt_ukernel__fma3_nr1fma1adj_x16, |
| 204 | benchmark::utils::CheckFMA3) |
| 205 | ->Apply(benchmark::utils::UnaryElementwiseParameters<float, float>) |
Marat Dukhan | f4db2f3 | 2020-06-30 10:55:30 -0700 | [diff] [blame] | 206 | ->UseRealTime(); |
Marat Dukhan | 5aeb32b | 2021-08-06 22:08:39 -0700 | [diff] [blame] | 207 | BENCHMARK_CAPTURE(f32_vsqrt, fma3_nr1fma1adj_x24, |
| 208 | xnn_f32_vsqrt_ukernel__fma3_nr1fma1adj_x24, |
| 209 | benchmark::utils::CheckFMA3) |
| 210 | ->Apply(benchmark::utils::UnaryElementwiseParameters<float, float>) |
Marat Dukhan | f4db2f3 | 2020-06-30 10:55:30 -0700 | [diff] [blame] | 211 | ->UseRealTime(); |
Marat Dukhan | 5aeb32b | 2021-08-06 22:08:39 -0700 | [diff] [blame] | 212 | BENCHMARK_CAPTURE(f32_vsqrt, fma3_nr1fma1adj_x32, |
| 213 | xnn_f32_vsqrt_ukernel__fma3_nr1fma1adj_x32, |
| 214 | benchmark::utils::CheckFMA3) |
| 215 | ->Apply(benchmark::utils::UnaryElementwiseParameters<float, float>) |
Marat Dukhan | f4db2f3 | 2020-06-30 10:55:30 -0700 | [diff] [blame] | 216 | ->UseRealTime(); |
Marat Dukhan | 5aeb32b | 2021-08-06 22:08:39 -0700 | [diff] [blame] | 217 | BENCHMARK_CAPTURE(f32_vsqrt, fma3_nr1fma1adj_x40, |
| 218 | xnn_f32_vsqrt_ukernel__fma3_nr1fma1adj_x40, |
| 219 | benchmark::utils::CheckFMA3) |
| 220 | ->Apply(benchmark::utils::UnaryElementwiseParameters<float, float>) |
Marat Dukhan | f4db2f3 | 2020-06-30 10:55:30 -0700 | [diff] [blame] | 221 | ->UseRealTime(); |
Marat Dukhan | 5aeb32b | 2021-08-06 22:08:39 -0700 | [diff] [blame] | 222 | BENCHMARK_CAPTURE(f32_vsqrt, fma3_nr1fma1adj_x48, |
| 223 | xnn_f32_vsqrt_ukernel__fma3_nr1fma1adj_x48, |
| 224 | benchmark::utils::CheckFMA3) |
| 225 | ->Apply(benchmark::utils::UnaryElementwiseParameters<float, float>) |
Marat Dukhan | f4db2f3 | 2020-06-30 10:55:30 -0700 | [diff] [blame] | 226 | ->UseRealTime(); |
Marat Dukhan | 5aeb32b | 2021-08-06 22:08:39 -0700 | [diff] [blame] | 227 | BENCHMARK_CAPTURE(f32_vsqrt, fma3_nr1fma1adj_x56, |
| 228 | xnn_f32_vsqrt_ukernel__fma3_nr1fma1adj_x56, |
| 229 | benchmark::utils::CheckFMA3) |
| 230 | ->Apply(benchmark::utils::UnaryElementwiseParameters<float, float>) |
Marat Dukhan | f4db2f3 | 2020-06-30 10:55:30 -0700 | [diff] [blame] | 231 | ->UseRealTime(); |
Marat Dukhan | 5aeb32b | 2021-08-06 22:08:39 -0700 | [diff] [blame] | 232 | BENCHMARK_CAPTURE(f32_vsqrt, fma3_nr1fma1adj_x64, |
| 233 | xnn_f32_vsqrt_ukernel__fma3_nr1fma1adj_x64, |
| 234 | benchmark::utils::CheckFMA3) |
| 235 | ->Apply(benchmark::utils::UnaryElementwiseParameters<float, float>) |
Marat Dukhan | f4db2f3 | 2020-06-30 10:55:30 -0700 | [diff] [blame] | 236 | ->UseRealTime(); |
| 237 | |
Marat Dukhan | 5aeb32b | 2021-08-06 22:08:39 -0700 | [diff] [blame] | 238 | BENCHMARK_CAPTURE(f32_vsqrt, avx512f_nr1fma1adj_x16, |
| 239 | xnn_f32_vsqrt_ukernel__avx512f_nr1fma1adj_x16, |
| 240 | benchmark::utils::CheckAVX512F) |
| 241 | ->Apply(benchmark::utils::UnaryElementwiseParameters<float, float>) |
Marat Dukhan | f4db2f3 | 2020-06-30 10:55:30 -0700 | [diff] [blame] | 242 | ->UseRealTime(); |
Marat Dukhan | 5aeb32b | 2021-08-06 22:08:39 -0700 | [diff] [blame] | 243 | BENCHMARK_CAPTURE(f32_vsqrt, avx512f_nr1fma1adj_x32, |
| 244 | xnn_f32_vsqrt_ukernel__avx512f_nr1fma1adj_x32, |
| 245 | benchmark::utils::CheckAVX512F) |
| 246 | ->Apply(benchmark::utils::UnaryElementwiseParameters<float, float>) |
Marat Dukhan | f4db2f3 | 2020-06-30 10:55:30 -0700 | [diff] [blame] | 247 | ->UseRealTime(); |
Marat Dukhan | 5aeb32b | 2021-08-06 22:08:39 -0700 | [diff] [blame] | 248 | BENCHMARK_CAPTURE(f32_vsqrt, avx512f_nr1fma1adj_x48, |
| 249 | xnn_f32_vsqrt_ukernel__avx512f_nr1fma1adj_x48, |
| 250 | benchmark::utils::CheckAVX512F) |
| 251 | ->Apply(benchmark::utils::UnaryElementwiseParameters<float, float>) |
Marat Dukhan | f4db2f3 | 2020-06-30 10:55:30 -0700 | [diff] [blame] | 252 | ->UseRealTime(); |
Marat Dukhan | 5aeb32b | 2021-08-06 22:08:39 -0700 | [diff] [blame] | 253 | BENCHMARK_CAPTURE(f32_vsqrt, avx512f_nr1fma1adj_x64, |
| 254 | xnn_f32_vsqrt_ukernel__avx512f_nr1fma1adj_x64, |
| 255 | benchmark::utils::CheckAVX512F) |
| 256 | ->Apply(benchmark::utils::UnaryElementwiseParameters<float, float>) |
Marat Dukhan | f4db2f3 | 2020-06-30 10:55:30 -0700 | [diff] [blame] | 257 | ->UseRealTime(); |
Marat Dukhan | 5aeb32b | 2021-08-06 22:08:39 -0700 | [diff] [blame] | 258 | BENCHMARK_CAPTURE(f32_vsqrt, avx512f_nr1fma1adj_x80, |
| 259 | xnn_f32_vsqrt_ukernel__avx512f_nr1fma1adj_x80, |
| 260 | benchmark::utils::CheckAVX512F) |
| 261 | ->Apply(benchmark::utils::UnaryElementwiseParameters<float, float>) |
Marat Dukhan | f4db2f3 | 2020-06-30 10:55:30 -0700 | [diff] [blame] | 262 | ->UseRealTime(); |
Marat Dukhan | 5aeb32b | 2021-08-06 22:08:39 -0700 | [diff] [blame] | 263 | BENCHMARK_CAPTURE(f32_vsqrt, avx512f_nr1fma1adj_x96, |
| 264 | xnn_f32_vsqrt_ukernel__avx512f_nr1fma1adj_x96, |
| 265 | benchmark::utils::CheckAVX512F) |
| 266 | ->Apply(benchmark::utils::UnaryElementwiseParameters<float, float>) |
Marat Dukhan | f4db2f3 | 2020-06-30 10:55:30 -0700 | [diff] [blame] | 267 | ->UseRealTime(); |
Marat Dukhan | 5aeb32b | 2021-08-06 22:08:39 -0700 | [diff] [blame] | 268 | BENCHMARK_CAPTURE(f32_vsqrt, avx512f_nr1fma1adj_x112, |
| 269 | xnn_f32_vsqrt_ukernel__avx512f_nr1fma1adj_x112, |
| 270 | benchmark::utils::CheckAVX512F) |
| 271 | ->Apply(benchmark::utils::UnaryElementwiseParameters<float, float>) |
Marat Dukhan | f4db2f3 | 2020-06-30 10:55:30 -0700 | [diff] [blame] | 272 | ->UseRealTime(); |
Marat Dukhan | 5aeb32b | 2021-08-06 22:08:39 -0700 | [diff] [blame] | 273 | BENCHMARK_CAPTURE(f32_vsqrt, avx512f_nr1fma1adj_x128, |
| 274 | xnn_f32_vsqrt_ukernel__avx512f_nr1fma1adj_x128, |
| 275 | benchmark::utils::CheckAVX512F) |
| 276 | ->Apply(benchmark::utils::UnaryElementwiseParameters<float, float>) |
Marat Dukhan | f4db2f3 | 2020-06-30 10:55:30 -0700 | [diff] [blame] | 277 | ->UseRealTime(); |
| 278 | #endif // XNN_ARCH_X86 || XNN_ARCH_X86_64 |
| 279 | |
| 280 | #if XNN_ARCH_WASMSIMD |
Marat Dukhan | 5aeb32b | 2021-08-06 22:08:39 -0700 | [diff] [blame] | 281 | BENCHMARK_CAPTURE(f32_vsqrt, wasmsimd_sqrt_x4, |
| 282 | xnn_f32_vsqrt_ukernel__wasmsimd_sqrt_x4) |
| 283 | ->Apply(benchmark::utils::UnaryElementwiseParameters<float, float>) |
Marat Dukhan | f4db2f3 | 2020-06-30 10:55:30 -0700 | [diff] [blame] | 284 | ->UseRealTime(); |
Marat Dukhan | 5aeb32b | 2021-08-06 22:08:39 -0700 | [diff] [blame] | 285 | BENCHMARK_CAPTURE(f32_vsqrt, wasmsimd_sqrt_x8, |
| 286 | xnn_f32_vsqrt_ukernel__wasmsimd_sqrt_x8) |
| 287 | ->Apply(benchmark::utils::UnaryElementwiseParameters<float, float>) |
Marat Dukhan | f4db2f3 | 2020-06-30 10:55:30 -0700 | [diff] [blame] | 288 | ->UseRealTime(); |
| 289 | #endif // XNN_ARCH_WASMSIMD |
| 290 | |
Marat Dukhan | 5aeb32b | 2021-08-06 22:08:39 -0700 | [diff] [blame] | 291 | BENCHMARK_CAPTURE(f32_vsqrt, scalar_sqrt_x1, |
| 292 | xnn_f32_vsqrt_ukernel__scalar_sqrt_x1) |
| 293 | ->Apply(benchmark::utils::UnaryElementwiseParameters<float, float>) |
Marat Dukhan | f4db2f3 | 2020-06-30 10:55:30 -0700 | [diff] [blame] | 294 | ->UseRealTime(); |
Marat Dukhan | 5aeb32b | 2021-08-06 22:08:39 -0700 | [diff] [blame] | 295 | BENCHMARK_CAPTURE(f32_vsqrt, scalar_sqrt_x2, |
| 296 | xnn_f32_vsqrt_ukernel__scalar_sqrt_x2) |
| 297 | ->Apply(benchmark::utils::UnaryElementwiseParameters<float, float>) |
Marat Dukhan | f4db2f3 | 2020-06-30 10:55:30 -0700 | [diff] [blame] | 298 | ->UseRealTime(); |
Marat Dukhan | 5aeb32b | 2021-08-06 22:08:39 -0700 | [diff] [blame] | 299 | BENCHMARK_CAPTURE(f32_vsqrt, scalar_sqrt_x4, |
| 300 | xnn_f32_vsqrt_ukernel__scalar_sqrt_x4) |
| 301 | ->Apply(benchmark::utils::UnaryElementwiseParameters<float, float>) |
Marat Dukhan | f4db2f3 | 2020-06-30 10:55:30 -0700 | [diff] [blame] | 302 | ->UseRealTime(); |
| 303 | |
| 304 | #ifndef XNNPACK_BENCHMARK_NO_MAIN |
| 305 | BENCHMARK_MAIN(); |
| 306 | #endif |