From e81f6ba042ce7a8f56fea2d34b2ef4663753ec95 Mon Sep 17 00:00:00 2001 From: Abseil Team Date: Wed, 17 Aug 2022 10:24:45 -0700 Subject: [PATCH] Don't try to enable use of ARM NEON intrinsics when compiling in CUDA device mode. They are not available in that configuration, even if the host supports them. PiperOrigin-RevId: 468232254 Change-Id: I1cd26eda2962778b62135a31f477928c3bde1124 --- absl/base/config.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/absl/base/config.h b/absl/base/config.h index 9626548c..95131068 100644 --- a/absl/base/config.h +++ b/absl/base/config.h @@ -915,9 +915,14 @@ static_assert(ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' || // ABSL_INTERNAL_HAVE_ARM_NEON is used for compile-time detection of NEON (ARM // SIMD). +// +// If __CUDA_ARCH__ is defined, then we are compiling CUDA code in device mode. +// In device mode, NEON intrinsics are not available, regardless of host +// platform. +// https://llvm.org/docs/CompileCudaWithLLVM.html#detecting-clang-vs-nvcc-from-code #ifdef ABSL_INTERNAL_HAVE_ARM_NEON #error ABSL_INTERNAL_HAVE_ARM_NEON cannot be directly set -#elif defined(__ARM_NEON) +#elif defined(__ARM_NEON) && !defined(__CUDA_ARCH__) #define ABSL_INTERNAL_HAVE_ARM_NEON 1 #endif