Skip to content

Commit

Permalink
Rearrange bench_epu8 a little
Browse files Browse the repository at this point in the history
  • Loading branch information
james-d-mitchell committed Oct 31, 2023
1 parent 8d401cd commit 31d797d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
29 changes: 16 additions & 13 deletions benchmark/bench_epu8.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 4 additions & 0 deletions include/hpcombi/epu.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ namespace detail { // Implementation detail code

/// Factory object for various SIMD constants in particular constexpr
template <class TPU> struct TPUBuild {
// Type for Packed Unsigned integer (TPU)
using type_elem = typename std::remove_reference_t<decltype((TPU{})[0])>;
static constexpr size_t size_elem = sizeof(type_elem);
static constexpr size_t size = sizeof(TPU) / size_elem;
Expand Down Expand Up @@ -154,6 +155,9 @@ inline const VectGeneric<16> &as_VectGeneric(const epu8 &v) {
return reinterpret_cast<const VectGeneric<16> &>(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 */
Expand Down

0 comments on commit 31d797d

Please sign in to comment.