mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-04 21:42:39 +00:00
Add cmake option to enable or not AVX2 instructions
This commit is contained in:
parent
2a2eb3a27b
commit
72fb56904d
@ -1,4 +1,6 @@
|
||||
include("${ClickHouse_SOURCE_DIR}/cmake/dbms_glob_sources.cmake")
|
||||
option(ENABLE_AVX2 "Enable AVX2 instructions (when available) when build for modern Intel CPUs" OFF)
|
||||
|
||||
add_headers_and_sources(clickhouse_functions_gatherutils .)
|
||||
add_library(clickhouse_functions_gatherutils ${clickhouse_functions_gatherutils_sources} ${clickhouse_functions_gatherutils_headers})
|
||||
target_link_libraries(clickhouse_functions_gatherutils PRIVATE dbms)
|
||||
@ -19,7 +21,7 @@ if (HAVE_SSE42)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.2")
|
||||
target_compile_options(clickhouse_functions_gatherutils PRIVATE -msse4.2)
|
||||
endif()
|
||||
if (HAVE_AVX2)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx2")
|
||||
if (HAVE_AVX2 AND ENABLE_AVX2)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx2 -DENABLE_AVX2")
|
||||
target_compile_options(clickhouse_functions_gatherutils PRIVATE -mavx2)
|
||||
endif()
|
||||
|
@ -85,7 +85,7 @@ bool sliceHasImplAnyAll(const FirstSliceType & first, const SecondSliceType & se
|
||||
}
|
||||
|
||||
|
||||
#if defined(__AVX2__) || defined(__SSE4_2__)
|
||||
#if (defined(__AVX2__) && defined(ENABLE_AVX2)) || defined(__SSE4_2__)
|
||||
|
||||
namespace
|
||||
{
|
||||
@ -127,7 +127,7 @@ inline ALWAYS_INLINE bool hasAllIntegralLoopRemainder(
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(__AVX2__)
|
||||
#if defined(__AVX2__) && defined(ENABLE_AVX2)
|
||||
|
||||
// TODO: Discuss about
|
||||
// raise an error : "error: no viable conversion from 'const NumericArraySlice<unsigned int>' to 'const NumericArraySlice<int>'"
|
||||
|
Loading…
Reference in New Issue
Block a user