|
1 | 1 | #include "x86_simd_qsort.hpp"
|
2 | 2 | #ifndef __CYGWIN__
|
3 | 3 |
|
4 |
| -#if defined(NPY_HAVE_AVX512_SKX) |
5 |
| -#include "x86-simd-sort/src/avx512-64bit-argsort.hpp" |
6 |
| -#elif defined(NPY_HAVE_AVX2) |
7 |
| -#include "x86-simd-sort/src/avx2-32bit-half.hpp" |
8 |
| -#include "x86-simd-sort/src/avx2-32bit-qsort.hpp" |
9 |
| -#include "x86-simd-sort/src/avx2-64bit-qsort.hpp" |
10 |
| -#include "x86-simd-sort/src/xss-common-argsort.h" |
11 |
| -#endif |
12 |
| - |
13 |
| -namespace { |
14 |
| -template<typename T> |
15 |
| -void x86_argsort(T* arr, size_t* arg, npy_intp num) |
16 |
| -{ |
17 |
| -#if defined(NPY_HAVE_AVX512_SKX) |
18 |
| - avx512_argsort(arr, arg, num, true); |
19 |
| -#elif defined(NPY_HAVE_AVX2) |
20 |
| - avx2_argsort(arr, arg, num, true); |
21 |
| -#endif |
22 |
| -} |
23 |
| - |
24 |
| -template<typename T> |
25 |
| -void x86_argselect(T* arr, size_t* arg, npy_intp kth, npy_intp num) |
26 |
| -{ |
27 |
| -#if defined(NPY_HAVE_AVX512_SKX) |
28 |
| - avx512_argselect(arr, arg, kth, num, true); |
29 |
| -#elif defined(NPY_HAVE_AVX2) |
30 |
| - avx2_argselect(arr, arg, kth, num, true); |
31 |
| -#endif |
32 |
| -} |
33 |
| -} // anonymous |
| 4 | +#include "x86-simd-sort/src/x86simdsort-static-incl.h" |
34 | 5 |
|
35 | 6 | namespace np { namespace qsort_simd {
|
36 | 7 |
|
37 | 8 | template<> void NPY_CPU_DISPATCH_CURFX(ArgQSelect)(int32_t *arr, npy_intp* arg, npy_intp num, npy_intp kth)
|
38 | 9 | {
|
39 |
| - x86_argselect(arr, reinterpret_cast<size_t*>(arg), kth, num); |
| 10 | + x86simdsortStatic::argselect(arr, reinterpret_cast<size_t*>(arg), kth, num); |
40 | 11 | }
|
41 | 12 | template<> void NPY_CPU_DISPATCH_CURFX(ArgQSelect)(uint32_t *arr, npy_intp* arg, npy_intp num, npy_intp kth)
|
42 | 13 | {
|
43 |
| - x86_argselect(arr, reinterpret_cast<size_t*>(arg), kth, num); |
| 14 | + x86simdsortStatic::argselect(arr, reinterpret_cast<size_t*>(arg), kth, num); |
44 | 15 | }
|
45 | 16 | template<> void NPY_CPU_DISPATCH_CURFX(ArgQSelect)(int64_t*arr, npy_intp* arg, npy_intp num, npy_intp kth)
|
46 | 17 | {
|
47 |
| - x86_argselect(arr, reinterpret_cast<size_t*>(arg), kth, num); |
| 18 | + x86simdsortStatic::argselect(arr, reinterpret_cast<size_t*>(arg), kth, num); |
48 | 19 | }
|
49 | 20 | template<> void NPY_CPU_DISPATCH_CURFX(ArgQSelect)(uint64_t*arr, npy_intp* arg, npy_intp num, npy_intp kth)
|
50 | 21 | {
|
51 |
| - x86_argselect(arr, reinterpret_cast<size_t*>(arg), kth, num); |
| 22 | + x86simdsortStatic::argselect(arr, reinterpret_cast<size_t*>(arg), kth, num); |
52 | 23 | }
|
53 | 24 | template<> void NPY_CPU_DISPATCH_CURFX(ArgQSelect)(float *arr, npy_intp* arg, npy_intp num, npy_intp kth)
|
54 | 25 | {
|
55 |
| - x86_argselect(arr, reinterpret_cast<size_t*>(arg), kth, num); |
| 26 | + x86simdsortStatic::argselect(arr, reinterpret_cast<size_t*>(arg), kth, num, true); |
56 | 27 | }
|
57 | 28 | template<> void NPY_CPU_DISPATCH_CURFX(ArgQSelect)(double *arr, npy_intp* arg, npy_intp num, npy_intp kth)
|
58 | 29 | {
|
59 |
| - x86_argselect(arr, reinterpret_cast<size_t*>(arg), kth, num); |
| 30 | + x86simdsortStatic::argselect(arr, reinterpret_cast<size_t*>(arg), kth, num, true); |
60 | 31 | }
|
61 | 32 | template<> void NPY_CPU_DISPATCH_CURFX(ArgQSort)(int32_t *arr, npy_intp *arg, npy_intp size)
|
62 | 33 | {
|
63 |
| - x86_argsort(arr, reinterpret_cast<size_t*>(arg), size); |
| 34 | + x86simdsortStatic::argsort(arr, reinterpret_cast<size_t*>(arg), size); |
64 | 35 | }
|
65 | 36 | template<> void NPY_CPU_DISPATCH_CURFX(ArgQSort)(uint32_t *arr, npy_intp *arg, npy_intp size)
|
66 | 37 | {
|
67 |
| - x86_argsort(arr, reinterpret_cast<size_t*>(arg), size); |
| 38 | + x86simdsortStatic::argsort(arr, reinterpret_cast<size_t*>(arg), size); |
68 | 39 | }
|
69 | 40 | template<> void NPY_CPU_DISPATCH_CURFX(ArgQSort)(int64_t *arr, npy_intp *arg, npy_intp size)
|
70 | 41 | {
|
71 |
| - x86_argsort(arr, reinterpret_cast<size_t*>(arg), size); |
| 42 | + x86simdsortStatic::argsort(arr, reinterpret_cast<size_t*>(arg), size); |
72 | 43 | }
|
73 | 44 | template<> void NPY_CPU_DISPATCH_CURFX(ArgQSort)(uint64_t *arr, npy_intp *arg, npy_intp size)
|
74 | 45 | {
|
75 |
| - x86_argsort(arr, reinterpret_cast<size_t*>(arg), size); |
| 46 | + x86simdsortStatic::argsort(arr, reinterpret_cast<size_t*>(arg), size); |
76 | 47 | }
|
77 | 48 | template<> void NPY_CPU_DISPATCH_CURFX(ArgQSort)(float *arr, npy_intp *arg, npy_intp size)
|
78 | 49 | {
|
79 |
| - x86_argsort(arr, reinterpret_cast<size_t*>(arg), size); |
| 50 | + x86simdsortStatic::argsort(arr, reinterpret_cast<size_t*>(arg), size, true); |
80 | 51 | }
|
81 | 52 | template<> void NPY_CPU_DISPATCH_CURFX(ArgQSort)(double *arr, npy_intp *arg, npy_intp size)
|
82 | 53 | {
|
83 |
| - x86_argsort(arr, reinterpret_cast<size_t*>(arg), size); |
| 54 | + x86simdsortStatic::argsort(arr, reinterpret_cast<size_t*>(arg), size, true); |
84 | 55 | }
|
85 | 56 |
|
86 | 57 | }} // namespace np::simd
|
|
0 commit comments