diff --git a/src/avx512-64bit-common.h b/src/avx512-64bit-common.h index 65ee85db..0c4e3d58 100644 --- a/src/avx512-64bit-common.h +++ b/src/avx512-64bit-common.h @@ -912,6 +912,19 @@ struct zmm_vector { 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 : public zmm_vector { +}; +#endif + template <> struct zmm_vector { using type_t = double; diff --git a/src/xss-common-argsort.h b/src/xss-common-argsort.h index 05605831..a0a6efb1 100644 --- a/src/xss-common-argsort.h +++ b/src/xss-common-argsort.h @@ -549,19 +549,10 @@ avx512_argsort(T *arr, arrsize_t *arg, arrsize_t arrsize, bool hasnan = false) ymm_vector, zmm_vector>::type; -/* Workaround for NumPy failed build on macOS x86_64: implicit instantiation of - * undefined template 'zmm_vector'*/ -#ifdef __APPLE__ - using argtype = - typename std::conditional, - zmm_vector>::type; -#else using argtype = typename std::conditional, zmm_vector>::type; -#endif if (arrsize > 1) { if constexpr (std::is_floating_point_v) { @@ -595,18 +586,10 @@ avx2_argsort(T *arr, arrsize_t *arg, arrsize_t arrsize, bool hasnan = false) avx2_half_vector, avx2_vector>::type; -#ifdef __APPLE__ - using argtype = - typename std::conditional, - avx2_vector>::type; -#else using argtype = typename std::conditional, avx2_vector>::type; -#endif - if (arrsize > 1) { if constexpr (std::is_floating_point_v) { if ((hasnan) && (array_has_nan(arr, arrsize))) { @@ -643,19 +626,10 @@ X86_SIMD_SORT_INLINE void avx512_argselect(T *arr, ymm_vector, zmm_vector>::type; -/* Workaround for NumPy failed build on macOS x86_64: implicit instantiation of - * undefined template 'zmm_vector'*/ -#ifdef __APPLE__ - using argtype = - typename std::conditional, - zmm_vector>::type; -#else using argtype = typename std::conditional, zmm_vector>::type; -#endif if (arrsize > 1) { if constexpr (std::is_floating_point_v) { @@ -692,17 +666,10 @@ X86_SIMD_SORT_INLINE void avx2_argselect(T *arr, avx2_half_vector, avx2_vector>::type; -#ifdef __APPLE__ - using argtype = - typename std::conditional, - avx2_vector>::type; -#else using argtype = typename std::conditional, avx2_vector>::type; -#endif if (arrsize > 1) { if constexpr (std::is_floating_point_v) { diff --git a/src/xss-network-keyvaluesort.hpp b/src/xss-network-keyvaluesort.hpp index 8c366a8a..1cbbc159 100644 --- a/src/xss-network-keyvaluesort.hpp +++ b/src/xss-network-keyvaluesort.hpp @@ -442,7 +442,7 @@ bitonic_fullmerge_n_vec(typename keyType::reg_t *keys, template 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; @@ -587,7 +587,7 @@ X86_SIMD_SORT_INLINE void kvsort_n_vec(typename keyType::type_t *keys, template 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,