Update Eigen to commit:4c38131a16803130b66266a912029504f2cf23cd CHANGELOG ========= 4c38131a1 - Fix android hardware_destructive_inference_size issue. PiperOrigin-RevId: 724069969 Change-Id: I0e8b46df0be1c65d24129440d7e8ae5c68796d6d
diff --git a/Eigen/src/Core/util/ConfigureVectorization.h b/Eigen/src/Core/util/ConfigureVectorization.h index 62297a2..5d3f1cf 100644 --- a/Eigen/src/Core/util/ConfigureVectorization.h +++ b/Eigen/src/Core/util/ConfigureVectorization.h
@@ -39,8 +39,11 @@ #endif // Align to the boundary that avoids false sharing. -// https://en.cppreference.com/w/cpp/thread/hardware_destructive_interference_size -#if defined(__cpp_lib_hardware_interference_size) && __cpp_lib_hardware_interference_size >= 201603 +// https://en.cppreference.com/w/cpp/thread/hardware_destructive_interference_size +// There is a bug in android NDK < r26 where the macro is defined but std::hardware_destructive_interference_size +// still does not exist. +#if defined(__cpp_lib_hardware_interference_size) && __cpp_lib_hardware_interference_size >= 201603 && \ + (!EIGEN_OS_ANDROID || __NDK_MAJOR__ + 0 >= 26) #include <new> #define EIGEN_ALIGN_TO_AVOID_FALSE_SHARING EIGEN_ALIGN_TO_BOUNDARY(std::hardware_destructive_interference_size) #else
diff --git a/Eigen/src/Core/util/Macros.h b/Eigen/src/Core/util/Macros.h index f3a1d9c..7347dbb 100644 --- a/Eigen/src/Core/util/Macros.h +++ b/Eigen/src/Core/util/Macros.h
@@ -430,6 +430,16 @@ // note: ANDROID is defined when using ndk_build, __ANDROID__ is defined when using a standalone toolchain. #if defined(__ANDROID__) || defined(ANDROID) #define EIGEN_OS_ANDROID 1 + +// Since NDK r16, `__NDK_MAJOR__` and `__NDK_MINOR__` are defined in +// <android/ndk-version.h>. For NDK < r16, users should define these macros, +// e.g. `-D__NDK_MAJOR__=11 -D__NKD_MINOR__=0` for NDK r11. +#if defined __has_include +#if __has_include(<android/ndk-version.h>) +#include <android/ndk-version.h> +#endif +#endif + #else #define EIGEN_OS_ANDROID 0 #endif
diff --git a/Eigen/src/ThreadPool/ThreadLocal.h b/Eigen/src/ThreadPool/ThreadLocal.h index 71df401..aa0bd10 100644 --- a/Eigen/src/ThreadPool/ThreadLocal.h +++ b/Eigen/src/ThreadPool/ThreadLocal.h
@@ -43,12 +43,7 @@ // This is primarily because of linker problems and toolchain misconfiguration: // TLS isn't supported until NDK r12b per // https://developer.android.com/ndk/downloads/revision_history.html -// Since NDK r16, `__NDK_MAJOR__` and `__NDK_MINOR__` are defined in -// <android/ndk-version.h>. For NDK < r16, users should define these macros, -// e.g. `-D__NDK_MAJOR__=11 -D__NKD_MINOR__=0` for NDK r11. -#if __has_include(<android/ndk-version.h>) -#include <android/ndk-version.h> -#endif // __has_include(<android/ndk-version.h>) + #if defined(__ANDROID__) && defined(__clang__) && defined(__NDK_MAJOR__) && defined(__NDK_MINOR__) && \ ((__NDK_MAJOR__ < 12) || ((__NDK_MAJOR__ == 12) && (__NDK_MINOR__ < 1))) #undef EIGEN_THREAD_LOCAL