88
99template <class T , uint16_t N, uint16_t K = N> static constexpr auto BestSIMDHelper ();
1010
11- template <class T , uint16_t N> static constexpr auto GetPaddedSIMDSize ();
11+ template <class T , uint16_t N> static constexpr auto GetPaddedSIMDWidth ();
1212
1313template <class T > static uint16_t get_padding (uint16_t ns);
1414
@@ -17,11 +17,11 @@ template<class T, uint16_t ns> static constexpr auto get_padding();
1717template <class T , uint16_t N>
1818using BestSIMD = typename decltype (BestSIMDHelper<T, N, xsimd::batch<T>::size>())::type;
1919
20- template <class T , uint16_t N = 1 > static constexpr uint16_t min_batch_size ();
20+ template <class T , uint16_t N = 1 > static constexpr uint16_t min_simd_width ();
2121
22- template <class T , uint16_t N = min_batch_size <T>()> constexpr uint16_t max_batch_size ();
22+ template <class T , uint16_t N = min_simd_width <T>()> constexpr uint16_t max_simd_width ();
2323
24- template <class T , uint16_t N> static constexpr auto find_optimal_batch_size ();
24+ template <class T , uint16_t N> static constexpr auto find_optimal_simd_width ();
2525
2626// below there is some trickery to obtain the padded SIMD type to vectorize
2727// the given number of elements.
@@ -37,26 +37,26 @@ template<class T, uint16_t N, uint16_t K> static constexpr auto BestSIMDHelper()
3737 }
3838}
3939
40- template <class T , uint16_t N> constexpr uint16_t min_batch_size () {
40+ template <class T , uint16_t N> constexpr uint16_t min_simd_width () {
4141 if constexpr (std::is_void_v<xsimd::make_sized_batch_t <T, N>>) {
42- return min_batch_size <T, N * 2 >();
42+ return min_simd_width <T, N * 2 >();
4343 } else {
4444 return N;
4545 }
4646};
4747
48- template <class T , uint16_t N> constexpr uint16_t max_batch_size () {
48+ template <class T , uint16_t N> constexpr uint16_t max_simd_width () {
4949 if constexpr (!std::is_void_v<xsimd::make_sized_batch_t <T, N * 2 >>) {
50- return max_batch_size <T, N * 2 >();
50+ return max_simd_width <T, N * 2 >();
5151 } else {
5252 return N;
5353 }
5454};
5555
56- template <class T , uint16_t N> static constexpr auto find_optimal_batch_size () {
56+ template <class T , uint16_t N> static constexpr auto find_optimal_simd_width () {
5757 uint16_t min_iterations = N;
5858 uint16_t optimal_batch_size = 1 ;
59- for (uint16_t batch_size = min_batch_size <T>(); batch_size <= xsimd::batch<T>::size;
59+ for (uint16_t batch_size = min_simd_width <T>(); batch_size <= xsimd::batch<T>::size;
6060 batch_size *= 2 ) {
6161 uint16_t iterations = (N + batch_size - 1 ) / batch_size;
6262 if (iterations < min_iterations) {
@@ -67,13 +67,13 @@ template<class T, uint16_t N> static constexpr auto find_optimal_batch_size() {
6767 return optimal_batch_size;
6868}
6969
70- template <class T , uint16_t N> static constexpr auto GetPaddedSIMDSize () {
70+ template <class T , uint16_t N> static constexpr auto GetPaddedSIMDWidth () {
7171 static_assert (N < 128 );
72- return xsimd::make_sized_batch<T, find_optimal_batch_size <T, N>()>::type::size;
72+ return xsimd::make_sized_batch<T, find_optimal_simd_width <T, N>()>::type::size;
7373}
7474
7575template <class T , uint16_t ns> static constexpr auto get_padding () {
76- constexpr uint16_t width = GetPaddedSIMDSize <T, ns>();
76+ constexpr uint16_t width = GetPaddedSIMDWidth <T, ns>();
7777 return ((ns + width - 1 ) & (-width)) - ns;
7878}
7979
@@ -113,8 +113,8 @@ template<uint16_t low, uint16_t high> constexpr uint16_t po2_in_between() {
113113}
114114
115115template <class T , uint16_t N> constexpr auto mixed_vectors () {
116- constexpr auto min_batch = min_batch_size <T>();
117- constexpr auto max_batch = max_batch_size <T>();
116+ constexpr auto min_batch = min_simd_width <T>();
117+ constexpr auto max_batch = max_simd_width <T>();
118118 // compute all the power of 2 between min_batch and max_batch
119119
120120 std::array<uint16_t , po2_in_between<min_batch, max_batch>() + 1 > batch_sizes{1 };
@@ -145,13 +145,13 @@ template<class T, uint16_t N> constexpr auto mixed_vectors() {
145145
146146int main (int argc, char *argv[]) {
147147 std::cout << " Min batch size for single precision is "
148- << uint64_t (min_batch_size <float >()) << std::endl;
148+ << uint64_t (min_simd_width <float >()) << std::endl;
149149 std::cout << " Max batch size for single precision is "
150- << uint64_t (max_batch_size <float >()) << std::endl;
150+ << uint64_t (max_simd_width <float >()) << std::endl;
151151 std::cout << " Min batch size for double precision is "
152- << uint64_t (min_batch_size <double >()) << std::endl;
152+ << uint64_t (min_simd_width <double >()) << std::endl;
153153 std::cout << " Max batch size for double precision is "
154- << uint64_t (max_batch_size <double >()) << std::endl;
154+ << uint64_t (max_simd_width <double >()) << std::endl;
155155
156156 std::cout << " Best SIMD single precision" << std::endl;
157157 std::cout << " SIMD for " << 4 << " is " << uint64_t (BestSIMD<float , 4 >::size)
@@ -191,47 +191,47 @@ int main(int argc, char *argv[]) {
191191
192192 std::cout << " Padded SIMD single precision" << std::endl;
193193 std::cout << " Padded SIMD for " << 4 << " is "
194- << uint64_t (GetPaddedSIMDSize <float , 4 >()) << std::endl;
194+ << uint64_t (GetPaddedSIMDWidth <float , 4 >()) << std::endl;
195195 std::cout << " Padded SIMD for " << 6 << " is "
196- << uint64_t (GetPaddedSIMDSize <float , 6 >()) << std::endl;
196+ << uint64_t (GetPaddedSIMDWidth <float , 6 >()) << std::endl;
197197 std::cout << " Padded SIMD for " << 10 << " is "
198- << uint64_t (GetPaddedSIMDSize <float , 10 >()) << std::endl;
198+ << uint64_t (GetPaddedSIMDWidth <float , 10 >()) << std::endl;
199199 std::cout << " Padded SIMD for " << 12 << " is "
200- << uint64_t (GetPaddedSIMDSize <float , 12 >()) << std::endl;
200+ << uint64_t (GetPaddedSIMDWidth <float , 12 >()) << std::endl;
201201 std::cout << " Padded SIMD for " << 15 << " is "
202- << uint64_t (GetPaddedSIMDSize <float , 15 >()) << std::endl;
202+ << uint64_t (GetPaddedSIMDWidth <float , 15 >()) << std::endl;
203203 std::cout << " Padded SIMD for " << 18 << " is "
204- << uint64_t (GetPaddedSIMDSize <float , 18 >()) << std::endl;
204+ << uint64_t (GetPaddedSIMDWidth <float , 18 >()) << std::endl;
205205 std::cout << " Padded SIMD for " << 22 << " is "
206- << uint64_t (GetPaddedSIMDSize <float , 22 >()) << std::endl;
206+ << uint64_t (GetPaddedSIMDWidth <float , 22 >()) << std::endl;
207207 std::cout << " Padded SIMD for " << 26 << " is "
208- << uint64_t (GetPaddedSIMDSize <float , 26 >()) << std::endl;
208+ << uint64_t (GetPaddedSIMDWidth <float , 26 >()) << std::endl;
209209 std::cout << " Padded SIMD for " << 30 << " is "
210- << uint64_t (GetPaddedSIMDSize <float , 30 >()) << std::endl;
210+ << uint64_t (GetPaddedSIMDWidth <float , 30 >()) << std::endl;
211211 std::cout << " Padded SIMD for " << 32 << " is "
212- << uint64_t (GetPaddedSIMDSize <float , 32 >()) << std::endl;
212+ << uint64_t (GetPaddedSIMDWidth <float , 32 >()) << std::endl;
213213
214214 std::cout << " Padded SIMD double precision" << std::endl;
215215 std::cout << " Padded SIMD for " << 4 << " is "
216- << uint64_t (GetPaddedSIMDSize <double , 4 >()) << std::endl;
216+ << uint64_t (GetPaddedSIMDWidth <double , 4 >()) << std::endl;
217217 std::cout << " Padded SIMD for " << 6 << " is "
218- << uint64_t (GetPaddedSIMDSize <double , 6 >()) << std::endl;
218+ << uint64_t (GetPaddedSIMDWidth <double , 6 >()) << std::endl;
219219 std::cout << " Padded SIMD for " << 10 << " is "
220- << uint64_t (GetPaddedSIMDSize <double , 10 >()) << std::endl;
220+ << uint64_t (GetPaddedSIMDWidth <double , 10 >()) << std::endl;
221221 std::cout << " Padded SIMD for " << 12 << " is "
222- << uint64_t (GetPaddedSIMDSize <double , 12 >()) << std::endl;
222+ << uint64_t (GetPaddedSIMDWidth <double , 12 >()) << std::endl;
223223 std::cout << " Padded SIMD for " << 15 << " is "
224- << uint64_t (GetPaddedSIMDSize <double , 15 >()) << std::endl;
224+ << uint64_t (GetPaddedSIMDWidth <double , 15 >()) << std::endl;
225225 std::cout << " Padded SIMD for " << 18 << " is "
226- << uint64_t (GetPaddedSIMDSize <double , 18 >()) << std::endl;
226+ << uint64_t (GetPaddedSIMDWidth <double , 18 >()) << std::endl;
227227 std::cout << " Padded SIMD for " << 22 << " is "
228- << uint64_t (GetPaddedSIMDSize <double , 22 >()) << std::endl;
228+ << uint64_t (GetPaddedSIMDWidth <double , 22 >()) << std::endl;
229229 std::cout << " Padded SIMD for " << 26 << " is "
230- << uint64_t (GetPaddedSIMDSize <double , 26 >()) << std::endl;
230+ << uint64_t (GetPaddedSIMDWidth <double , 26 >()) << std::endl;
231231 std::cout << " Padded SIMD for " << 30 << " is "
232- << uint64_t (GetPaddedSIMDSize <double , 30 >()) << std::endl;
232+ << uint64_t (GetPaddedSIMDWidth <double , 30 >()) << std::endl;
233233 std::cout << " Padded SIMD for " << 32 << " is "
234- << uint64_t (GetPaddedSIMDSize <double , 32 >()) << std::endl;
234+ << uint64_t (GetPaddedSIMDWidth <double , 32 >()) << std::endl;
235235
236236 std::cout << " single precision" << std::endl;
237237 for (auto i = 2 ; i < 16 ; i++) {
0 commit comments