From 8adb98baff4ec4eabbb4229d4e151b64bb8f06c3 Mon Sep 17 00:00:00 2001 From: Antoine Pitrou Date: Mon, 26 Nov 2018 17:58:26 +0100 Subject: [PATCH] ARROW-3844: [C++] Remove ARROW_USE_SSE and ARROW_SSE3 Those options can be detected programmatically (SSE3 and SSE4.2 are available on all recent x86-64 CPUs). Instead we add a ARROW_USE_SIMD option that can be disabled to exercise non-SIMD fallback paths. --- cpp/CMakeLists.txt | 9 +++------ cpp/cmake_modules/SetupCxxFlags.cmake | 4 ++-- cpp/src/arrow/util/bit-util.h | 5 ----- cpp/src/arrow/util/cpu-info.cc | 2 +- cpp/src/arrow/util/sse-util.h | 4 ++-- 5 files changed, 8 insertions(+), 16 deletions(-) diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 5cdb8040b8f5b..8436e65ba8076 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -190,8 +190,9 @@ Pass multiple labels by dividing with semicolons") "Build Arrow Fuzzing executables" OFF) - option(ARROW_SSE3 - "Build Arrow with SSE3" + # Disable this option to exercise non-SIMD fallbacks + option(ARROW_USE_SIMD + "Build with SIMD optimizations" ON) option(ARROW_ALTIVEC @@ -222,10 +223,6 @@ Pass multiple labels by dividing with semicolons") "Build the plasma object store java client" OFF) - option(ARROW_USE_SSE - "Build with SSE4 optimizations" - OFF) - option(ARROW_WITH_BROTLI "Build with Brotli compression" ON) diff --git a/cpp/cmake_modules/SetupCxxFlags.cmake b/cpp/cmake_modules/SetupCxxFlags.cmake index 6f379f9e01d21..d239d69a93d68 100644 --- a/cpp/cmake_modules/SetupCxxFlags.cmake +++ b/cpp/cmake_modules/SetupCxxFlags.cmake @@ -220,8 +220,8 @@ if (CXX_SUPPORTS_ALTIVEC AND ARROW_ALTIVEC) set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -maltivec") endif() -if (ARROW_USE_SSE) - add_definitions(-DARROW_USE_SSE) +if (ARROW_USE_SIMD) + add_definitions(-DARROW_USE_SIMD) endif() if (APPLE) diff --git a/cpp/src/arrow/util/bit-util.h b/cpp/src/arrow/util/bit-util.h index 0119c1f046a07..cd3d5b0c58ff8 100644 --- a/cpp/src/arrow/util/bit-util.h +++ b/cpp/src/arrow/util/bit-util.h @@ -62,11 +62,6 @@ #include "arrow/util/type_traits.h" #include "arrow/util/visibility.h" -#ifdef ARROW_USE_SSE -#include "arrow/util/cpu-info.h" -#include "arrow/util/sse-util.h" -#endif - namespace arrow { class Buffer; diff --git a/cpp/src/arrow/util/cpu-info.cc b/cpp/src/arrow/util/cpu-info.cc index 3f3488217c620..514b862c6d58e 100644 --- a/cpp/src/arrow/util/cpu-info.cc +++ b/cpp/src/arrow/util/cpu-info.cc @@ -279,7 +279,7 @@ void CpuInfo::VerifyCpuRequirements() { } bool CpuInfo::CanUseSSE4_2() const { -#ifdef ARROW_USE_SSE +#ifdef ARROW_USE_SIMD return IsSupported(CpuInfo::SSE4_2); #else return false; diff --git a/cpp/src/arrow/util/sse-util.h b/cpp/src/arrow/util/sse-util.h index 0ff1ff3ae3575..edaf6686be5fb 100644 --- a/cpp/src/arrow/util/sse-util.h +++ b/cpp/src/arrow/util/sse-util.h @@ -24,6 +24,8 @@ #undef ARROW_HAVE_SSE2 #undef ARROW_HAVE_SSE4_2 +#ifdef ARROW_USE_SIMD + // MSVC x86-64 #if (defined(_M_AMD64) || defined(_M_X64)) @@ -44,8 +46,6 @@ #include #endif -#if defined(ARROW_USE_SSE) && !defined(ARROW_HAVE_SSE2) -#error "ARROW_USE_SSE enabled but no intrinsics available" #endif namespace arrow {