From ad174001a869f42bb89ccff77ac3eec04a9d71e8 Mon Sep 17 00:00:00 2001 From: Sayed Adel Date: Tue, 21 Jan 2020 11:56:33 +0200 Subject: ENH: improve runtime detection of CPU features - Put the old CPU detection code to rest The current CPU detection code only supports x86 and it's count on compiler built-in functions that not widely supported by other compilers or platforms. NOTE: `npy_cpu_supports` is removed rather than deprecated, use the macro `NPY_CPU_HAVE(FEATURE_NAME_WITHOUT_QUOTES)` instead. - Initialize the new CPU features runtime detector Almost similar to GCC built-in functions, so instead of `__builtin_cpu_init`, `__builtin_cpu_supports` its provide `npy_cpu_init`, `npy_cpu_have` and `NPY_CPU_HAVE`. NOTE: `npy_cpu_init` must be called before any use of `npy_cpu_have` and `NPY_CPU_HAVE`, however `npy_cpu_init` already called during the load of module `umath` so there's no reason to call it again in most of the cases. - Add X86 support detect almost all x86 features, also provide CPU feature groups that gather several features. e.g. `AVX512_KNM` detect Knights Mill's `AVX512` features - Add IBM/Power support only supports Linux and count here on `glibc(getauxval)` to detect VSX support and fail-back to the compiler definitions for other platforms. - Add ARM support Same as IBM/Power but its parse `/proc/self/auxv` if `glibc(getauxval)` isn't available. - Update umath generator - Add testing unit for Linux only - Add new attribute `__cpu_features__` to umath module `__cpu_features__` is a dictionary contains all supported CPU feature names with runtime availability --- numpy/core/setup_common.py | 5 ----- 1 file changed, 5 deletions(-) (limited to 'numpy/core/setup_common.py') diff --git a/numpy/core/setup_common.py b/numpy/core/setup_common.py index 6d8e603a7..c0703c5c4 100644 --- a/numpy/core/setup_common.py +++ b/numpy/core/setup_common.py @@ -133,11 +133,6 @@ OPTIONAL_INTRINSICS = [("__builtin_isnan", '5.'), ("__builtin_bswap64", '5u'), ("__builtin_expect", '5, 0'), ("__builtin_mul_overflow", '5, 5, (int*)5'), - # broken on OSX 10.11, make sure its not optimized away - ("volatile int r = __builtin_cpu_supports", '"sse"', - "stdio.h", "__BUILTIN_CPU_SUPPORTS"), - ("volatile int r = __builtin_cpu_supports", '"avx512f"', - "stdio.h", "__BUILTIN_CPU_SUPPORTS_AVX512F"), # MMX only needed for icc, but some clangs don't have it ("_m_from_int64", '0', "emmintrin.h"), ("_mm_load_ps", '(float*)0', "xmmintrin.h"), # SSE -- cgit v1.2.1