From 7b10795e3939518f1be24f5799e01dbaa1e0c04e Mon Sep 17 00:00:00 2001 From: Chip Kerchner Date: Thu, 17 Mar 2022 22:35:27 +0000 Subject: [PATCH] Change EIGEN_ALTIVEC_ENABLE_MMA_DYNAMIC_DISPATCH and EIGEN_ALTIVEC_DISABLE_MMA flags to be like TensorFlow's... --- Eigen/src/Core/arch/AltiVec/MatrixProduct.h | 11 +++++++++-- Eigen/src/Core/arch/AltiVec/MatrixVectorProduct.h | 2 +- doc/PreprocessorDirectives.dox | 7 +++++-- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Eigen/src/Core/arch/AltiVec/MatrixProduct.h b/Eigen/src/Core/arch/AltiVec/MatrixProduct.h index dd233b3cb..312970771 100644 --- a/Eigen/src/Core/arch/AltiVec/MatrixProduct.h +++ b/Eigen/src/Core/arch/AltiVec/MatrixProduct.h @@ -17,8 +17,12 @@ #include "MatrixProductCommon.h" +#if !defined(EIGEN_ALTIVEC_DISABLE_MMA) +#define EIGEN_ALTIVEC_DISABLE_MMA 0 +#endif + // Check for MMA builtin support. -#if !defined(EIGEN_ALTIVEC_DISABLE_MMA) && defined(__has_builtin) +#if !EIGEN_ALTIVEC_DISABLE_MMA && defined(__has_builtin) #if __has_builtin(__builtin_mma_assemble_acc) #define EIGEN_ALTIVEC_MMA_SUPPORT #endif @@ -27,9 +31,12 @@ // Check if and how we should actually use MMA if supported. #if defined(EIGEN_ALTIVEC_MMA_SUPPORT) +#if !defined(EIGEN_ALTIVEC_ENABLE_MMA_DYNAMIC_DISPATCH) +#define EIGEN_ALTIVEC_ENABLE_MMA_DYNAMIC_DISPATCH 0 +#endif // Check if we want to enable dynamic dispatch. Not supported by LLVM. -#if defined(EIGEN_ALTIVEC_ENABLE_MMA_DYNAMIC_DISPATCH) && !EIGEN_COMP_LLVM +#if EIGEN_ALTIVEC_ENABLE_MMA_DYNAMIC_DISPATCH && !EIGEN_COMP_LLVM #define EIGEN_ALTIVEC_MMA_DYNAMIC_DISPATCH 1 // Otherwise, use MMA by default if available. #elif defined(__MMA__) diff --git a/Eigen/src/Core/arch/AltiVec/MatrixVectorProduct.h b/Eigen/src/Core/arch/AltiVec/MatrixVectorProduct.h index d40ae534f..65b78b134 100644 --- a/Eigen/src/Core/arch/AltiVec/MatrixVectorProduct.h +++ b/Eigen/src/Core/arch/AltiVec/MatrixVectorProduct.h @@ -12,7 +12,7 @@ #include "../../InternalHeaderCheck.h" -#if defined(__MMA__) && !defined(EIGEN_ALTIVEC_DISABLE_MMA) +#if defined(__MMA__) && !EIGEN_ALTIVEC_DISABLE_MMA #if EIGEN_COMP_LLVM || (__GNUC__ > 10 || __GNUC_MINOR__ >= 3) #define USE_GEMV_MMA #endif diff --git a/doc/PreprocessorDirectives.dox b/doc/PreprocessorDirectives.dox index 4d232878e..a0e77b58f 100644 --- a/doc/PreprocessorDirectives.dox +++ b/doc/PreprocessorDirectives.dox @@ -118,8 +118,11 @@ run time. However, these assertions do cost time and can thus be turned off. - \b \c EIGEN_DEFAULT_L2_CACHE_SIZE - Sets the default L2 cache size that is used in Eigen's GEBP kernel when the correct cache size cannot be determined at runtime. - \b \c EIGEN_DEFAULT_L3_CACHE_SIZE - Sets the default L3 cache size that is used in Eigen's GEBP kernel when the correct cache size cannot be determined at runtime. - - \c EIGEN_DONT_ALIGN - Deprecated, it is a synonym for \c EIGEN_MAX_ALIGN_BYTES=0. It disables alignment completely. %Eigen will not try to align its objects and does not expect that any objects passed to it are aligned. This will turn off vectorization if \b \c EIGEN_UNALIGNED_VECTORIZE=1. Not defined by default. - - \c EIGEN_DONT_ALIGN_STATICALLY - Deprecated, it is a synonym for \c EIGEN_MAX_STATIC_ALIGN_BYTES=0. It disables alignment of arrays on the stack. Not defined by default, unless \c EIGEN_DONT_ALIGN is defined. + - \b \c EIGEN_DONT_ALIGN - Deprecated, it is a synonym for \c EIGEN_MAX_ALIGN_BYTES=0. It disables alignment completely. %Eigen will not try to align its objects and does not expect that any objects passed to it are aligned. This will turn off vectorization if \b \c EIGEN_UNALIGNED_VECTORIZE=1. Not defined by default. + - \b \c EIGEN_DONT_ALIGN_STATICALLY - Deprecated, it is a synonym for \c EIGEN_MAX_STATIC_ALIGN_BYTES=0. It disables alignment of arrays on the stack. Not defined by default, unless \c EIGEN_DONT_ALIGN is defined. + - \b \c EIGEN_ALTIVEC_ENABLE_MMA_DYNAMIC_DISPATCH - Controls whether to use Eigen's dynamic dispatching for Altivec MMA or not. + - \b \c EIGEN_ALTIVEC_DISABLE_MMA - Overrides the usage of Altivec MMA instructions. + - \b \c EIGEN_ALTIVEC_USE_CUSTOM_PACK - Controls whether to use Eigen's custom packing for Altivec or not. \section TopicPreprocessorDirectivesPlugins Plugins