mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-06-28 16:41:01 +03:00
add BUILD_AVX2 definition, enable non-AVX2 building selectively
This commit is contained in:
parent
c078d355b6
commit
814045201f
@ -1190,7 +1190,7 @@ if (NOT FAT_RUNTIME)
|
|||||||
|
|
||||||
set(hs_exec_SRCS ${hs_exec_SRCS} ${hs_exec_common_SRCS})
|
set(hs_exec_SRCS ${hs_exec_SRCS} ${hs_exec_common_SRCS})
|
||||||
|
|
||||||
if (HAVE_AVX2)
|
if (BUILD_AVX2)
|
||||||
set(hs_exec_SRCS ${hs_exec_SRCS} ${hs_exec_avx2_SRCS})
|
set(hs_exec_SRCS ${hs_exec_SRCS} ${hs_exec_avx2_SRCS})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -1246,12 +1246,14 @@ else (FAT_RUNTIME)
|
|||||||
RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} corei7 ${CMAKE_MODULE_PATH}/keep.syms.in"
|
RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} corei7 ${CMAKE_MODULE_PATH}/keep.syms.in"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (BUILD_AVX2)
|
||||||
add_library(hs_exec_avx2 OBJECT ${hs_exec_SRCS} ${hs_exec_avx2_SRCS})
|
add_library(hs_exec_avx2 OBJECT ${hs_exec_SRCS} ${hs_exec_avx2_SRCS})
|
||||||
list(APPEND RUNTIME_LIBS $<TARGET_OBJECTS:hs_exec_avx2>)
|
list(APPEND RUNTIME_LIBS $<TARGET_OBJECTS:hs_exec_avx2>)
|
||||||
set_target_properties(hs_exec_avx2 PROPERTIES
|
set_target_properties(hs_exec_avx2 PROPERTIES
|
||||||
COMPILE_FLAGS "-march=core-avx2"
|
COMPILE_FLAGS "-march=core-avx2"
|
||||||
RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} avx2 ${CMAKE_MODULE_PATH}/keep.syms.in"
|
RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} avx2 ${CMAKE_MODULE_PATH}/keep.syms.in"
|
||||||
)
|
)
|
||||||
|
endif (BUILD_AVX2)
|
||||||
if (BUILD_AVX512)
|
if (BUILD_AVX512)
|
||||||
add_library(hs_exec_avx512 OBJECT ${hs_exec_SRCS} ${hs_exec_avx2_SRCS})
|
add_library(hs_exec_avx512 OBJECT ${hs_exec_SRCS} ${hs_exec_avx2_SRCS})
|
||||||
list(APPEND RUNTIME_LIBS $<TARGET_OBJECTS:hs_exec_avx512>)
|
list(APPEND RUNTIME_LIBS $<TARGET_OBJECTS:hs_exec_avx512>)
|
||||||
@ -1313,6 +1315,8 @@ else (FAT_RUNTIME)
|
|||||||
POSITION_INDEPENDENT_CODE TRUE
|
POSITION_INDEPENDENT_CODE TRUE
|
||||||
RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} corei7 ${CMAKE_MODULE_PATH}/keep.syms.in"
|
RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} corei7 ${CMAKE_MODULE_PATH}/keep.syms.in"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (BUILD_AVX2)
|
||||||
add_library(hs_exec_shared_avx2 OBJECT ${hs_exec_SRCS} ${hs_exec_avx2_SRCS})
|
add_library(hs_exec_shared_avx2 OBJECT ${hs_exec_SRCS} ${hs_exec_avx2_SRCS})
|
||||||
list(APPEND RUNTIME_SHLIBS $<TARGET_OBJECTS:hs_exec_shared_avx2>)
|
list(APPEND RUNTIME_SHLIBS $<TARGET_OBJECTS:hs_exec_shared_avx2>)
|
||||||
set_target_properties(hs_exec_shared_avx2 PROPERTIES
|
set_target_properties(hs_exec_shared_avx2 PROPERTIES
|
||||||
@ -1320,7 +1324,7 @@ else (FAT_RUNTIME)
|
|||||||
POSITION_INDEPENDENT_CODE TRUE
|
POSITION_INDEPENDENT_CODE TRUE
|
||||||
RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} avx2 ${CMAKE_MODULE_PATH}/keep.syms.in"
|
RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} avx2 ${CMAKE_MODULE_PATH}/keep.syms.in"
|
||||||
)
|
)
|
||||||
|
endif (BUILD_AVX2)
|
||||||
if (BUILD_AVX512)
|
if (BUILD_AVX512)
|
||||||
add_library(hs_exec_shared_avx512 OBJECT ${hs_exec_SRCS} ${hs_exec_avx2_SRCS})
|
add_library(hs_exec_shared_avx512 OBJECT ${hs_exec_SRCS} ${hs_exec_avx2_SRCS})
|
||||||
list(APPEND RUNTIME_SHLIBS $<TARGET_OBJECTS:hs_exec_shared_avx512>)
|
list(APPEND RUNTIME_SHLIBS $<TARGET_OBJECTS:hs_exec_shared_avx512>)
|
||||||
|
@ -28,6 +28,9 @@ if (BUILD_AVX512VBMI)
|
|||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (FAT_RUNTIME)
|
if (FAT_RUNTIME)
|
||||||
|
if (NOT DEFINED(BUILD_AVX2))
|
||||||
|
set(BUILD_AVX2 TRUE)
|
||||||
|
endif ()
|
||||||
# test the highest level microarch to make sure everything works
|
# test the highest level microarch to make sure everything works
|
||||||
if (BUILD_AVX512)
|
if (BUILD_AVX512)
|
||||||
if (BUILD_AVX512VBMI)
|
if (BUILD_AVX512VBMI)
|
||||||
@ -35,8 +38,10 @@ if (FAT_RUNTIME)
|
|||||||
else ()
|
else ()
|
||||||
set (CMAKE_REQUIRED_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_C_FLAGS} ${SKYLAKE_FLAG}")
|
set (CMAKE_REQUIRED_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_C_FLAGS} ${SKYLAKE_FLAG}")
|
||||||
endif (BUILD_AVX512VBMI)
|
endif (BUILD_AVX512VBMI)
|
||||||
else ()
|
elseif (BUILD_AVX2)
|
||||||
set (CMAKE_REQUIRED_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_C_FLAGS} -march=core-avx2")
|
set (CMAKE_REQUIRED_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_C_FLAGS} -march=core-avx2")
|
||||||
|
elseif ()
|
||||||
|
set (CMAKE_REQUIRED_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_C_FLAGS} -march=core-i7")
|
||||||
endif ()
|
endif ()
|
||||||
else (NOT FAT_RUNTIME)
|
else (NOT FAT_RUNTIME)
|
||||||
# if not fat runtime, then test given cflags
|
# if not fat runtime, then test given cflags
|
||||||
@ -99,23 +104,23 @@ if (FAT_RUNTIME)
|
|||||||
if ((ARCH_IA32 OR ARCH_X86_64) AND NOT HAVE_SSSE3)
|
if ((ARCH_IA32 OR ARCH_X86_64) AND NOT HAVE_SSSE3)
|
||||||
message(FATAL_ERROR "SSSE3 support required to build fat runtime")
|
message(FATAL_ERROR "SSSE3 support required to build fat runtime")
|
||||||
endif ()
|
endif ()
|
||||||
if ((ARCH_IA32 OR ARCH_X86_64) AND NOT HAVE_AVX2)
|
if ((ARCH_IA32 OR ARCH_X86_64) AND BUILD_AVX2 AND NOT HAVE_AVX2)
|
||||||
message(FATAL_ERROR "AVX2 support required to build fat runtime")
|
message(FATAL_ERROR "AVX2 support required to build fat runtime")
|
||||||
endif ()
|
endif ()
|
||||||
if ((ARCH_IA32 OR ARCH_X86_64) AND BUILD_AVX512 AND NOT HAVE_AVX512)
|
if ((ARCH_IA32 OR ARCH_X86_64) AND BUILD_AVX512 AND NOT HAVE_AVX512)
|
||||||
message(FATAL_ERROR "AVX512 support requested but not supported")
|
message(FATAL_ERROR "AVX512 support requested but not supported")
|
||||||
endif ()
|
endif ()
|
||||||
if (BUILD_AVX512VBMI AND NOT HAVE_AVX512VBMI)
|
if ((ARCH_IA32 OR ARCH_X86_64) AND BUILD_AVX512VBMI AND NOT HAVE_AVX512VBMI)
|
||||||
message(FATAL_ERROR "AVX512VBMI support requested but not supported")
|
message(FATAL_ERROR "AVX512VBMI support requested but not supported")
|
||||||
endif ()
|
endif ()
|
||||||
else (NOT FAT_RUNTIME)
|
else (NOT FAT_RUNTIME)
|
||||||
if ((ARCH_IA32 OR ARCH_X86_64) AND NOT HAVE_AVX2)
|
if ((ARCH_IA32 OR ARCH_X86_64) AND NOT BUILD_AVX2)
|
||||||
message(STATUS "Building without AVX2 support")
|
message(STATUS "Building without AVX2 support")
|
||||||
endif ()
|
endif ()
|
||||||
if ((ARCH_IA32 OR ARCH_X86_64) AND NOT HAVE_AVX512)
|
if ((ARCH_IA32 OR ARCH_X86_64) AND NOT HAVE_AVX512)
|
||||||
message(STATUS "Building without AVX512 support")
|
message(STATUS "Building without AVX512 support")
|
||||||
endif ()
|
endif ()
|
||||||
if (ARCH_IA32 OR ARCH_X86_64 AND NOT HAVE_AVX512VBMI)
|
if ((ARCH_IA32 OR ARCH_X86_64) AND NOT HAVE_AVX512VBMI)
|
||||||
message(STATUS "Building without AVX512VBMI support")
|
message(STATUS "Building without AVX512VBMI support")
|
||||||
endif ()
|
endif ()
|
||||||
if ((ARCH_IA32 OR ARCH_X86_64) AND NOT HAVE_SSSE3)
|
if ((ARCH_IA32 OR ARCH_X86_64) AND NOT HAVE_SSSE3)
|
||||||
|
@ -27,6 +27,9 @@
|
|||||||
/* Define if building "fat" runtime. */
|
/* Define if building "fat" runtime. */
|
||||||
#cmakedefine FAT_RUNTIME
|
#cmakedefine FAT_RUNTIME
|
||||||
|
|
||||||
|
/* Define if building AVX2 in the fat runtime. */
|
||||||
|
#cmakedefine BUILD_AVX2
|
||||||
|
|
||||||
/* Define if building AVX-512 in the fat runtime. */
|
/* Define if building AVX-512 in the fat runtime. */
|
||||||
#cmakedefine BUILD_AVX512
|
#cmakedefine BUILD_AVX512
|
||||||
|
|
||||||
|
@ -48,12 +48,12 @@
|
|||||||
#define HAVE_SIMD_128_BITS
|
#define HAVE_SIMD_128_BITS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__AVX__)
|
#if defined(__AVX__) && defined(BUILD_AVX2)
|
||||||
#define HAVE_AVX
|
#define HAVE_AVX
|
||||||
#define HAVE_SIMD_256_BITS
|
#define HAVE_SIMD_256_BITS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__AVX2__)
|
#if defined(__AVX2__) && defined(BUILD_AVX2)
|
||||||
#define HAVE_AVX2
|
#define HAVE_AVX2
|
||||||
#define HAVE_SIMD_256_BITS
|
#define HAVE_SIMD_256_BITS
|
||||||
#endif
|
#endif
|
||||||
|
@ -93,7 +93,6 @@ set(unit_internal_SOURCES
|
|||||||
internal/insertion_ordered.cpp
|
internal/insertion_ordered.cpp
|
||||||
internal/lbr.cpp
|
internal/lbr.cpp
|
||||||
internal/limex_nfa.cpp
|
internal/limex_nfa.cpp
|
||||||
internal/masked_move.cpp
|
|
||||||
internal/multi_bit.cpp
|
internal/multi_bit.cpp
|
||||||
internal/multi_bit_compress.cpp
|
internal/multi_bit_compress.cpp
|
||||||
internal/nfagraph_common.h
|
internal/nfagraph_common.h
|
||||||
@ -128,6 +127,12 @@ set(unit_internal_SOURCES
|
|||||||
internal/vermicelli.cpp
|
internal/vermicelli.cpp
|
||||||
internal/main.cpp
|
internal/main.cpp
|
||||||
)
|
)
|
||||||
|
if (BUILD_AVX2)
|
||||||
|
set(unit_internal_SOURCES
|
||||||
|
${unit_internal_SOURCES}
|
||||||
|
internal/masked_move.cpp
|
||||||
|
)
|
||||||
|
endif(BUILD_AVX2)
|
||||||
|
|
||||||
if(WIN32 AND (BUILD_STATIC_AND_SHARED OR BUILD_SHARED_LIBS))
|
if(WIN32 AND (BUILD_STATIC_AND_SHARED OR BUILD_SHARED_LIBS))
|
||||||
add_executable(unit-internal ${unit_internal_SOURCES} $<TARGET_OBJECTS:hs_compile_shared> $<TARGET_OBJECTS:hs_exec_shared>)
|
add_executable(unit-internal ${unit_internal_SOURCES} $<TARGET_OBJECTS:hs_compile_shared> $<TARGET_OBJECTS:hs_exec_shared>)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user