blob: 8c6c2a63b1422bea81b040d5d2122a1c76648fd1 [file] [log] [blame]
Marat Dukhanf4db2f32020-06-30 10:55:30 -07001// 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 Dukhanf4db2f32020-06-30 10:55:30 -070017#include <xnnpack/params.h>
18#include <xnnpack/params-init.h>
Marat Dukhan5aeb32b2021-08-06 22:08:39 -070019#include <xnnpack/vunary.h>
Marat Dukhanf4db2f32020-06-30 10:55:30 -070020
21
22static 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 Dukhan5aeb32b2021-08-06 22:08:39 -070031 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 Dukhanf4db2f32020-06-30 10:55:30 -070034
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 Dukhanf56f4c42021-05-17 01:47:20 -070041 union xnn_f32_sqrt_params params;
42 xnn_init_f32_sqrt_params(&params);
Marat Dukhanf4db2f32020-06-30 10:55:30 -070043 for (auto _ : state) {
Marat Dukhan5aeb32b2021-08-06 22:08:39 -070044 vsqrt(num_elements * sizeof(float), input.data(), output.data(), &params);
Marat Dukhanf4db2f32020-06-30 10:55:30 -070045 }
46
47 const uint64_t cpu_frequency = benchmark::utils::GetCurrentCpuFrequency();
48 if (cpu_frequency != 0) {
49 state.counters["cpufreq"] = cpu_frequency;
50 }
51
Marat Dukhan5aeb32b2021-08-06 22:08:39 -070052 const size_t elements_per_iteration = num_elements;
Marat Dukhanf4db2f32020-06-30 10:55:30 -070053 state.counters["elements"] =
54 benchmark::Counter(uint64_t(state.iterations()) * elements_per_iteration, benchmark::Counter::kIsRate);
55
Marat Dukhan5aeb32b2021-08-06 22:08:39 -070056 const size_t bytes_per_iteration = 2 * num_elements * sizeof(float);
Marat Dukhanf4db2f32020-06-30 10:55:30 -070057 state.counters["bytes"] =
58 benchmark::Counter(uint64_t(state.iterations()) * bytes_per_iteration, benchmark::Counter::kIsRate);
59}
60
61#if XNN_ARCH_ARM64
Marat Dukhan5aeb32b2021-08-06 22:08:39 -070062 BENCHMARK_CAPTURE(f32_vsqrt, neon_sqrt_x4,
63 xnn_f32_vsqrt_ukernel__neon_sqrt_x4)
64 ->Apply(benchmark::utils::UnaryElementwiseParameters<float, float>)
Marat Dukhanf4db2f32020-06-30 10:55:30 -070065 ->UseRealTime();
Marat Dukhan5aeb32b2021-08-06 22:08:39 -070066 BENCHMARK_CAPTURE(f32_vsqrt, neon_sqrt_x8,
67 xnn_f32_vsqrt_ukernel__neon_sqrt_x8)
68 ->Apply(benchmark::utils::UnaryElementwiseParameters<float, float>)
Marat Dukhanf4db2f32020-06-30 10:55:30 -070069 ->UseRealTime();
70#endif // XNN_ARCH_ARM64
71
72#if XNN_ARCH_ARM64 || XNN_ARCH_ARM64
Marat Dukhan5aeb32b2021-08-06 22:08:39 -070073 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 Dukhanf4db2f32020-06-30 10:55:30 -070077 ->UseRealTime();
Marat Dukhan5aeb32b2021-08-06 22:08:39 -070078 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 Dukhanf4db2f32020-06-30 10:55:30 -070082 ->UseRealTime();
Marat Dukhan5aeb32b2021-08-06 22:08:39 -070083 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 Dukhanf4db2f32020-06-30 10:55:30 -070087 ->UseRealTime();
Marat Dukhan5aeb32b2021-08-06 22:08:39 -070088 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 Dukhanf4db2f32020-06-30 10:55:30 -070092 ->UseRealTime();
Marat Dukhan5aeb32b2021-08-06 22:08:39 -070093 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 Dukhanf4db2f32020-06-30 10:55:30 -070097 ->UseRealTime();
Marat Dukhan5aeb32b2021-08-06 22:08:39 -070098 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 Dukhanf4db2f32020-06-30 10:55:30 -0700102 ->UseRealTime();
Marat Dukhan5aeb32b2021-08-06 22:08:39 -0700103 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 Dukhanf4db2f32020-06-30 10:55:30 -0700107 ->UseRealTime();
Marat Dukhan5aeb32b2021-08-06 22:08:39 -0700108 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 Dukhanf4db2f32020-06-30 10:55:30 -0700112 ->UseRealTime();
Marat Dukhan5aeb32b2021-08-06 22:08:39 -0700113 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 Dukhanf4db2f32020-06-30 10:55:30 -0700117 ->UseRealTime();
Marat Dukhan5aeb32b2021-08-06 22:08:39 -0700118 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 Dukhanf4db2f32020-06-30 10:55:30 -0700122 ->UseRealTime();
123
Marat Dukhan5aeb32b2021-08-06 22:08:39 -0700124 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 Dukhanf4db2f32020-06-30 10:55:30 -0700128 ->UseRealTime();
Marat Dukhan5aeb32b2021-08-06 22:08:39 -0700129 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 Dukhanf4db2f32020-06-30 10:55:30 -0700133 ->UseRealTime();
Marat Dukhan5aeb32b2021-08-06 22:08:39 -0700134 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 Dukhanf4db2f32020-06-30 10:55:30 -0700138 ->UseRealTime();
Marat Dukhan5aeb32b2021-08-06 22:08:39 -0700139 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 Dukhanf4db2f32020-06-30 10:55:30 -0700143 ->UseRealTime();
Marat Dukhan5aeb32b2021-08-06 22:08:39 -0700144 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 Dukhanf4db2f32020-06-30 10:55:30 -0700148 ->UseRealTime();
Marat Dukhan5aeb32b2021-08-06 22:08:39 -0700149 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 Dukhanf4db2f32020-06-30 10:55:30 -0700153 ->UseRealTime();
Marat Dukhan5aeb32b2021-08-06 22:08:39 -0700154 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 Dukhanf4db2f32020-06-30 10:55:30 -0700158 ->UseRealTime();
Marat Dukhan5aeb32b2021-08-06 22:08:39 -0700159 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 Dukhanf4db2f32020-06-30 10:55:30 -0700163 ->UseRealTime();
Marat Dukhan5aeb32b2021-08-06 22:08:39 -0700164 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 Dukhanf4db2f32020-06-30 10:55:30 -0700168 ->UseRealTime();
Marat Dukhan5aeb32b2021-08-06 22:08:39 -0700169 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 Dukhanf4db2f32020-06-30 10:55:30 -0700173 ->UseRealTime();
174#endif // XNN_ARCH_ARM64 || XNN_ARCH_ARM64
175
176#if XNN_ARCH_X86 || XNN_ARCH_X86_64
Marat Dukhan5aeb32b2021-08-06 22:08:39 -0700177 BENCHMARK_CAPTURE(f32_vsqrt, sse_sqrt_x4,
178 xnn_f32_vsqrt_ukernel__sse_sqrt_x4)
179 ->Apply(benchmark::utils::UnaryElementwiseParameters<float, float>)
Marat Dukhanf4db2f32020-06-30 10:55:30 -0700180 ->UseRealTime();
Marat Dukhan5aeb32b2021-08-06 22:08:39 -0700181 BENCHMARK_CAPTURE(f32_vsqrt, sse_sqrt_x8,
182 xnn_f32_vsqrt_ukernel__sse_sqrt_x8)
183 ->Apply(benchmark::utils::UnaryElementwiseParameters<float, float>)
Marat Dukhanf4db2f32020-06-30 10:55:30 -0700184 ->UseRealTime();
185
Marat Dukhan5aeb32b2021-08-06 22:08:39 -0700186 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 Dukhanf4db2f32020-06-30 10:55:30 -0700190 ->UseRealTime();
Marat Dukhan5aeb32b2021-08-06 22:08:39 -0700191 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 Dukhanf4db2f32020-06-30 10:55:30 -0700195 ->UseRealTime();
196
Marat Dukhan5aeb32b2021-08-06 22:08:39 -0700197 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 Dukhanf4db2f32020-06-30 10:55:30 -0700201 ->UseRealTime();
Marat Dukhan5aeb32b2021-08-06 22:08:39 -0700202 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 Dukhanf4db2f32020-06-30 10:55:30 -0700206 ->UseRealTime();
Marat Dukhan5aeb32b2021-08-06 22:08:39 -0700207 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 Dukhanf4db2f32020-06-30 10:55:30 -0700211 ->UseRealTime();
Marat Dukhan5aeb32b2021-08-06 22:08:39 -0700212 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 Dukhanf4db2f32020-06-30 10:55:30 -0700216 ->UseRealTime();
Marat Dukhan5aeb32b2021-08-06 22:08:39 -0700217 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 Dukhanf4db2f32020-06-30 10:55:30 -0700221 ->UseRealTime();
Marat Dukhan5aeb32b2021-08-06 22:08:39 -0700222 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 Dukhanf4db2f32020-06-30 10:55:30 -0700226 ->UseRealTime();
Marat Dukhan5aeb32b2021-08-06 22:08:39 -0700227 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 Dukhanf4db2f32020-06-30 10:55:30 -0700231 ->UseRealTime();
Marat Dukhan5aeb32b2021-08-06 22:08:39 -0700232 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 Dukhanf4db2f32020-06-30 10:55:30 -0700236 ->UseRealTime();
237
Marat Dukhan5aeb32b2021-08-06 22:08:39 -0700238 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 Dukhanf4db2f32020-06-30 10:55:30 -0700242 ->UseRealTime();
Marat Dukhan5aeb32b2021-08-06 22:08:39 -0700243 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 Dukhanf4db2f32020-06-30 10:55:30 -0700247 ->UseRealTime();
Marat Dukhan5aeb32b2021-08-06 22:08:39 -0700248 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 Dukhanf4db2f32020-06-30 10:55:30 -0700252 ->UseRealTime();
Marat Dukhan5aeb32b2021-08-06 22:08:39 -0700253 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 Dukhanf4db2f32020-06-30 10:55:30 -0700257 ->UseRealTime();
Marat Dukhan5aeb32b2021-08-06 22:08:39 -0700258 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 Dukhanf4db2f32020-06-30 10:55:30 -0700262 ->UseRealTime();
Marat Dukhan5aeb32b2021-08-06 22:08:39 -0700263 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 Dukhanf4db2f32020-06-30 10:55:30 -0700267 ->UseRealTime();
Marat Dukhan5aeb32b2021-08-06 22:08:39 -0700268 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 Dukhanf4db2f32020-06-30 10:55:30 -0700272 ->UseRealTime();
Marat Dukhan5aeb32b2021-08-06 22:08:39 -0700273 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 Dukhanf4db2f32020-06-30 10:55:30 -0700277 ->UseRealTime();
278#endif // XNN_ARCH_X86 || XNN_ARCH_X86_64
279
280#if XNN_ARCH_WASMSIMD
Marat Dukhan5aeb32b2021-08-06 22:08:39 -0700281 BENCHMARK_CAPTURE(f32_vsqrt, wasmsimd_sqrt_x4,
282 xnn_f32_vsqrt_ukernel__wasmsimd_sqrt_x4)
283 ->Apply(benchmark::utils::UnaryElementwiseParameters<float, float>)
Marat Dukhanf4db2f32020-06-30 10:55:30 -0700284 ->UseRealTime();
Marat Dukhan5aeb32b2021-08-06 22:08:39 -0700285 BENCHMARK_CAPTURE(f32_vsqrt, wasmsimd_sqrt_x8,
286 xnn_f32_vsqrt_ukernel__wasmsimd_sqrt_x8)
287 ->Apply(benchmark::utils::UnaryElementwiseParameters<float, float>)
Marat Dukhanf4db2f32020-06-30 10:55:30 -0700288 ->UseRealTime();
289#endif // XNN_ARCH_WASMSIMD
290
Marat Dukhan5aeb32b2021-08-06 22:08:39 -0700291BENCHMARK_CAPTURE(f32_vsqrt, scalar_sqrt_x1,
292 xnn_f32_vsqrt_ukernel__scalar_sqrt_x1)
293 ->Apply(benchmark::utils::UnaryElementwiseParameters<float, float>)
Marat Dukhanf4db2f32020-06-30 10:55:30 -0700294 ->UseRealTime();
Marat Dukhan5aeb32b2021-08-06 22:08:39 -0700295BENCHMARK_CAPTURE(f32_vsqrt, scalar_sqrt_x2,
296 xnn_f32_vsqrt_ukernel__scalar_sqrt_x2)
297 ->Apply(benchmark::utils::UnaryElementwiseParameters<float, float>)
Marat Dukhanf4db2f32020-06-30 10:55:30 -0700298 ->UseRealTime();
Marat Dukhan5aeb32b2021-08-06 22:08:39 -0700299BENCHMARK_CAPTURE(f32_vsqrt, scalar_sqrt_x4,
300 xnn_f32_vsqrt_ukernel__scalar_sqrt_x4)
301 ->Apply(benchmark::utils::UnaryElementwiseParameters<float, float>)
Marat Dukhanf4db2f32020-06-30 10:55:30 -0700302 ->UseRealTime();
303
304#ifndef XNNPACK_BENCHMARK_NO_MAIN
305BENCHMARK_MAIN();
306#endif