From 31d797ddea816a09d4d438a6b4ec839975d70b08 Mon Sep 17 00:00:00 2001 From: "James D. Mitchell" Date: Tue, 31 Oct 2023 09:23:56 +0000 Subject: [PATCH] Rearrange bench_epu8 a little --- benchmark/bench_epu8.cpp | 29 ++++++++++++++++------------- include/hpcombi/epu.hpp | 4 ++++ 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/benchmark/bench_epu8.cpp b/benchmark/bench_epu8.cpp index 16560e0f..db17a42b 100644 --- a/benchmark/bench_epu8.cpp +++ b/benchmark/bench_epu8.cpp @@ -112,29 +112,32 @@ static const epu8 bla = {0, 2, 1, 4, 3, 6, 5, 8, 7, 10, 9, 12, 11, 14, 13, 15}; } // namespace TEST_CASE_METHOD(Fix_epu8, "Sorting", "[Perm16][000]") { - BENCHMARK_FREE_FN("| no lambda | perms | 1", std_sort, Fix_epu8::perms); - BENCHMARK_FREE_FN("| no lambda | perms | 2", std_sort, Fix_epu8::perms); - BENCHMARK_FREE_FN("| no lambda | perms | 3", std_sort, Fix_epu8::perms); - BENCHMARK_FREE_FN("| no lambda | perms | 4", std_sort, Fix_epu8::perms); - BENCHMARK_FREE_FN("| no lambda | perms", arr_sort, Fix_epu8::perms); - BENCHMARK_FREE_FN("| no lambda | perms", gen_sort, Fix_epu8::perms); - BENCHMARK_FREE_FN("| no lambda | perms", insertion_sort, Fix_epu8::perms); - BENCHMARK_FREE_FN("| no lambda | perms", sort_odd_even, Fix_epu8::perms); - BENCHMARK_FREE_FN("| no lambda | perms", radix_sort, Fix_epu8::perms); - BENCHMARK_FREE_FN("| no lambda | perms", sort_pair, Fix_epu8::perms); - BENCHMARK_FREE_FN("| no lambda | perms", HPCombi::sorted, Fix_epu8::perms); - - // lambda function is needed for inlining + BENCHMARK_FREE_FN("| no lambda | perms", std_sort, Fix_epu8::perms); BENCHMARK_LAMBDA("| lambda | perms", std_sort, Fix_epu8::perms); + + BENCHMARK_FREE_FN("| no lambda | perms", arr_sort, Fix_epu8::perms); BENCHMARK_LAMBDA("| lambda | perms", arr_sort, Fix_epu8::perms); + BENCHMARK_FREE_FN("| no lambda | perms", gen_sort, Fix_epu8::perms); BENCHMARK_LAMBDA("| lambda | perms", gen_sort, Fix_epu8::perms); + + BENCHMARK_FREE_FN("| no lambda | perms", insertion_sort, Fix_epu8::perms); BENCHMARK_LAMBDA("| lambda | perms", insertion_sort, Fix_epu8::perms); + + BENCHMARK_FREE_FN("| no lambda | perms", sort_odd_even, Fix_epu8::perms); BENCHMARK_LAMBDA("| lambda | perms", sort_odd_even, Fix_epu8::perms); + BENCHMARK_LAMBDA("| lambda | perms", radix_sort, Fix_epu8::perms); + BENCHMARK_FREE_FN("| no lambda | perms", radix_sort, Fix_epu8::perms); + + BENCHMARK_FREE_FN("| no lambda | perms", sort_pair, Fix_epu8::perms); BENCHMARK_LAMBDA("| lambda | perms", sort_pair, Fix_epu8::perms); + + BENCHMARK_FREE_FN("| no lambda | perms", HPCombi::sorted, Fix_epu8::perms); BENCHMARK_LAMBDA("| lambda | perms", HPCombi::sorted, Fix_epu8::perms); + // lambda function is needed for inlining + BENCHMARK_LAMBDA("| lambda | vects", std_sort, Fix_epu8::vects); BENCHMARK_LAMBDA("| lambda | vects", arr_sort, Fix_epu8::vects); BENCHMARK_LAMBDA("| lambda | vects", gen_sort, Fix_epu8::vects); diff --git a/include/hpcombi/epu.hpp b/include/hpcombi/epu.hpp index 0276dc62..69988adf 100644 --- a/include/hpcombi/epu.hpp +++ b/include/hpcombi/epu.hpp @@ -53,6 +53,7 @@ namespace detail { // Implementation detail code /// Factory object for various SIMD constants in particular constexpr template struct TPUBuild { + // Type for Packed Unsigned integer (TPU) using type_elem = typename std::remove_reference_t; static constexpr size_t size_elem = sizeof(type_elem); static constexpr size_t size = sizeof(TPU) / size_elem; @@ -154,6 +155,9 @@ inline const VectGeneric<16> &as_VectGeneric(const epu8 &v) { return reinterpret_cast &>(as_array(v)); } +// TODO up to this point in this file, everything could be generic to support +// larger perms, such as Perm32 in the experiments dir. + /** Test whether all the entries of a #HPCombi::epu8 are zero */ inline bool is_all_zero(epu8 a) noexcept { return simde_mm_testz_si128(a, a); } /** Test whether all the entries of a #HPCombi::epu8 are one */