From 1ffccf2daba3dab31c4a2dd12cf920ef37103c81 Mon Sep 17 00:00:00 2001 From: Sam Yates <yates@cscs.ch> Date: Thu, 6 Sep 2018 10:12:07 +0200 Subject: [PATCH] Clarify vectorization-enabled build errors. (#588) Fixes #587. * Eliminate Clang warnings from GCC-tree-optimization bug work-around. * Error with static-assert if simd type is used with a missing simd abi. * Clarify install documentation regarding use of ARB_VECTORIZE with ARB_ARCH. --- doc/install.rst | 9 +++++---- include/arbor/simd/simd.hpp | 2 ++ include/arbor/util/compat.hpp | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/doc/install.rst b/doc/install.rst index c7c7cd01..9bf9915e 100644 --- a/doc/install.rst +++ b/doc/install.rst @@ -287,16 +287,17 @@ Vectorization ------------- Explicit vectorization of computational kernels can be enabled in Arbor by setting the -``ARB_VECTORIZE`` CMake flag: +``ARB_VECTORIZE`` CMake flag. This option is typically used in conjunction with the +``ARB_ARCH`` option to specify the target architecture: without SIMD support in Arbor +for the architecture, enabling ``ARB_VECTORIZE`` will lead to a compilation error. .. code-block:: bash - cmake -DARB_VECTORIZE=ON + cmake -DARB_VECTORIZE=ON -DARB_ARCH=native With this flag set, the library will use architecture-specific vectorization intrinsics to implement these kernels. Arbor currently has vectorization support for x86 architectures -with AVX, AVX2 or AVX512 ISA extensions. Enabling the `ARB_VECTORIZE` option for a target -without support in Arbor will give a compilation error. +with AVX, AVX2 or AVX512 ISA extensions. .. _gpu: diff --git a/include/arbor/simd/simd.hpp b/include/arbor/simd/simd.hpp index fff3ff08..4a319216 100644 --- a/include/arbor/simd/simd.hpp +++ b/include/arbor/simd/simd.hpp @@ -56,6 +56,8 @@ namespace simd_detail { template <typename Impl> struct simd_impl { + static_assert(!std::is_void<Impl>::value, "no such SIMD ABI supported"); + // Type aliases: // // scalar_type internal value type in one simd lane, diff --git a/include/arbor/util/compat.hpp b/include/arbor/util/compat.hpp index 46eacb06..531f7f73 100644 --- a/include/arbor/util/compat.hpp +++ b/include/arbor/util/compat.hpp @@ -42,7 +42,7 @@ inline void compiler_barrier_if_icc_leq(unsigned ver) { // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85597 template <typename T> -#if defined(__GNUC__) &&\ +#if !defined(__clang__) && defined(__GNUC__) &&\ ( __GNUC__<6 ||\ (__GNUC__==6 && __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__ < 401) ||\ (__GNUC__==7 && __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__ < 301) ||\ -- GitLab