From 3af8c262acdfb50fbfc88e6c640d5d1a582145a9 Mon Sep 17 00:00:00 2001 From: David Tellenbach Date: Sat, 25 Dec 2021 19:51:42 +0000 Subject: [PATCH] Include immintrin.h if F16C is available and vectorization is disabled If EIGEN_DONT_VECTORIZE is defined, immintrin.h is not included even if F16C is available. Trying to use F16C intrinsics thus fails. This fixes issue #2395. (cherry picked from commit c06c3e52a082e403e7a241350fd867e907c833dc) --- Eigen/src/Core/util/ConfigureVectorization.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Eigen/src/Core/util/ConfigureVectorization.h b/Eigen/src/Core/util/ConfigureVectorization.h index 73e8a65a5..2d12e1d17 100644 --- a/Eigen/src/Core/util/ConfigureVectorization.h +++ b/Eigen/src/Core/util/ConfigureVectorization.h @@ -442,9 +442,11 @@ // We can use the optimized fp16 to float and float to fp16 conversion routines #define EIGEN_HAS_FP16_C - #if EIGEN_COMP_CLANG - // Workaround for clang: The FP16C intrinsics for clang are included by - // immintrin.h, as opposed to emmintrin.h as suggested by Intel: + #if EIGEN_COMP_GNUC + // Make sure immintrin.h is included, even if e.g. vectorization is + // explicitly disabled (see also issue #2395). + // Note that FP16C intrinsics for gcc and clang are included by immintrin.h, + // as opposed to emmintrin.h as suggested by Intel: // https://software.intel.com/sites/landingpage/IntrinsicsGuide/#othertechs=FP16C&expand=1711 #include #endif