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
13 changes: 13 additions & 0 deletions src/avx512-64bit-common.h
Original file line number Diff line number Diff line change
Expand Up @@ -912,6 +912,19 @@ struct zmm_vector<uint64_t> {
left_addr, right_addr, k, reg);
}
};

/*
* workaround on 64-bit macOS which defines size_t as unsigned long and defines
* uint64_t as unsigned long long, both of which are 8 bytes
*/
#if defined(__APPLE__) && defined(__x86_64__)
static_assert(sizeof(size_t) == sizeof(uint64_t),
"Size of size_t and uint64_t are not the same");
template <>
struct zmm_vector<size_t> : public zmm_vector<uint64_t> {
};
#endif

template <>
struct zmm_vector<double> {
using type_t = double;
Expand Down
33 changes: 0 additions & 33 deletions src/xss-common-argsort.h
Original file line number Diff line number Diff line change
Expand Up @@ -549,19 +549,10 @@ avx512_argsort(T *arr, arrsize_t *arg, arrsize_t arrsize, bool hasnan = false)
ymm_vector<T>,
zmm_vector<T>>::type;

/* Workaround for NumPy failed build on macOS x86_64: implicit instantiation of
* undefined template 'zmm_vector<unsigned long>'*/
#ifdef __APPLE__
using argtype =
typename std::conditional<sizeof(arrsize_t) == sizeof(int32_t),
ymm_vector<uint32_t>,
zmm_vector<uint64_t>>::type;
#else
using argtype =
typename std::conditional<sizeof(arrsize_t) == sizeof(int32_t),
ymm_vector<arrsize_t>,
zmm_vector<arrsize_t>>::type;
#endif

if (arrsize > 1) {
if constexpr (std::is_floating_point_v<T>) {
Expand Down Expand Up @@ -595,18 +586,10 @@ avx2_argsort(T *arr, arrsize_t *arg, arrsize_t arrsize, bool hasnan = false)
avx2_half_vector<T>,
avx2_vector<T>>::type;

#ifdef __APPLE__
using argtype =
typename std::conditional<sizeof(arrsize_t) == sizeof(int32_t),
avx2_half_vector<uint32_t>,
avx2_vector<uint64_t>>::type;
#else
using argtype =
typename std::conditional<sizeof(arrsize_t) == sizeof(int32_t),
avx2_half_vector<arrsize_t>,
avx2_vector<arrsize_t>>::type;
#endif

if (arrsize > 1) {
if constexpr (std::is_floating_point_v<T>) {
if ((hasnan) && (array_has_nan<vectype>(arr, arrsize))) {
Expand Down Expand Up @@ -643,19 +626,10 @@ X86_SIMD_SORT_INLINE void avx512_argselect(T *arr,
ymm_vector<T>,
zmm_vector<T>>::type;

/* Workaround for NumPy failed build on macOS x86_64: implicit instantiation of
* undefined template 'zmm_vector<unsigned long>'*/
#ifdef __APPLE__
using argtype =
typename std::conditional<sizeof(arrsize_t) == sizeof(int32_t),
ymm_vector<uint32_t>,
zmm_vector<uint64_t>>::type;
#else
using argtype =
typename std::conditional<sizeof(arrsize_t) == sizeof(int32_t),
ymm_vector<arrsize_t>,
zmm_vector<arrsize_t>>::type;
#endif

if (arrsize > 1) {
if constexpr (std::is_floating_point_v<T>) {
Expand Down Expand Up @@ -692,17 +666,10 @@ X86_SIMD_SORT_INLINE void avx2_argselect(T *arr,
avx2_half_vector<T>,
avx2_vector<T>>::type;

#ifdef __APPLE__
using argtype =
typename std::conditional<sizeof(arrsize_t) == sizeof(int32_t),
avx2_half_vector<uint32_t>,
avx2_vector<uint64_t>>::type;
#else
using argtype =
typename std::conditional<sizeof(arrsize_t) == sizeof(int32_t),
avx2_half_vector<arrsize_t>,
avx2_vector<arrsize_t>>::type;
#endif

if (arrsize > 1) {
if constexpr (std::is_floating_point_v<T>) {
Expand Down
4 changes: 2 additions & 2 deletions src/xss-network-keyvaluesort.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ bitonic_fullmerge_n_vec(typename keyType::reg_t *keys,

template <typename keyType, typename indexType, int numVecs>
X86_SIMD_SORT_INLINE void argsort_n_vec(typename keyType::type_t *keys,
typename indexType::type_t *indices,
arrsize_t *indices,
int N)
{
using kreg_t = typename keyType::reg_t;
Expand Down Expand Up @@ -587,7 +587,7 @@ X86_SIMD_SORT_INLINE void kvsort_n_vec(typename keyType::type_t *keys,

template <typename keyType, typename indexType, int maxN>
X86_SIMD_SORT_INLINE void argsort_n(typename keyType::type_t *keys,
typename indexType::type_t *indices,
arrsize_t *indices,
int N)
{
static_assert(keyType::numlanes == indexType::numlanes,
Expand Down