Skip to content

Commit 4615c11

Browse files
author
Raghuveer Devulapalli
authored
Merge pull request #119 from sterrettm2/avx2_arg
Support for AVX2 argsort/argselect/key-value sort
2 parents 5c133e7 + 1cf135b commit 4615c11

15 files changed

+1636
-587
lines changed

lib/x86simdsort-avx2.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// AVX2 specific routines:
22
#include "avx2-32bit-qsort.hpp"
33
#include "avx2-64bit-qsort.hpp"
4+
#include "avx2-32bit-half.hpp"
5+
#include "xss-common-argsort.h"
46
#include "x86simdsort-internal.h"
57

68
#define DEFINE_ALL_METHODS(type) \
@@ -18,6 +20,17 @@
1820
void partial_qsort(type *arr, size_t k, size_t arrsize, bool hasnan) \
1921
{ \
2022
avx2_partial_qsort(arr, k, arrsize, hasnan); \
23+
}\
24+
template <> \
25+
std::vector<size_t> argsort(type *arr, size_t arrsize, bool hasnan) \
26+
{ \
27+
return avx2_argsort(arr, arrsize, hasnan); \
28+
} \
29+
template <> \
30+
std::vector<size_t> argselect( \
31+
type *arr, size_t k, size_t arrsize, bool hasnan) \
32+
{ \
33+
return avx2_argselect(arr, k, arrsize, hasnan); \
2134
}
2235

2336
namespace xss {

lib/x86simdsort.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,12 +189,12 @@ DISPATCH_ALL(partial_qsort,
189189
(ISA_LIST("avx512_skx", "avx2")))
190190
DISPATCH_ALL(argsort,
191191
(ISA_LIST("none")),
192-
(ISA_LIST("avx512_skx")),
193-
(ISA_LIST("avx512_skx")))
192+
(ISA_LIST("avx512_skx", "avx2")),
193+
(ISA_LIST("avx512_skx", "avx2")))
194194
DISPATCH_ALL(argselect,
195195
(ISA_LIST("none")),
196-
(ISA_LIST("avx512_skx")),
197-
(ISA_LIST("avx512_skx")))
196+
(ISA_LIST("avx512_skx", "avx2")),
197+
(ISA_LIST("avx512_skx", "avx2")))
198198

199199
#define DISPATCH_KEYVALUE_SORT_FORTYPE(type) \
200200
DISPATCH_KEYVALUE_SORT(type, uint64_t, (ISA_LIST("avx512_skx")))\

0 commit comments

Comments
 (0)