From cd9f1a87d6f200b3ccb4be7dc646b4832b321ba9 Mon Sep 17 00:00:00 2001 From: Raghuveer Devulapalli Date: Wed, 22 May 2019 16:27:47 -0700 Subject: BUG: AVX2 impl of sin/cos requires an FMA Without an FMA, the output of AVX2 and AVX512 version differ. This changes ensures the output across implementations remains exactly the same. --- numpy/core/include/numpy/npy_common.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'numpy/core/include') diff --git a/numpy/core/include/numpy/npy_common.h b/numpy/core/include/numpy/npy_common.h index 108c0a202..27b83f7b5 100644 --- a/numpy/core/include/numpy/npy_common.h +++ b/numpy/core/include/numpy/npy_common.h @@ -44,10 +44,14 @@ #else #define NPY_GCC_TARGET_AVX #endif + +#if defined HAVE_ATTRIBUTE_TARGET_AVX2_WITH_INTRINSICS +#define HAVE_ATTRIBUTE_TARGET_FMA +#define NPY_GCC_TARGET_FMA __attribute__((target("avx2,fma"))) +#endif + #if defined HAVE_ATTRIBUTE_TARGET_AVX2 && defined HAVE_LINK_AVX2 #define NPY_GCC_TARGET_AVX2 __attribute__((target("avx2"))) -#elif defined HAVE_ATTRIBUTE_TARGET_AVX2_WITH_INTRINSICS -#define NPY_GCC_TARGET_AVX2 __attribute__((target("avx2"))) #else #define NPY_GCC_TARGET_AVX2 #endif -- cgit v1.2.1