Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/avx512-common-qsort.h
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,7 @@ static void qsort_(type_t *arr, int64_t left, int64_t right, int64_t max_iters)
* Resort to std::sort if quicksort isnt making any progress
*/
if (max_iters <= 0) {
std::sort(arr + left, arr + right + 1);
std::sort(arr + left, arr + right + 1, comparison_func<vtype>);
return;
}
/*
Expand Down Expand Up @@ -868,7 +868,7 @@ static void qselect_(type_t *arr,
* Resort to std::sort if quicksort isnt making any progress
*/
if (max_iters <= 0) {
std::sort(arr + left, arr + right + 1);
std::sort(arr + left, arr + right + 1, comparison_func<vtype>);
return;
}
/*
Expand Down
14 changes: 14 additions & 0 deletions tests/test-qselect.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,20 @@ class avx512_select : public ::testing::Test {
};
TYPED_TEST_SUITE_P(avx512_select);

#ifdef __FLT16_MAX__
TEST(avx512_select, test_simple)
{
if (__builtin_cpu_supports("avx512vbmi2")) {
std::vector<_Float16> arr{1.0, -1.0};
avx512_qselect_fp16(reinterpret_cast<uint16_t*>(arr.data()), 0, arr.size());
ASSERT_EQ(arr[0], -1.0);
}
else {
GTEST_SKIP() << "Skipping this test, it requires avx512vbmi2";
}
}
#endif

TYPED_TEST_P(avx512_select, test_random)
{
if (__builtin_cpu_supports("avx512bw")) {
Expand Down