mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Simplify and enable AVX-512
This commit is contained in:
parent
46e1d05a89
commit
89a7f90579
@ -7,30 +7,18 @@ endif()
|
|||||||
|
|
||||||
SET(LIBRARY_DIR "${ClickHouse_SOURCE_DIR}/contrib/aklomp-base64")
|
SET(LIBRARY_DIR "${ClickHouse_SOURCE_DIR}/contrib/aklomp-base64")
|
||||||
|
|
||||||
set(HAVE_NEON32 0)
|
# These defines enable/disable SIMD codecs in base64's runtime codec dispatch.
|
||||||
set(HAVE_NEON64 0)
|
# We don't want to limit ourselves --> enable all.
|
||||||
if (ARCH_AARCH64 AND NOT NO_ARMV81_OR_HIGHER)
|
set(HAVE_SSSE3 1)
|
||||||
|
set(HAVE_SSE41 1)
|
||||||
|
set(HAVE_SSE42 1)
|
||||||
|
set(HAVE_AVX 1)
|
||||||
|
set(HAVE_AVX2 1)
|
||||||
|
set(HAVE_AVX512 1)
|
||||||
|
# (no runtime dispatch on ARM)
|
||||||
|
if (NOT NO_ARMV81_OR_HIGHER)
|
||||||
set(HAVE_NEON64 1)
|
set(HAVE_NEON64 1)
|
||||||
endif ()
|
set(HAVE_NEON32 0)
|
||||||
|
|
||||||
macro(cast_to_bool var instruction)
|
|
||||||
if (HAVE_${var})
|
|
||||||
set(base64_${var} 1)
|
|
||||||
set(base64_${var}_opt ${instruction})
|
|
||||||
else()
|
|
||||||
set(base64_${var} 0)
|
|
||||||
endif()
|
|
||||||
endmacro()
|
|
||||||
|
|
||||||
cast_to_bool(SSSE3 "-mssse3")
|
|
||||||
cast_to_bool(SSE41 "-msse4.1")
|
|
||||||
cast_to_bool(SSE42 "-msse4.2")
|
|
||||||
cast_to_bool(AVX "-mavx")
|
|
||||||
cast_to_bool(AVX2 "-mavx2")
|
|
||||||
|
|
||||||
set(HAVE_FAST_UNALIGNED_ACCESS 0)
|
|
||||||
if(HAVE_SSSE3 OR HAVE_SSE41 OR HAVE_SSE42 OR HAVE_AVX OR HAVE_AVX2 OR HAVE_NEON64)
|
|
||||||
set(HAVE_FAST_UNALIGNED_ACCESS 1)
|
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
configure_file(config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
|
configure_file(config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
|
||||||
@ -44,16 +32,14 @@ add_library(_base64
|
|||||||
|
|
||||||
# Codec implementations
|
# Codec implementations
|
||||||
"${LIBRARY_DIR}/lib/arch/generic/codec.c"
|
"${LIBRARY_DIR}/lib/arch/generic/codec.c"
|
||||||
"${LIBRARY_DIR}/lib/arch/neon32/codec.c"
|
|
||||||
"${LIBRARY_DIR}/lib/arch/neon64/codec.c"
|
|
||||||
"${LIBRARY_DIR}/lib/arch/ssse3/codec.c"
|
"${LIBRARY_DIR}/lib/arch/ssse3/codec.c"
|
||||||
"${LIBRARY_DIR}/lib/arch/sse41/codec.c"
|
"${LIBRARY_DIR}/lib/arch/sse41/codec.c"
|
||||||
"${LIBRARY_DIR}/lib/arch/sse42/codec.c"
|
"${LIBRARY_DIR}/lib/arch/sse42/codec.c"
|
||||||
# ClickHouse does not support AVX* by default. We still need to compile these files
|
|
||||||
# because the run-time codec detection requires functions from these file to be present.
|
|
||||||
"${LIBRARY_DIR}/lib/arch/avx/codec.c"
|
"${LIBRARY_DIR}/lib/arch/avx/codec.c"
|
||||||
"${LIBRARY_DIR}/lib/arch/avx2/codec.c"
|
"${LIBRARY_DIR}/lib/arch/avx2/codec.c"
|
||||||
"${LIBRARY_DIR}/lib/arch/avx512/codec.c"
|
"${LIBRARY_DIR}/lib/arch/avx512/codec.c"
|
||||||
|
"${LIBRARY_DIR}/lib/arch/neon32/codec.c"
|
||||||
|
"${LIBRARY_DIR}/lib/arch/neon64/codec.c"
|
||||||
|
|
||||||
# Tables
|
# Tables
|
||||||
"${LIBRARY_DIR}/lib/tables/table_dec_32bit.h"
|
"${LIBRARY_DIR}/lib/tables/table_dec_32bit.h"
|
||||||
@ -62,21 +48,12 @@ add_library(_base64
|
|||||||
"${LIBRARY_DIR}/lib/codecs.h"
|
"${LIBRARY_DIR}/lib/codecs.h"
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/config.h")
|
"${CMAKE_CURRENT_BINARY_DIR}/config.h")
|
||||||
|
|
||||||
if(HAVE_AVX)
|
set_source_files_properties(${LIBRARY_DIR}/lib/arch/ssse3/codec.c PROPERTIES COMPILE_FLAGS "-mssse3")
|
||||||
set_source_files_properties(${LIBRARY_DIR}/lib/arch/avx/codec.c PROPERTIES COMPILE_FLAGS -mavx)
|
set_source_files_properties(${LIBRARY_DIR}/lib/arch/sse41/codec.c PROPERTIES COMPILE_FLAGS "-msse4.1")
|
||||||
endif()
|
set_source_files_properties(${LIBRARY_DIR}/lib/arch/sse42/codec.c PROPERTIES COMPILE_FLAGS "-msse4.2")
|
||||||
if(HAVE_AVX2)
|
set_source_files_properties(${LIBRARY_DIR}/lib/arch/avx/codec.c PROPERTIES COMPILE_FLAGS "-mavx")
|
||||||
set_source_files_properties(${LIBRARY_DIR}/lib/arch/avx2/codec.c PROPERTIES COMPILE_FLAGS -mavx2)
|
set_source_files_properties(${LIBRARY_DIR}/lib/arch/avx2/codec.c PROPERTIES COMPILE_FLAGS "-mavx2")
|
||||||
endif()
|
set_source_files_properties(${LIBRARY_DIR}/lib/arch/avx512/codec.c PROPERTIES COMPILE_FLAGS "-mavx512vl -mavx512vbmi")
|
||||||
if(HAVE_SSE41)
|
|
||||||
set_source_files_properties(${LIBRARY_DIR}/lib/arch/sse41/codec.c PROPERTIES COMPILE_FLAGS -msse4.1)
|
|
||||||
endif()
|
|
||||||
if(HAVE_SSE42)
|
|
||||||
set_source_files_properties(${LIBRARY_DIR}/lib/arch/sse42/codec.c PROPERTIES COMPILE_FLAGS -msse4.2)
|
|
||||||
endif()
|
|
||||||
if(HAVE_SSSE3)
|
|
||||||
set_source_files_properties(${LIBRARY_DIR}/lib/arch/ssse3/codec.c PROPERTIES COMPILE_FLAGS -mssse3)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
target_include_directories(_base64 SYSTEM PUBLIC ${LIBRARY_DIR}/include)
|
target_include_directories(_base64 SYSTEM PUBLIC ${LIBRARY_DIR}/include)
|
||||||
target_include_directories(_base64 PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
|
target_include_directories(_base64 PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
#cmakedefine01 HAVE_NEON32
|
|
||||||
#cmakedefine01 HAVE_NEON64
|
|
||||||
#cmakedefine01 HAVE_SSSE3
|
#cmakedefine01 HAVE_SSSE3
|
||||||
#cmakedefine01 HAVE_SSE41
|
#cmakedefine01 HAVE_SSE41
|
||||||
#cmakedefine01 HAVE_SSE42
|
#cmakedefine01 HAVE_SSE42
|
||||||
#cmakedefine01 HAVE_AVX
|
#cmakedefine01 HAVE_AVX
|
||||||
#cmakedefine01 HAVE_AVX2
|
#cmakedefine01 HAVE_AVX2
|
||||||
#cmakedefine01 HAVE_FAST_UNALIGNED_ACCESS
|
#cmakedefine01 HAVE_AVX512
|
||||||
|
|
||||||
|
#cmakedefine01 HAVE_NEON32
|
||||||
|
#cmakedefine01 HAVE_NEON64
|
||||||
|
Loading…
Reference in New Issue
Block a user