diff options
author | Raghuveer Devulapalli <raghuveer.devulapalli@intel.com> | 2022-10-10 22:31:02 -0700 |
---|---|---|
committer | Raghuveer Devulapalli <raghuveer.devulapalli@intel.com> | 2023-01-30 13:38:39 -0800 |
commit | 92bd9902d4233d9f5befe05fd47bfb8b2d4e102a (patch) | |
tree | 8dd2626a99125c126cb628e037e2a07748da12d0 /numpy/core | |
parent | fba06e75e4865168f5c3b6637c8a792fc1d9a2d7 (diff) | |
download | numpy-92bd9902d4233d9f5befe05fd47bfb8b2d4e102a.tar.gz |
MAINT: Disable AVX-512 qsort on macOS and WIN32
Diffstat (limited to 'numpy/core')
-rw-r--r-- | numpy/core/setup.py | 18 | ||||
-rw-r--r-- | numpy/core/src/npysort/quicksort.cpp | 8 |
2 files changed, 23 insertions, 3 deletions
diff --git a/numpy/core/setup.py b/numpy/core/setup.py index 912867709..fb91f8e68 100644 --- a/numpy/core/setup.py +++ b/numpy/core/setup.py @@ -68,6 +68,15 @@ class CallOnceOnly: out = copy.deepcopy(pickle.loads(self._check_complex)) return out +# Temporarily disable AVX512 sorting on WIN32 and macOS until we can figure +# out why the build fails +def enable_avx512_qsort(): + enable = True + platform = sysconfig.get_platform() + if "win32" in platform or "macos" in platform: + enable = False + return enable + def can_link_svml(): """SVML library is supported only on x86_64 architecture and currently only on linux @@ -484,6 +493,9 @@ def configuration(parent_package='',top_path=None): if can_link_svml(): moredefs.append(('NPY_CAN_LINK_SVML', 1)) + if enable_avx512_qsort(): + moredefs.append(('NPY_ENABLE_AVX512_QSORT', 1)) + # Use bogus stride debug aid to flush out bugs where users use # strides of dimensions with length 1 to index a full contiguous # array. @@ -943,7 +955,6 @@ def configuration(parent_package='',top_path=None): join('src', 'multiarray', 'usertypes.c'), join('src', 'multiarray', 'vdot.c'), join('src', 'common', 'npy_sort.h.src'), - join('src', 'npysort', 'x86-qsort-skx.dispatch.cpp'), join('src', 'npysort', 'quicksort.cpp'), join('src', 'npysort', 'mergesort.cpp'), join('src', 'npysort', 'timsort.cpp'), @@ -967,6 +978,11 @@ def configuration(parent_package='',top_path=None): join('src', 'npymath', 'arm64_exports.c'), ] + if enable_avx512_qsort(): + multiarray_src += [ + join('src', 'npysort', 'x86-qsort-skx.dispatch.cpp'), + ] + ####################################################################### # _multiarray_umath module - umath part # ####################################################################### diff --git a/numpy/core/src/npysort/quicksort.cpp b/numpy/core/src/npysort/quicksort.cpp index 0674d25ac..363daf46f 100644 --- a/numpy/core/src/npysort/quicksort.cpp +++ b/numpy/core/src/npysort/quicksort.cpp @@ -55,13 +55,15 @@ #include "npysort_heapsort.h" #include "numpy_tag.h" -#include "x86-qsort-skx.h" #include <cstdlib> #include <utility> +#ifdef NPY_ENABLE_AVX512_QSORT +#include "x86-qsort-skx.h" #ifndef NPY_DISABLE_OPTIMIZATION #include "x86-qsort-skx.dispatch.h" -#endif +#endif // NPY_DISABLE_OPTIMIZATION +#endif // NPY_ENABLE_AVX512_QSORT #define NOT_USED NPY_UNUSED(unused) /* @@ -86,6 +88,7 @@ struct x86_dispatch { static bool quicksort(typename Tag::type *, npy_intp) { return false; } }; +#ifdef NPY_ENABLE_AVX512_QSORT #if NPY_SIZEOF_LONG == 8 template <> struct x86_dispatch<npy::long_tag> { @@ -197,6 +200,7 @@ struct x86_dispatch<npy::float_tag> { return false; } }; +#endif // NPY_ENABLE_AVX512_QSORT } // namespace |