From: Martin Kronbichler Date: Sat, 21 Mar 2020 16:26:52 +0000 (+0100) Subject: Introduce DEAL_II_VECTORIZATION_WIDTH_IN_BITS X-Git-Tag: v9.2.0-rc1~358^2~4 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=473ed334a375696873210f66d1f06d7a6ce3d472;p=dealii.git Introduce DEAL_II_VECTORIZATION_WIDTH_IN_BITS --- diff --git a/cmake/checks/check_01_cpu_features.cmake b/cmake/checks/check_01_cpu_features.cmake index 6ed6d6b64c..8623ff3d15 100644 --- a/cmake/checks/check_01_cpu_features.cmake +++ b/cmake/checks/check_01_cpu_features.cmake @@ -29,7 +29,7 @@ # DEAL_II_HAVE_AVX512 *) # DEAL_II_HAVE_ALTIVEC *) # DEAL_II_HAVE_OPENMP_SIMD *) -# DEAL_II_COMPILER_VECTORIZATION_LEVEL +# DEAL_II_VECTORIZATION_WIDTH_IN_BITS # DEAL_II_OPENMP_SIMD_PRAGMA # # *) @@ -277,17 +277,17 @@ ENDIF() # IF DEAL_II_ALLOW_PLATFORM_INTROSPECTION # IF(DEAL_II_HAVE_AVX512) - SET(DEAL_II_COMPILER_VECTORIZATION_LEVEL 3) + SET(DEAL_II_VECTORIZATION_WIDTH_IN_BITS 512) ELSEIF(DEAL_II_HAVE_AVX) - SET(DEAL_II_COMPILER_VECTORIZATION_LEVEL 2) + SET(DEAL_II_VECTORIZATION_WIDTH_IN_BITS 256) ELSEIF(DEAL_II_HAVE_SSE2) - SET(DEAL_II_COMPILER_VECTORIZATION_LEVEL 1) + SET(DEAL_II_VECTORIZATION_WIDTH_IN_BITS 128) ELSE() - SET(DEAL_II_COMPILER_VECTORIZATION_LEVEL 0) + SET(DEAL_II_VECTORIZATION_WIDTH_IN_BITS 0) ENDIF() IF(DEAL_II_HAVE_ALTIVEC) - SET(DEAL_II_COMPILER_VECTORIZATION_LEVEL 1) + SET(DEAL_II_VECTORIZATION_WIDTH_IN_BITS 128) ENDIF() # @@ -297,7 +297,7 @@ ENDIF() # IF(DEAL_II_WITH_CUDA) - SET(DEAL_II_COMPILER_VECTORIZATION_LEVEL 0) + SET(DEAL_II_VECTORIZATION_WIDTH_IN_BITS 0) ENDIF() # diff --git a/cmake/configure/configure_vectorization.cmake b/cmake/configure/configure_vectorization.cmake index aa17a02dba..b0c6a78cc4 100644 --- a/cmake/configure/configure_vectorization.cmake +++ b/cmake/configure/configure_vectorization.cmake @@ -21,19 +21,19 @@ SET(DEAL_II_EXPAND_REAL_SCALARS_VECTORIZED "VectorizedArray" "VectorizedArray") SET(DEAL_II_EXPAND_FLOAT_VECTORIZED "VectorizedArray") -IF(${DEAL_II_COMPILER_VECTORIZATION_LEVEL} GREATER 0) +IF(${DEAL_II_VECTORIZATION_WIDTH_IN_BITS} GREATER 0) SET(DEAL_II_EXPAND_REAL_SCALARS_VECTORIZED "${DEAL_II_EXPAND_REAL_SCALARS_VECTORIZED}" "VectorizedArray" "VectorizedArray") SET(DEAL_II_EXPAND_FLOAT_VECTORIZED "${DEAL_II_EXPAND_FLOAT_VECTORIZED}" "VectorizedArray") ENDIF() -IF((${DEAL_II_COMPILER_VECTORIZATION_LEVEL} GREATER 1) AND ( DEAL_II_HAVE_AVX OR DEAL_II_HAVE_ALTIVEC)) +IF((${DEAL_II_VECTORIZATION_WIDTH_IN_BITS} GREATER 128)) SET(DEAL_II_EXPAND_REAL_SCALARS_VECTORIZED "${DEAL_II_EXPAND_REAL_SCALARS_VECTORIZED}" "VectorizedArray" "VectorizedArray") SET(DEAL_II_EXPAND_FLOAT_VECTORIZED "${DEAL_II_EXPAND_FLOAT_VECTORIZED}" "VectorizedArray") ENDIF() -IF((${DEAL_II_COMPILER_VECTORIZATION_LEVEL} GREATER 2) AND DEAL_II_HAVE_AVX512) +IF((${DEAL_II_VECTORIZATION_WIDTH_IN_BITS} GREATER 256)) SET(DEAL_II_EXPAND_REAL_SCALARS_VECTORIZED "${DEAL_II_EXPAND_REAL_SCALARS_VECTORIZED}" "VectorizedArray" "VectorizedArray") SET(DEAL_II_EXPAND_FLOAT_VECTORIZED "${DEAL_II_EXPAND_FLOAT_VECTORIZED}" "VectorizedArray") diff --git a/cmake/setup_write_config.cmake b/cmake/setup_write_config.cmake index a208022af9..9e71ac6d38 100644 --- a/cmake/setup_write_config.cmake +++ b/cmake/setup_write_config.cmake @@ -156,7 +156,7 @@ ENDIF() IF(CMAKE_BUILD_TYPE MATCHES "Debug") _detailed("# DEAL_II_LIBRARIES_DEBUG: ${BASE_LIBRARIES_DEBUG}\n") ENDIF() -_detailed("# DEAL_II_COMPILER_VECTORIZATION_LEVEL: ${DEAL_II_COMPILER_VECTORIZATION_LEVEL}\n") +_detailed("# DEAL_II_VECTORIZATION_WIDTH_IN_BITS: ${DEAL_II_VECTORIZATION_WIDTH_IN_BITS}\n") _detailed("#\n") diff --git a/examples/step-37/step-37.cc b/examples/step-37/step-37.cc index 0513930861..559ef80ad4 100644 --- a/examples/step-37/step-37.cc +++ b/examples/step-37/step-37.cc @@ -1157,8 +1157,7 @@ namespace Step37 pcout << "Vectorization over " << n_vect_doubles << " doubles = " << n_vect_bits << " bits (" - << Utilities::System::get_current_vectorization_level() - << "), VECTORIZATION_LEVEL=" << DEAL_II_COMPILER_VECTORIZATION_LEVEL + << Utilities::System::get_current_vectorization_level() << ")" << std::endl; } diff --git a/examples/step-48/step-48.cc b/examples/step-48/step-48.cc index 8c79feb1e5..b511fef931 100644 --- a/examples/step-48/step-48.cc +++ b/examples/step-48/step-48.cc @@ -533,8 +533,7 @@ namespace Step48 const unsigned int n_vect_bits = 8 * sizeof(double) * n_vect_doubles; pcout << "Vectorization over " << n_vect_doubles << " doubles = " << n_vect_bits << " bits (" - << Utilities::System::get_current_vectorization_level() - << "), VECTORIZATION_LEVEL=" << DEAL_II_COMPILER_VECTORIZATION_LEVEL + << Utilities::System::get_current_vectorization_level() << ")" << std::endl << std::endl; } diff --git a/include/deal.II/base/config.h.in b/include/deal.II/base/config.h.in index b98b6a3f41..83c967b317 100644 --- a/include/deal.II/base/config.h.in +++ b/include/deal.II/base/config.h.in @@ -116,7 +116,40 @@ */ #cmakedefine DEAL_II_WORDS_BIGENDIAN -#define DEAL_II_COMPILER_VECTORIZATION_LEVEL @DEAL_II_COMPILER_VECTORIZATION_LEVEL@ + +/* + * This sets the largest number of vectorization bits detected for the given + * compiler flags and hardware (e.g. 256 for AVX on x86-64 architectures) for + * use in deal.II's instrinsics-based VectorizedArray class. + */ +#define DEAL_II_VECTORIZATION_WIDTH_IN_BITS @DEAL_II_VECTORIZATION_WIDTH_IN_BITS@ + +/* + * Backward compatibility setting + */ +#ifdef DEAL_II_COMPILER_HAS_DIAGNOSTIC_PRAGMA +# if DEAL_II_VECTORIZATION_WIDTH_IN_BITS == 512 +# define DEAL_II_COMPILER_VECTORIZATION_LEVEL _Pragma ("GCC warning \"The DEAL_II_COMPILER_VECTORIZATION_LEVEL macro is deprecated\"") 3 +# elif DEAL_II_VECTORIZATION_WIDTH_IN_BITS == 256 +# define DEAL_II_COMPILER_VECTORIZATION_LEVEL _Pragma ("GCC warning \"The DEAL_II_COMPILER_VECTORIZATION_LEVEL macro is deprecated\"") 2 +# elif DEAL_II_VECTORIZATION_WIDTH_IN_BITS == 128 +# define DEAL_II_COMPILER_VECTORIZATION_LEVEL _Pragma ("GCC warning \"The DEAL_II_COMPILER_VECTORIZATION_LEVEL macro is deprecated\"") 1 +# else +# define DEAL_II_COMPILER_VECTORIZATION_LEVEL _Pragma ("GCC warning \"The DEAL_II_COMPILER_VECTORIZATION_LEVEL macro is deprecated\"")\ + 0 +# endif +#else +# if DEAL_II_VECTORIZATION_WIDTH_IN_BITS == 512 +# define DEAL_II_COMPILER_VECTORIZATION_LEVEL 3 +# elif DEAL_II_VECTORIZATION_WIDTH_IN_BITS == 256 +# define DEAL_II_COMPILER_VECTORIZATION_LEVEL 2 +# elif DEAL_II_VECTORIZATION_WIDTH_IN_BITS == 128 +# define DEAL_II_COMPILER_VECTORIZATION_LEVEL 1 +# else +# define DEAL_II_COMPILER_VECTORIZATION_LEVEL 0 +# endif +#endif + #define DEAL_II_OPENMP_SIMD_PRAGMA @DEAL_II_OPENMP_SIMD_PRAGMA@ diff --git a/include/deal.II/base/numbers.h b/include/deal.II/base/numbers.h index 6f83910403..f86bf25fbb 100644 --- a/include/deal.II/base/numbers.h +++ b/include/deal.II/base/numbers.h @@ -81,13 +81,11 @@ namespace internal * Maximal vector length of VectorizedArray for double. */ constexpr static unsigned int max_width = -#if DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 1 && defined(__ALTIVEC__) - 2; -#elif DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 3 && defined(__AVX512F__) +#if DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 512 8; -#elif DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 2 && defined(__AVX__) +#elif DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 256 4; -#elif DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 1 && defined(__SSE2__) +#elif DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 128 2; #else 1; @@ -109,13 +107,13 @@ namespace internal * Maximal vector length of VectorizedArray for float. */ constexpr static unsigned int max_width = -#if DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 1 && defined(__ALTIVEC__) +#if DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 128 && defined(__ALTIVEC__) 4; -#elif DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 3 && defined(__AVX512F__) +#elif DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 512 && defined(__AVX512F__) 16; -#elif DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 2 && defined(__AVX__) +#elif DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 256 && defined(__AVX__) 8; -#elif DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 1 && defined(__SSE2__) +#elif DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 128 && defined(__SSE2__) 4; #else 1; diff --git a/include/deal.II/base/utilities.h b/include/deal.II/base/utilities.h index 0282ce38ae..3a16df7d51 100644 --- a/include/deal.II/base/utilities.h +++ b/include/deal.II/base/utilities.h @@ -812,8 +812,8 @@ namespace Utilities get_cpu_load(); /** - * Return the current level of vectorization as described by - * DEAL_II_COMPILER_VECTORIZATION_LEVEL in vectorization.h as a string. The + * Return the instruction set extension for vectorization as described by + * DEAL_II_VECTORIZATION_WIDTH_IN_BITS in vectorization.h as a string. The * list of possible return values is: * * @@ -829,7 +829,7 @@ namespace Utilities * * * - * + * * * * diff --git a/include/deal.II/base/vectorization.h b/include/deal.II/base/vectorization.h index 32ffb2996d..5a169c4f68 100644 --- a/include/deal.II/base/vectorization.h +++ b/include/deal.II/base/vectorization.h @@ -26,29 +26,38 @@ #include // Note: -// The flag DEAL_II_COMPILER_VECTORIZATION_LEVEL is essentially constructed +// The flag DEAL_II_VECTORIZATION_WIDTH_IN_BITS is essentially constructed // according to the following scheme (on x86-based architectures) // #ifdef __AVX512F__ -// #define DEAL_II_COMPILER_VECTORIZATION_LEVEL 3 +// #define DEAL_II_VECTORIZATION_WIDTH_IN_BITS 512 // #elif defined (__AVX__) -// #define DEAL_II_COMPILER_VECTORIZATION_LEVEL 2 +// #define DEAL_II_VECTORIZATION_WIDTH_IN_BITS 256 // #elif defined (__SSE2__) -// #define DEAL_II_COMPILER_VECTORIZATION_LEVEL 1 +// #define DEAL_II_VECTORIZATION_WIDTH_IN_BITS 128 // #else -// #define DEAL_II_COMPILER_VECTORIZATION_LEVEL 0 +// #define DEAL_II_VECTORIZATION_WIDTH_IN_BITS 0 // #endif -// In addition to checking the flags __AVX__ and __SSE2__, a CMake test, -// 'check_01_cpu_features.cmake', ensures that these feature are not only +// In addition to checking the flags __AVX512F__, __AVX__ and __SSE2__, a CMake +// test, 'check_01_cpu_features.cmake', ensures that these feature are not only // present in the compilation unit but also working properly. -#if DEAL_II_COMPILER_VECTORIZATION_LEVEL > 0 - -# if DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 2 && defined(__SSE2__) && \ +#if DEAL_II_VECTORIZATION_WIDTH_IN_BITS > 0 + +// These error messages try to detect the case that deal.II was compiled with +// a wider instruction set extension as the current compilation unit, for +// example because deal.II was compiled with AVX, but a user project does not +// add -march=native or similar flags, making it fall to SSE2. This leads to +// very strange errors as the size of data structures differs between the +// compiled deal.II code sitting in libdeal_II.so and the user code if not +// detected. The __SSE2__ flag ensures that we are actually on a x86-64 +// architecture as we do not want to emit the error on another architecture +// with 256 bit vectors. +# if DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 256 && defined(__SSE2__) && \ !defined(__AVX__) # error \ "Mismatch in vectorization capabilities: AVX was detected during configuration of deal.II and switched on, but it is apparently not available for the file you are trying to compile at the moment. Check compilation flags controlling the instruction set, such as -march=native." # endif -# if DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 3 && defined(__SSE2__) && \ +# if DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 512 && defined(__SSE2__) && \ !defined(__AVX512F__) # error \ "Mismatch in vectorization capabilities: AVX-512F was detected during configuration of deal.II and switched on, but it is apparently not available for the file you are trying to compile at the moment. Check compilation flags controlling the instruction set, such as -march=native." @@ -925,7 +934,7 @@ vectorized_transpose_and_store(const bool add_into, // for safety, also check that __AVX512F__ is defined in case the user manually // set some conflicting compile flags which prevent compilation -# if DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 3 && defined(__AVX512F__) +# if DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 512 && defined(__AVX512F__) /** * Specialization of VectorizedArray class for double and AVX-512. @@ -2125,7 +2134,7 @@ vectorized_transpose_and_store(const bool add_into, # endif -# if DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 2 && defined(__AVX__) +# if DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 256 && defined(__AVX__) /** * Specialization of VectorizedArray class for double and AVX. @@ -3181,7 +3190,7 @@ vectorized_transpose_and_store(const bool add_into, # endif -# if DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 1 && defined(__SSE2__) +# if DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 128 && defined(__SSE2__) /** * Specialization for double and SSE2. @@ -4101,9 +4110,9 @@ vectorized_transpose_and_store(const bool add_into, -# endif // if DEAL_II_COMPILER_VECTORIZATION_LEVEL > 0 && defined(__SSE2__) +# endif // if DEAL_II_VECTORIZATION_WIDTH_IN_BITS > 0 && defined(__SSE2__) -# if DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 1 && defined(__ALTIVEC__) && \ +# if DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 128 && defined(__ALTIVEC__) && \ defined(__VSX__) template <> @@ -4963,7 +4972,7 @@ operator<<(std::ostream &out, const VectorizedArray &p) */ enum class SIMDComparison : int { -#if DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 2 && defined(__AVX__) +#if DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 256 && defined(__AVX__) equal = _CMP_EQ_OQ, not_equal = _CMP_NEQ_OQ, less_than = _CMP_LT_OQ, @@ -5100,7 +5109,7 @@ compare_and_apply_mask(const VectorizedArray &left, //@} #ifndef DOXYGEN -# if DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 3 && defined(__AVX512F__) +# if DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 512 && defined(__AVX512F__) template DEAL_II_ALWAYS_INLINE inline VectorizedArray @@ -5134,7 +5143,7 @@ compare_and_apply_mask(const VectorizedArray &left, # endif -# if DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 2 && defined(__AVX__) +# if DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 256 && defined(__AVX__) template DEAL_II_ALWAYS_INLINE inline VectorizedArray @@ -5171,7 +5180,7 @@ compare_and_apply_mask(const VectorizedArray &left, # endif -# if DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 1 && defined(__SSE2__) +# if DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 128 && defined(__SSE2__) template DEAL_II_ALWAYS_INLINE inline VectorizedArray diff --git a/include/deal.II/matrix_free/evaluation_kernels.h b/include/deal.II/matrix_free/evaluation_kernels.h index 086c35440b..6dff37196e 100644 --- a/include/deal.II/matrix_free/evaluation_kernels.h +++ b/include/deal.II/matrix_free/evaluation_kernels.h @@ -1827,7 +1827,7 @@ namespace internal const unsigned int * indices, Number * dst_ptr) { -#if DEAL_II_COMPILER_VECTORIZATION_LEVEL < 3 +#if DEAL_II_VECTORIZATION_WIDTH_IN_BITS < 512 for (unsigned int v = 0; v < width; ++v) dst_ptr[indices[v]] += src[v]; #else diff --git a/include/deal.II/matrix_free/vector_access_internal.h b/include/deal.II/matrix_free/vector_access_internal.h index 46bd9b268c..4addc2e23e 100644 --- a/include/deal.II/matrix_free/vector_access_internal.h +++ b/include/deal.II/matrix_free/vector_access_internal.h @@ -460,7 +460,7 @@ namespace internal VectorizedArrayType &res, std::integral_constant) const { -#if DEAL_II_COMPILER_VECTORIZATION_LEVEL < 3 +#if DEAL_II_VECTORIZATION_WIDTH_IN_BITS < 512 for (unsigned int v = 0; v < VectorizedArrayType::size(); ++v) vector_access(vec, indices[v] + constant_offset) += res[v]; #else diff --git a/source/base/utilities.cc b/source/base/utilities.cc index 7f918ad5e4..d05aba28ce 100644 --- a/source/base/utilities.cc +++ b/source/base/utilities.cc @@ -899,24 +899,24 @@ namespace Utilities const std::string get_current_vectorization_level() { - switch (DEAL_II_COMPILER_VECTORIZATION_LEVEL) + switch (DEAL_II_VECTORIZATION_WIDTH_IN_BITS) { case 0: return "disabled"; - case 1: + case 128: #ifdef __ALTIVEC__ return "AltiVec"; #else return "SSE2"; #endif - case 2: + case 256: return "AVX"; - case 3: + case 512: return "AVX512"; default: AssertThrow(false, ExcInternalError( - "Invalid DEAL_II_COMPILER_VECTORIZATION_LEVEL.")); + "Invalid DEAL_II_VECTORIZATION_WIDTH_IN_BITS.")); return "ERROR"; } } diff --git a/source/base/vectorization.cc b/source/base/vectorization.cc index f05ecb7b3a..b5a0633c44 100644 --- a/source/base/vectorization.cc +++ b/source/base/vectorization.cc @@ -30,31 +30,25 @@ static_assert(std::is_standard_layout>::value && std::is_trivial>::value, "VectorizedArray must be a POD type"); -#if DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 1 && !defined(DEAL_II_MSVC) -# if DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 3 && defined(__AVX512F__) +// For the specializations of VectorizedArray, we need to instantiate the +// static constexpr variable for some compilers. On the other hand, MSCV wants +// us explicitly to not do so, otherwise we get: "error C2908: explicit +// specialization 'const unsigned int +// dealii::VectorizedArray::n_array_elements' has already been +// instantiated". +#if DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 128 && !defined(DEAL_II_MSVC) +# if DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 512 const unsigned int VectorizedArray::n_array_elements; -# endif - -# if DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 2 && defined(__AVX__) -const unsigned int VectorizedArray::n_array_elements; -# endif - -# if (DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 1 && defined(__SSE2__)) || \ - (DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 1 && defined(__ALTIVEC__)) -const unsigned int VectorizedArray::n_array_elements; -# endif - - -# if DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 3 && defined(__AVX512F__) const unsigned int VectorizedArray::n_array_elements; # endif -# if DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 2 && defined(__AVX__) +# if DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 256 +const unsigned int VectorizedArray::n_array_elements; const unsigned int VectorizedArray::n_array_elements; # endif -# if (DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 1 && defined(__SSE2__)) || \ - (DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 1 && defined(__ALTIVEC__)) +# if DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 128 +const unsigned int VectorizedArray::n_array_elements; const unsigned int VectorizedArray::n_array_elements; # endif #endif diff --git a/source/matrix_free/mapping_info.cc b/source/matrix_free/mapping_info.cc index 0e73c2e10e..83d8b197e9 100644 --- a/source/matrix_free/mapping_info.cc +++ b/source/matrix_free/mapping_info.cc @@ -36,22 +36,22 @@ template struct internal::MatrixFreeFunctions:: template struct internal::MatrixFreeFunctions:: FPArrayComparator>; -# if (DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 1 && defined(__SSE2__)) || \ - (DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 1 && defined(__ALTIVEC__)) +# if (DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 128 && defined(__SSE2__)) || \ + (DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 128 && defined(__ALTIVEC__)) template struct internal::MatrixFreeFunctions:: FPArrayComparator>; template struct internal::MatrixFreeFunctions:: FPArrayComparator>; # endif -# if DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 2 && defined(__AVX__) +# if DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 256 && defined(__AVX__) template struct internal::MatrixFreeFunctions:: FPArrayComparator>; template struct internal::MatrixFreeFunctions:: FPArrayComparator>; # endif -# if DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 3 && defined(__AVX512F__) +# if DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 512 && defined(__AVX512F__) template struct internal::MatrixFreeFunctions:: FPArrayComparator>; template struct internal::MatrixFreeFunctions:: diff --git a/tests/base/utilities_02b.cc b/tests/base/utilities_02b.cc index 280b48d3e8..411ff6267c 100644 --- a/tests/base/utilities_02b.cc +++ b/tests/base/utilities_02b.cc @@ -47,17 +47,17 @@ main() { initlog(); -#if DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 3 && defined(__AVX512F__) +#if DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 512 do_test(VectorizedArray(2.0)); do_test(VectorizedArray(2.0)); #endif -#if DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 2 && defined(__AVX__) +#if DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 256 do_test(VectorizedArray(2.0)); do_test(VectorizedArray(2.0)); #endif -#if DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 1 && defined(__SSE2__) +#if DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 128 do_test(VectorizedArray(2.0)); do_test(VectorizedArray(2.0)); #endif diff --git a/tests/base/vectorization_10.cc b/tests/base/vectorization_10.cc index ad1beea6f3..cebcdf6b7a 100644 --- a/tests/base/vectorization_10.cc +++ b/tests/base/vectorization_10.cc @@ -117,15 +117,15 @@ struct Tester static void test() { -#if DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 3 && defined(__AVX512F__) +#if DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 512 do_test(); #endif -#if DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 2 && defined(__AVX__) +#if DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 256 do_test(); #endif -#if DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 1 && defined(__SSE2__) +#if DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 128 do_test(); #endif @@ -139,15 +139,15 @@ struct Tester static void test() { -#if DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 3 && defined(__AVX512F__) +#if DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 512 do_test(); #endif -#if DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 2 && defined(__AVX__) +#if DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 256 do_test(); #endif -#if DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 1 && defined(__SSE2__) +#if DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 128 do_test(); #endif diff --git a/tests/base/vectorization_11.cc b/tests/base/vectorization_11.cc index 3a26982d36..9912641b88 100644 --- a/tests/base/vectorization_11.cc +++ b/tests/base/vectorization_11.cc @@ -54,17 +54,17 @@ struct Tester do_test(make_vectorized_array(2.0), 2.0); do_test(VectorizedArray(2.0), 2.0); -#if DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 3 && defined(__AVX512F__) +#if DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 512 do_test(make_vectorized_array>(2.0), 2.0); do_test(VectorizedArray(2.0), 2.0); #endif -#if DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 2 && defined(__AVX__) +#if DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 256 do_test(make_vectorized_array>(2.0), 2.0); do_test(VectorizedArray(2.0), 2.0); #endif -#if DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 1 && defined(__SSE2__) +#if DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 128 do_test(make_vectorized_array>(2.0), 2.0); do_test(VectorizedArray(2.0), 2.0); #endif @@ -83,17 +83,17 @@ struct Tester do_test(make_vectorized_array(2.0), 2.0); do_test(VectorizedArray(2.0), 2.0); -#if DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 3 && defined(__AVX512F__) +#if DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 512 do_test(make_vectorized_array>(2.0), 2.0); do_test(VectorizedArray(2.0), 2.0); #endif -#if DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 2 && defined(__AVX__) +#if DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 256 do_test(make_vectorized_array>(2.0), 2.0); do_test(VectorizedArray(2.0), 2.0); #endif -#if DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 1 && defined(__SSE2__) +#if DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 128 do_test(make_vectorized_array>(2.0), 2.0); do_test(VectorizedArray(2.0), 2.0); #endif diff --git a/tests/base/vectorization_13.cc b/tests/base/vectorization_13.cc index 59ffcfe743..724c6c4d9a 100644 --- a/tests/base/vectorization_13.cc +++ b/tests/base/vectorization_13.cc @@ -42,17 +42,17 @@ main() { initlog(); -#if DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 3 && defined(__AVX512F__) +#if DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 512 do_test(VectorizedArray(2.0), 3.0); do_test(VectorizedArray(2.0), 3.0); #endif -#if DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 2 && defined(__AVX__) +#if DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 256 do_test(VectorizedArray(2.0), 3.0); do_test(VectorizedArray(2.0), 3.0); #endif -#if DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 1 && defined(__SSE2__) +#if DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 128 do_test(VectorizedArray(2.0), 3.0); do_test(VectorizedArray(2.0), 3.0); #endif diff --git a/tests/base/vectorization_14.cc b/tests/base/vectorization_14.cc index 3ff642e466..949f523ab8 100644 --- a/tests/base/vectorization_14.cc +++ b/tests/base/vectorization_14.cc @@ -75,17 +75,17 @@ main() { initlog(); -#if DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 3 && defined(__AVX512F__) +#if DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 512 do_test>(); do_test>(); #endif -#if DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 2 && defined(__AVX__) +#if DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 256 do_test>(); do_test>(); #endif -#if DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 1 && defined(__SSE2__) +#if DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 128 do_test>(); do_test>(); #endif diff --git a/tests/base/vectorization_15.cc b/tests/base/vectorization_15.cc index 41da2ff1a0..d19ff95b00 100644 --- a/tests/base/vectorization_15.cc +++ b/tests/base/vectorization_15.cc @@ -129,15 +129,15 @@ struct Tester static void test() { -#if DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 3 && defined(__AVX512F__) +#if DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 512 do_test(); #endif -#if DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 2 && defined(__AVX__) +#if DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 256 do_test(); #endif -#if DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 1 && defined(__SSE2__) +#if DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 128 do_test(); #endif @@ -151,15 +151,15 @@ struct Tester static void test() { -#if DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 3 && defined(__AVX512F__) +#if DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 512 do_test(); #endif -#if DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 2 && defined(__AVX__) +#if DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 256 do_test(); #endif -#if DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 1 && defined(__SSE2__) +#if DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 128 do_test(); #endif diff --git a/tests/matrix_free/matrix_vector_faces_26.cc b/tests/matrix_free/matrix_vector_faces_26.cc index 0fdfb20557..06020ffab7 100644 --- a/tests/matrix_free/matrix_vector_faces_26.cc +++ b/tests/matrix_free/matrix_vector_faces_26.cc @@ -44,18 +44,17 @@ test() do_test>( dof, constraints, true); -#if (DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 1 && defined(__SSE2__)) || \ - (DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 1 && defined(__ALTIVEC__)) +#if DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 128 do_test>( dof, constraints, true); #endif -#if DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 2 && defined(__AVX__) +#if DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 256 do_test>( dof, constraints, true); #endif -#if DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 3 && defined(__AVX512F__) +#if DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 512 do_test>( dof, constraints, true); #endif
1SSE2SSE2/AltiVec128