diff options
author | 2022-08-17 10:24:45 -0700 | |
---|---|---|
committer | 2022-08-17 10:25:21 -0700 | |
commit | e81f6ba042ce7a8f56fea2d34b2ef4663753ec95 (patch) | |
tree | 657cf2e5fa28b2dbda6ee0a271e9c393412b19ab | |
parent | fcfc7a6d15eab5aff86d7b90c9e38fa386a103fa (diff) |
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
-rw-r--r-- | absl/base/config.h | 7 |
1 files changed, 6 insertions, 1 deletions
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 |