Vector Optimized Library of Kernels 2.5.2
Architecture-tuned implementations of math kernels
 
Loading...
Searching...
No Matches
kernel_tests.h
Go to the documentation of this file.
1/* -*- c++ -*- */
2/*
3 * Copyright 2014 - 2021 Free Software Foundation, Inc.
4 *
5 * This file is part of VOLK
6 *
7 * SPDX-License-Identifier: GPL-3.0-or-later
8 */
9
10#include "qa_utils.h"
11
12#include <volk/volk.h>
13#include <vector>
14
15// macros for initializing volk_test_case_t. Maccros are needed to generate
16// function names of the pattern kernel_name_*
17
18// for puppets we need to get all the func_variants for the puppet and just
19// keep track of the actual function name to write to results
20#define VOLK_INIT_PUPP(func, puppet_master_func, test_params) \
21 volk_test_case_t(func##_get_func_desc(), \
22 (void (*)())func##_manual, \
23 std::string(#func), \
24 std::string(#puppet_master_func), \
25 test_params)
26
27#define VOLK_INIT_TEST(func, test_params) \
28 volk_test_case_t(func##_get_func_desc(), \
29 (void (*)())func##_manual, \
30 std::string(#func), \
31 test_params)
32
33#define QA(test) test_cases.push_back(test);
34std::vector<volk_test_case_t> init_test_list(volk_test_params_t test_params)
35{
36
37 // Some kernels need a lower tolerance
38 volk_test_params_t test_params_inacc = test_params.make_tol(1e-2);
39 volk_test_params_t test_params_inacc_tenth = test_params.make_tol(1e-1);
40
41 volk_test_params_t test_params_power(test_params);
42 test_params_power.set_scalar(2.5);
43
44 volk_test_params_t test_params_rotator(test_params);
45 test_params_rotator.set_scalar(std::polar(1.0f, 0.1f));
46 test_params_rotator.set_tol(1e-3);
47
48 std::vector<volk_test_case_t> test_cases;
49 QA(VOLK_INIT_PUPP(volk_64u_popcntpuppet_64u, volk_64u_popcnt, test_params))
50 QA(VOLK_INIT_PUPP(volk_16u_byteswappuppet_16u, volk_16u_byteswap, test_params))
51 QA(VOLK_INIT_PUPP(volk_32u_byteswappuppet_32u, volk_32u_byteswap, test_params))
52 QA(VOLK_INIT_PUPP(volk_32u_popcntpuppet_32u, volk_32u_popcnt_32u, test_params))
53 QA(VOLK_INIT_PUPP(volk_64u_byteswappuppet_64u, volk_64u_byteswap, test_params))
54 QA(VOLK_INIT_PUPP(volk_32fc_s32fc_rotatorpuppet_32fc,
55 volk_32fc_s32fc_x2_rotator_32fc,
56 test_params_rotator))
58 volk_8u_conv_k7_r2puppet_8u, volk_8u_x4_conv_k7_r2_8u, test_params.make_tol(0)))
60 volk_32f_x2_fm_detectpuppet_32f, volk_32f_s32f_32f_fm_detect_32f, test_params))
61 QA(VOLK_INIT_TEST(volk_16ic_s32f_deinterleave_real_32f, test_params))
62 QA(VOLK_INIT_TEST(volk_16ic_deinterleave_real_8i, test_params))
63 QA(VOLK_INIT_TEST(volk_16ic_deinterleave_16i_x2, test_params))
64 QA(VOLK_INIT_TEST(volk_16ic_s32f_deinterleave_32f_x2, test_params))
65 QA(VOLK_INIT_TEST(volk_16ic_deinterleave_real_16i, test_params))
66 QA(VOLK_INIT_TEST(volk_16ic_magnitude_16i, test_params))
67 QA(VOLK_INIT_TEST(volk_16ic_s32f_magnitude_32f, test_params))
68 QA(VOLK_INIT_TEST(volk_16ic_convert_32fc, test_params))
69 QA(VOLK_INIT_TEST(volk_16ic_x2_multiply_16ic, test_params))
70 QA(VOLK_INIT_TEST(volk_16ic_x2_dot_prod_16ic, test_params))
71 QA(VOLK_INIT_TEST(volk_16i_s32f_convert_32f, test_params))
72 QA(VOLK_INIT_TEST(volk_16i_convert_8i, test_params))
73 QA(VOLK_INIT_TEST(volk_16i_32fc_dot_prod_32fc, test_params_inacc))
74 QA(VOLK_INIT_TEST(volk_32f_accumulator_s32f, test_params_inacc))
75 QA(VOLK_INIT_TEST(volk_32f_x2_add_32f, test_params))
76 QA(VOLK_INIT_TEST(volk_32f_index_max_16u, test_params))
77 QA(VOLK_INIT_TEST(volk_32f_index_max_32u, test_params))
78 QA(VOLK_INIT_TEST(volk_32f_index_min_16u, test_params))
79 QA(VOLK_INIT_TEST(volk_32f_index_min_32u, test_params))
80 QA(VOLK_INIT_TEST(volk_32fc_32f_multiply_32fc, test_params))
81 QA(VOLK_INIT_TEST(volk_32fc_32f_add_32fc, test_params))
82 QA(VOLK_INIT_TEST(volk_32f_log2_32f, test_params.make_absolute(1e-5)))
83 QA(VOLK_INIT_TEST(volk_32f_expfast_32f, test_params_inacc_tenth))
84 QA(VOLK_INIT_TEST(volk_32f_x2_pow_32f, test_params_inacc))
85 QA(VOLK_INIT_TEST(volk_32f_sin_32f, test_params_inacc))
86 QA(VOLK_INIT_TEST(volk_32f_cos_32f, test_params_inacc))
87 QA(VOLK_INIT_TEST(volk_32f_tan_32f, test_params_inacc))
88 QA(VOLK_INIT_TEST(volk_32f_atan_32f, test_params_inacc))
89 QA(VOLK_INIT_TEST(volk_32f_asin_32f, test_params_inacc))
90 QA(VOLK_INIT_TEST(volk_32f_acos_32f, test_params_inacc))
91 QA(VOLK_INIT_TEST(volk_32fc_s32f_power_32fc, test_params_power))
92 QA(VOLK_INIT_TEST(volk_32f_s32f_calc_spectral_noise_floor_32f, test_params_inacc))
93 QA(VOLK_INIT_TEST(volk_32fc_s32f_atan2_32f, test_params))
94 QA(VOLK_INIT_TEST(volk_32fc_x2_conjugate_dot_prod_32fc, test_params_inacc_tenth))
95 QA(VOLK_INIT_TEST(volk_32fc_deinterleave_32f_x2, test_params))
96 QA(VOLK_INIT_TEST(volk_32fc_accumulator_s32fc, test_params.make_tol(1e-3)))
97 QA(VOLK_INIT_TEST(volk_32fc_deinterleave_64f_x2, test_params))
98 QA(VOLK_INIT_TEST(volk_32fc_s32f_deinterleave_real_16i, test_params))
99 QA(VOLK_INIT_TEST(volk_32fc_deinterleave_imag_32f, test_params))
100 QA(VOLK_INIT_TEST(volk_32fc_deinterleave_real_32f, test_params))
101 QA(VOLK_INIT_TEST(volk_32fc_deinterleave_real_64f, test_params))
102 QA(VOLK_INIT_TEST(volk_32fc_x2_dot_prod_32fc, test_params_inacc))
103 QA(VOLK_INIT_TEST(volk_32fc_32f_dot_prod_32fc, test_params_inacc))
104 QA(VOLK_INIT_TEST(volk_32fc_index_max_16u, test_params))
105 QA(VOLK_INIT_TEST(volk_32fc_index_max_32u, test_params))
106 QA(VOLK_INIT_TEST(volk_32fc_index_min_16u, test_params))
107 QA(VOLK_INIT_TEST(volk_32fc_index_min_32u, test_params))
108 QA(VOLK_INIT_TEST(volk_32fc_s32f_magnitude_16i, test_params))
109 QA(VOLK_INIT_TEST(volk_32fc_magnitude_32f, test_params_inacc_tenth))
110 QA(VOLK_INIT_TEST(volk_32fc_magnitude_squared_32f, test_params))
111 QA(VOLK_INIT_TEST(volk_32fc_x2_add_32fc, test_params))
112 QA(VOLK_INIT_TEST(volk_32fc_x2_multiply_32fc, test_params))
113 QA(VOLK_INIT_TEST(volk_32fc_x2_multiply_conjugate_32fc, test_params))
114 QA(VOLK_INIT_TEST(volk_32fc_x2_divide_32fc, test_params))
115 QA(VOLK_INIT_TEST(volk_32fc_conjugate_32fc, test_params))
116 QA(VOLK_INIT_TEST(volk_32f_s32f_convert_16i, test_params))
117 QA(VOLK_INIT_TEST(volk_32f_s32f_convert_32i, test_params))
118 QA(VOLK_INIT_TEST(volk_32f_convert_64f, test_params))
119 QA(VOLK_INIT_TEST(volk_32f_s32f_convert_8i, test_params))
120 QA(VOLK_INIT_TEST(volk_32fc_convert_16ic, test_params))
121 QA(VOLK_INIT_TEST(volk_32fc_s32f_power_spectrum_32f, test_params))
122 QA(VOLK_INIT_TEST(volk_32fc_x2_square_dist_32f, test_params))
123 QA(VOLK_INIT_TEST(volk_32fc_x2_s32f_square_dist_scalar_mult_32f, test_params))
124 QA(VOLK_INIT_TEST(volk_32f_x2_divide_32f, test_params))
125 QA(VOLK_INIT_TEST(volk_32f_x2_dot_prod_32f, test_params_inacc))
126 QA(VOLK_INIT_TEST(volk_32f_x2_s32f_interleave_16ic, test_params))
127 QA(VOLK_INIT_TEST(volk_32f_x2_interleave_32fc, test_params))
128 QA(VOLK_INIT_TEST(volk_32f_x2_max_32f, test_params))
129 QA(VOLK_INIT_TEST(volk_32f_x2_min_32f, test_params))
130 QA(VOLK_INIT_TEST(volk_32f_x2_multiply_32f, test_params))
131 QA(VOLK_INIT_TEST(volk_32f_64f_multiply_64f, test_params))
132 QA(VOLK_INIT_TEST(volk_32f_64f_add_64f, test_params))
133 QA(VOLK_INIT_TEST(volk_32f_s32f_normalize, test_params))
134 QA(VOLK_INIT_TEST(volk_32f_s32f_power_32f, test_params))
135 QA(VOLK_INIT_TEST(volk_32f_sqrt_32f, test_params_inacc))
136 QA(VOLK_INIT_TEST(volk_32f_s32f_stddev_32f, test_params_inacc))
137 QA(VOLK_INIT_TEST(volk_32f_stddev_and_mean_32f_x2, test_params.make_tol(1e-3)))
138 QA(VOLK_INIT_TEST(volk_32f_x2_subtract_32f, test_params))
139 QA(VOLK_INIT_TEST(volk_32f_x3_sum_of_poly_32f, test_params_inacc))
140 QA(VOLK_INIT_TEST(volk_32i_x2_and_32i, test_params))
141 QA(VOLK_INIT_TEST(volk_32i_s32f_convert_32f, test_params))
142 QA(VOLK_INIT_TEST(volk_32i_x2_or_32i, test_params))
143 QA(VOLK_INIT_TEST(volk_32f_x2_dot_prod_16i, test_params))
144 QA(VOLK_INIT_TEST(volk_64f_convert_32f, test_params))
145 QA(VOLK_INIT_TEST(volk_64f_x2_max_64f, test_params))
146 QA(VOLK_INIT_TEST(volk_64f_x2_min_64f, test_params))
147 QA(VOLK_INIT_TEST(volk_64f_x2_multiply_64f, test_params))
148 QA(VOLK_INIT_TEST(volk_64f_x2_add_64f, test_params))
149 QA(VOLK_INIT_TEST(volk_8ic_deinterleave_16i_x2, test_params))
150 QA(VOLK_INIT_TEST(volk_8ic_s32f_deinterleave_32f_x2, test_params))
151 QA(VOLK_INIT_TEST(volk_8ic_deinterleave_real_16i, test_params))
152 QA(VOLK_INIT_TEST(volk_8ic_s32f_deinterleave_real_32f, test_params))
153 QA(VOLK_INIT_TEST(volk_8ic_deinterleave_real_8i, test_params))
154 QA(VOLK_INIT_TEST(volk_8ic_x2_multiply_conjugate_16ic, test_params))
155 QA(VOLK_INIT_TEST(volk_8ic_x2_s32f_multiply_conjugate_32fc, test_params))
156 QA(VOLK_INIT_TEST(volk_8i_convert_16i, test_params))
157 QA(VOLK_INIT_TEST(volk_8i_s32f_convert_32f, test_params))
158 QA(VOLK_INIT_TEST(volk_32fc_s32fc_multiply_32fc, test_params))
159 QA(VOLK_INIT_TEST(volk_32f_s32f_multiply_32f, test_params))
160 QA(VOLK_INIT_TEST(volk_32f_s32f_add_32f, test_params))
161 QA(VOLK_INIT_TEST(volk_32f_binary_slicer_32i, test_params))
162 QA(VOLK_INIT_TEST(volk_32f_binary_slicer_8i, test_params))
163 QA(VOLK_INIT_TEST(volk_32u_reverse_32u, test_params))
164 QA(VOLK_INIT_TEST(volk_32f_tanh_32f, test_params_inacc))
165 QA(VOLK_INIT_TEST(volk_32fc_x2_s32fc_multiply_conjugate_add_32fc, test_params))
167 volk_32f_s32f_mod_rangepuppet_32f, volk_32f_s32f_s32f_mod_range_32f, test_params))
169 volk_8u_x3_encodepolarpuppet_8u, volk_8u_x3_encodepolar_8u_x2, test_params))
170 QA(VOLK_INIT_PUPP(volk_32f_8u_polarbutterflypuppet_32f,
171 volk_32f_8u_polarbutterfly_32f,
173 QA(VOLK_INIT_PUPP(volk_32fc_s32f_power_spectral_densitypuppet_32f,
174 volk_32fc_s32f_x2_power_spectral_density_32f,
176 // no one uses these, so don't test them
177 // VOLK_PROFILE(volk_16i_x5_add_quad_16i_x4, 1e-4, 2046, 10000, &results,
178 // benchmark_mode, kernel_regex); VOLK_PROFILE(volk_16i_branch_4_state_8, 1e-4, 2046,
179 // 10000, &results, benchmark_mode, kernel_regex); VOLK_PROFILE(volk_16i_max_star_16i,
180 // 0, 0, 204602, 10000, &results, benchmark_mode, kernel_regex);
181 // VOLK_PROFILE(volk_16i_max_star_horizontal_16i, 0, 0, 204602, 10000, &results,
182 // benchmark_mode, kernel_regex); VOLK_PROFILE(volk_16i_permute_and_scalar_add, 1e-4,
183 // 0, 2046, 10000, &results, benchmark_mode, kernel_regex);
184 // VOLK_PROFILE(volk_16i_x4_quad_max_star_16i, 1e-4, 0, 2046, 10000, &results,
185 // benchmark_mode, kernel_regex);
186
187 return test_cases;
188}
Definition: qa_utils.h:56
volk_test_params_t make_absolute(float tol)
Definition: qa_utils.h:96
volk_test_params_t make_tol(float tol)
Definition: qa_utils.h:103
void set_tol(float tol)
Definition: qa_utils.h:82
void set_scalar(lv_32fc_t scalar)
Definition: qa_utils.h:83
#define QA(test)
Definition: kernel_tests.h:33
std::vector< volk_test_case_t > init_test_list(volk_test_params_t test_params)
Definition: kernel_tests.h:34
#define VOLK_INIT_TEST(func, test_params)
Definition: kernel_tests.h:27
#define VOLK_INIT_PUPP(func, puppet_master_func, test_params)
Definition: kernel_tests.h:20
volk_test_params_t test_params(1e-6f, 327.f, 131071, 1987, false, "")