mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-06-28 16:41:01 +03:00
commit
85a6973060
44
CHANGELOG-vectorscan.md
Normal file
44
CHANGELOG-vectorscan.md
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
# Vectorscan Change Log
|
||||||
|
|
||||||
|
This is a list of notable changes to Vectorscan, in reverse chronological order. For Hyperscan Changelog, check CHANGELOG.md
|
||||||
|
|
||||||
|
## [5.4.10] 2023-09-23
|
||||||
|
|
||||||
|
|
||||||
|
## [5.4.9] 2023-03-23
|
||||||
|
- Major change: Enable SVE & SVE2 builds and make it a supported architecture! (thanks to @abondarev84)
|
||||||
|
- Fix various clang-related bugs
|
||||||
|
- Fix Aarch64 bug in Parser.rl because of char signedness. Make unsigned char the default in the Parser for all architectures.
|
||||||
|
- Fix Power bug, multiple tests were failing.
|
||||||
|
- C++20 related change, use prefixed assume_aligned to avoid conflict with C++20 std::assume_aligned.
|
||||||
|
|
||||||
|
## [5.4.8] 2022-09-13
|
||||||
|
- CMake: Use non-deprecated method for finding python by @jth in #108
|
||||||
|
- Optimize vectorscan for aarch64 by using shrn instruction by @danlark1 in #113
|
||||||
|
- Fixed the PCRE download location by @pareenaverma in #116
|
||||||
|
- Bugfix/hyperscan backport 202208 by @markos in #118
|
||||||
|
- VSX optimizations by @markos in #119
|
||||||
|
- when compiling with mingw64, use __mingw_aligned_malloc() and __mingw_aligned_free() by @liquidaty in #121
|
||||||
|
- [NEON] simplify/optimize shift/align primitives by @markos in #123
|
||||||
|
- Merge develop to master by @markos in #124
|
||||||
|
|
||||||
|
## [5.4.7] 2022-05-05
|
||||||
|
- Fix word boundary assertions under C++20 by @BigRedEye in #90
|
||||||
|
- Fix all ASAN issues in vectorscan by @danlark1 in #93
|
||||||
|
- change FAT_RUNTIME to a normal option so it can be set to off by @a16bitsysop in #94
|
||||||
|
- Optimized and correct version of movemask128 for ARM by @danlark1 in #102
|
||||||
|
|
||||||
|
## [5.4.6] 2022-01-21
|
||||||
|
- Major refactoring of many engines to use internal SuperVector C++ templates library. Code size reduced to 1/3rd with no loss of performance in most cases.
|
||||||
|
- Microbenchmarking tool added for performance finetuning
|
||||||
|
- Arm Advanced SIMD/NEON fully ported. Initial work on SVE2 for a couple of engines.
|
||||||
|
- Power9 VSX ppc64le fully ported. Initial port needs some optimization.
|
||||||
|
- Clang compiler support added.
|
||||||
|
- Apple M1 support added.
|
||||||
|
- CI added, the following configurations are tested on every PR:
|
||||||
|
gcc-debug, gcc-release, clang-debug, clang-release:
|
||||||
|
Linux Intel: SSE4.2, AVX2, AVX512, FAT
|
||||||
|
Linux Arm
|
||||||
|
Linux Power9
|
||||||
|
clang-debug, clang-release:
|
||||||
|
MacOS Apple M1
|
25
CHANGELOG.md
25
CHANGELOG.md
@ -2,6 +2,31 @@
|
|||||||
|
|
||||||
This is a list of notable changes to Hyperscan, in reverse chronological order.
|
This is a list of notable changes to Hyperscan, in reverse chronological order.
|
||||||
|
|
||||||
|
## [5.4.2] 2023-04-19
|
||||||
|
- Roll back bugfix for github issue #350: Besides using scratch for
|
||||||
|
corresponding database, Hyperscan also allows user to use larger scratch
|
||||||
|
allocated for another database. Users can leverage this property to achieve
|
||||||
|
safe scratch usage in multi-database scenarios. Behaviors beyond these are
|
||||||
|
discouraged and results are undefined.
|
||||||
|
- Fix hsdump issue due to invalid nfa type.
|
||||||
|
|
||||||
|
## [5.4.1] 2023-02-20
|
||||||
|
- The Intel Hyperscan team is pleased to provide a bug fix release to our open source library.
|
||||||
|
Intel also maintains an upgraded version available through your Intel sales representative.
|
||||||
|
- Bugfix for issue #184: fix random char value of UTF-8.
|
||||||
|
- Bugfix for issue #291: bypass logical combination flag in hs_expression_info().
|
||||||
|
- Bugfix for issue #292: fix build error due to libc symbol parsing.
|
||||||
|
- Bugfix for issue #302/304: add empty string check for pure literal API.
|
||||||
|
- Bugfix for issue #303: fix unknown instruction error in pure literal API.
|
||||||
|
- Bugfix for issue #303: avoid memory leak in stream close stage.
|
||||||
|
- Bugfix for issue #305: fix assertion failure in DFA construction.
|
||||||
|
- Bugfix for issue #317: fix aligned allocator segment faults.
|
||||||
|
- Bugfix for issue #350: add quick validity check for scratch.
|
||||||
|
- Bugfix for issue #359: fix glibc-2.34 stack size issue.
|
||||||
|
- Bugfix for issue #360: fix SKIP flag issue in chimera.
|
||||||
|
- Bugfix for issue #362: fix one cotec check corner issue in UTF-8 validation.
|
||||||
|
- Fix other compile issues.
|
||||||
|
|
||||||
## [5.4.0] 2020-12-31
|
## [5.4.0] 2020-12-31
|
||||||
- Improvement on literal matcher "Fat Teddy" performance, including
|
- Improvement on literal matcher "Fat Teddy" performance, including
|
||||||
support for Intel(R) AVX-512 Vector Byte Manipulation Instructions (Intel(R)
|
support for Intel(R) AVX-512 Vector Byte Manipulation Instructions (Intel(R)
|
||||||
|
397
CMakeLists.txt
397
CMakeLists.txt
@ -4,7 +4,7 @@ project (vectorscan C CXX)
|
|||||||
|
|
||||||
set (HS_MAJOR_VERSION 5)
|
set (HS_MAJOR_VERSION 5)
|
||||||
set (HS_MINOR_VERSION 4)
|
set (HS_MINOR_VERSION 4)
|
||||||
set (HS_PATCH_VERSION 9)
|
set (HS_PATCH_VERSION 10)
|
||||||
set (HS_VERSION ${HS_MAJOR_VERSION}.${HS_MINOR_VERSION}.${HS_PATCH_VERSION})
|
set (HS_VERSION ${HS_MAJOR_VERSION}.${HS_MINOR_VERSION}.${HS_PATCH_VERSION})
|
||||||
|
|
||||||
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
|
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
|
||||||
@ -187,11 +187,15 @@ if (CMAKE_COMPILER_IS_GNUCC AND NOT CROSS_COMPILE)
|
|||||||
string(FIND "${GNUCC_ARCH}" "sve" POS_SVE)
|
string(FIND "${GNUCC_ARCH}" "sve" POS_SVE)
|
||||||
string(FIND "${GNUCC_ARCH}" "sve2" POS_SVE2)
|
string(FIND "${GNUCC_ARCH}" "sve2" POS_SVE2)
|
||||||
string(FIND "${GNUCC_ARCH}" "sve2-bitperm" POS_SVE2_BITPERM)
|
string(FIND "${GNUCC_ARCH}" "sve2-bitperm" POS_SVE2_BITPERM)
|
||||||
if (NOT POS_SVE EQUAL 0)
|
if(NOT POS_SVE2_BITPERM EQUAL 0)
|
||||||
|
set(SVE2_BITPERM_FOUND 1)
|
||||||
|
set(SVE2_FOUND 1)
|
||||||
set(SVE_FOUND 1)
|
set(SVE_FOUND 1)
|
||||||
elseif(NOT POS_SVE2 EQUAL 0)
|
elseif(NOT POS_SVE2 EQUAL 0)
|
||||||
set(SVE2_FOUND 1)
|
set(SVE2_FOUND 1)
|
||||||
elseif(NOT POS_SVE2_BITPERM EQUAL 0)
|
set(SVE_FOUND 1)
|
||||||
|
elseif (NOT POS_SVE EQUAL 0)
|
||||||
|
set(SVE_FOUND 1)
|
||||||
set(SVE2_BITPERM_FOUND 1)
|
set(SVE2_BITPERM_FOUND 1)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -249,13 +253,18 @@ if (ARCH_IA32 OR ARCH_X86_64)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (ARCH_AARCH64)
|
if (ARCH_AARCH64)
|
||||||
if (BUILD_SVE2_BITPERM AND NOT SVE2_BITPERM_FOUND)
|
if (NOT FAT_RUNTIME)
|
||||||
set(GNUCC_ARCH "${GNUCC_ARCH}+sve2-bitperm")
|
if (BUILD_SVE2_BITPERM AND NOT SVE2_BITPERM_FOUND)
|
||||||
elseif (BUILD_SVE2 AND NOT SVE2_FOUND)
|
set(GNUCC_ARCH "${GNUCC_ARCH}+sve2-bitperm")
|
||||||
set(GNUCC_ARCH "${GNUCC_ARCH}+sve2")
|
elseif (BUILD_SVE2 AND NOT SVE2_FOUND)
|
||||||
elseif (BUILD_SVE AND NOT SVE_FOUND)
|
set(GNUCC_ARCH "${GNUCC_ARCH}+sve2")
|
||||||
set(GNUCC_ARCH "${GNUCC_ARCH}+sve")
|
elseif (BUILD_SVE AND NOT SVE_FOUND)
|
||||||
endif ()
|
set(GNUCC_ARCH "${GNUCC_ARCH}+sve")
|
||||||
|
endif ()
|
||||||
|
else()
|
||||||
|
set(ARCH_C_FLAGS "")
|
||||||
|
set(ARCH_CXX_FLAGS "")
|
||||||
|
endif()
|
||||||
endif(ARCH_AARCH64)
|
endif(ARCH_AARCH64)
|
||||||
|
|
||||||
message(STATUS "ARCH_C_FLAGS : ${ARCH_C_FLAGS}")
|
message(STATUS "ARCH_C_FLAGS : ${ARCH_C_FLAGS}")
|
||||||
@ -271,24 +280,6 @@ if (NOT FAT_RUNTIME)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
#if (ARCH_IA32 OR ARCH_X86_64 OR ARCH_ARM32 OR ARCH_AARCH64)
|
|
||||||
# if (NOT CMAKE_C_FLAGS MATCHES .*march.* AND NOT CMAKE_C_FLAGS MATCHES .*mtune.*)
|
|
||||||
# set(ARCH_C_FLAGS "-march=${GNUCC_ARCH} -mtune=${TUNE_FLAG}")
|
|
||||||
# endif()
|
|
||||||
# if (NOT CMAKE_CXX_FLAGS MATCHES .*march.* AND NOT CMAKE_CXX_FLAGS MATCHES .*mtune.*)
|
|
||||||
# set(ARCH_CXX_FLAGS "-march=${GNUCC_ARCH} -mtune=${TUNE_FLAG}")
|
|
||||||
# endif()
|
|
||||||
#endif()
|
|
||||||
|
|
||||||
#if(ARCH_PPC64EL)
|
|
||||||
# if (NOT CMAKE_C_FLAGS MATCHES .*march.* AND NOT CMAKE_C_FLAGS MATCHES .*mtune.*)
|
|
||||||
# set(ARCH_C_FLAGS "-mtune=${TUNE_FLAG}")
|
|
||||||
# endif()
|
|
||||||
# if (NOT CMAKE_CXX_FLAGS MATCHES .*march.* AND NOT CMAKE_CXX_FLAGS MATCHES .*mtune.*)
|
|
||||||
# set(ARCH_CXX_FLAGS "-mtune=${TUNE_FLAG}")
|
|
||||||
# endif()
|
|
||||||
#endif()
|
|
||||||
|
|
||||||
# compiler version checks TODO: test more compilers
|
# compiler version checks TODO: test more compilers
|
||||||
if (CMAKE_COMPILER_IS_GNUCXX)
|
if (CMAKE_COMPILER_IS_GNUCXX)
|
||||||
set(GNUCXX_MINVER "9")
|
set(GNUCXX_MINVER "9")
|
||||||
@ -396,6 +387,7 @@ endif()
|
|||||||
|
|
||||||
option(FAT_RUNTIME "Build a library that supports multiple microarchitectures" ON)
|
option(FAT_RUNTIME "Build a library that supports multiple microarchitectures" ON)
|
||||||
if (CMAKE_SYSTEM_NAME MATCHES "Linux" AND FAT_RUNTIME MATCHES "ON")
|
if (CMAKE_SYSTEM_NAME MATCHES "Linux" AND FAT_RUNTIME MATCHES "ON")
|
||||||
|
message("Fat Runtime for ${GNUCC_ARCH}")
|
||||||
# This is a Linux-only feature for now - requires platform support
|
# This is a Linux-only feature for now - requires platform support
|
||||||
# elsewhere
|
# elsewhere
|
||||||
message(STATUS "generator is ${CMAKE_GENERATOR}")
|
message(STATUS "generator is ${CMAKE_GENERATOR}")
|
||||||
@ -482,6 +474,18 @@ if (CXX_UNUSED_CONST_VAR)
|
|||||||
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Wno-unused-const-variable")
|
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Wno-unused-const-variable")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# clang-14 complains about unused-but-set variable.
|
||||||
|
CHECK_CXX_COMPILER_FLAG("-Wunused-but-set-variable" CXX_UNUSED_BUT_SET_VAR)
|
||||||
|
if (CXX_UNUSED_BUT_SET_VAR)
|
||||||
|
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Wno-unused-but-set-variable")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# clang-14 complains about using bitwise operator instead of logical ones.
|
||||||
|
CHECK_CXX_COMPILER_FLAG("-Wbitwise-instead-of-logical" CXX_BITWISE_INSTEAD_OF_LOGICAL)
|
||||||
|
if (CXX_BITWISE_INSTEAD_OF_LOGICAL)
|
||||||
|
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Wno-bitwise-instead-of-logical")
|
||||||
|
endif()
|
||||||
|
|
||||||
# gcc 6 complains about type attributes that get ignored, like alignment
|
# gcc 6 complains about type attributes that get ignored, like alignment
|
||||||
CHECK_CXX_COMPILER_FLAG("-Wignored-attributes" CXX_IGNORED_ATTR)
|
CHECK_CXX_COMPILER_FLAG("-Wignored-attributes" CXX_IGNORED_ATTR)
|
||||||
if (CXX_IGNORED_ATTR)
|
if (CXX_IGNORED_ATTR)
|
||||||
@ -513,8 +517,10 @@ CHECK_CXX_COMPILER_FLAG("-Wunused-variable" CXX_WUNUSED_VARIABLE)
|
|||||||
|
|
||||||
# gcc 10 complains about this
|
# gcc 10 complains about this
|
||||||
CHECK_C_COMPILER_FLAG("-Wstringop-overflow" CC_STRINGOP_OVERFLOW)
|
CHECK_C_COMPILER_FLAG("-Wstringop-overflow" CC_STRINGOP_OVERFLOW)
|
||||||
if(CC_STRINGOP_OVERFLOW)
|
CHECK_CXX_COMPILER_FLAG("-Wstringop-overflow" CXX_STRINGOP_OVERFLOW)
|
||||||
|
if(CC_STRINGOP_OVERFLOW OR CXX_STRINGOP_OVERFLOW)
|
||||||
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wno-stringop-overflow")
|
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wno-stringop-overflow")
|
||||||
|
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Wno-stringop-overflow")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
|
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
|
||||||
@ -529,8 +535,8 @@ endif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
|
|||||||
|
|
||||||
|
|
||||||
if (FAT_RUNTIME)
|
if (FAT_RUNTIME)
|
||||||
if (NOT (ARCH_IA32 OR ARCH_X86_64))
|
if (NOT (ARCH_IA32 OR ARCH_X86_64 OR ARCH_AARCH64))
|
||||||
message(FATAL_ERROR "Fat runtime is not supported on non-Intel architectures")
|
message(FATAL_ERROR "Fat runtime is only supported on Intel and Aarch64 architectures")
|
||||||
else()
|
else()
|
||||||
message(STATUS "Building runtime for multiple microarchitectures")
|
message(STATUS "Building runtime for multiple microarchitectures")
|
||||||
endif()
|
endif()
|
||||||
@ -634,7 +640,7 @@ endif ()
|
|||||||
|
|
||||||
set (hs_exec_SRCS
|
set (hs_exec_SRCS
|
||||||
${hs_HEADERS}
|
${hs_HEADERS}
|
||||||
src/hs_version.h
|
src/hs_version.h.in
|
||||||
src/ue2common.h
|
src/ue2common.h
|
||||||
src/allocator.h
|
src/allocator.h
|
||||||
src/crc32.c
|
src/crc32.c
|
||||||
@ -790,7 +796,7 @@ set (hs_exec_SRCS
|
|||||||
endif ()
|
endif ()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (NOT BUILD_SVE2)
|
if (FAT_RUNTIME OR (NOT FAT_RUNTIME AND NOT BUILD_SVE2))
|
||||||
set (hs_exec_SRCS
|
set (hs_exec_SRCS
|
||||||
${hs_exec_SRCS}
|
${hs_exec_SRCS}
|
||||||
src/nfa/vermicelli_simd.cpp)
|
src/nfa/vermicelli_simd.cpp)
|
||||||
@ -810,7 +816,7 @@ SET (hs_compile_SRCS
|
|||||||
src/grey.h
|
src/grey.h
|
||||||
src/hs.cpp
|
src/hs.cpp
|
||||||
src/hs_internal.h
|
src/hs_internal.h
|
||||||
src/hs_version.h
|
src/hs_version.h.in
|
||||||
src/scratch.h
|
src/scratch.h
|
||||||
src/state.h
|
src/state.h
|
||||||
src/ue2common.h
|
src/ue2common.h
|
||||||
@ -1273,137 +1279,222 @@ if (NOT FAT_RUNTIME)
|
|||||||
add_library(hs_compile_shared OBJECT ${hs_compile_SRCS})
|
add_library(hs_compile_shared OBJECT ${hs_compile_SRCS})
|
||||||
set_target_properties(hs_compile_shared PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
|
set_target_properties(hs_compile_shared PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
|
||||||
endif()
|
endif()
|
||||||
|
else ()
|
||||||
|
if (ARCH_IA32 OR ARCH_X86_64)
|
||||||
|
set(BUILD_WRAPPER "${PROJECT_SOURCE_DIR}/cmake/build_wrapper.sh")
|
||||||
|
if (NOT BUILD_AVX512)
|
||||||
|
set (DISPATCHER_DEFINE "-DDISABLE_AVX512_DISPATCH")
|
||||||
|
endif (NOT BUILD_AVX512)
|
||||||
|
if (NOT BUILD_AVX512VBMI)
|
||||||
|
set (DISPATCHER_DEFINE "${DISPATCHER_DEFINE} -DDISABLE_AVX512VBMI_DISPATCH")
|
||||||
|
endif (NOT BUILD_AVX512VBMI)
|
||||||
|
set_source_files_properties(src/dispatcher.c PROPERTIES
|
||||||
|
COMPILE_FLAGS "-Wno-unused-parameter -Wno-unused-function ${DISPATCHER_DEFINE}")
|
||||||
|
|
||||||
else (FAT_RUNTIME)
|
if (BUILD_STATIC_LIBS)
|
||||||
|
add_library(hs_exec_core2 OBJECT ${hs_exec_SRCS})
|
||||||
set(BUILD_WRAPPER "${PROJECT_SOURCE_DIR}/cmake/build_wrapper.sh")
|
list(APPEND RUNTIME_LIBS $<TARGET_OBJECTS:hs_exec_core2>)
|
||||||
if (NOT BUILD_AVX512)
|
set_target_properties(hs_exec_core2 PROPERTIES
|
||||||
set (DISPATCHER_DEFINE "-DDISABLE_AVX512_DISPATCH")
|
COMPILE_FLAGS "-march=core2 -msse4.2"
|
||||||
endif (NOT BUILD_AVX512)
|
RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} core2 ${CMAKE_MODULE_PATH}/keep.syms.in"
|
||||||
if (NOT BUILD_AVX512VBMI)
|
|
||||||
set (DISPATCHER_DEFINE "${DISPATCHER_DEFINE} -DDISABLE_AVX512VBMI_DISPATCH")
|
|
||||||
endif (NOT BUILD_AVX512VBMI)
|
|
||||||
set_source_files_properties(src/dispatcher.c PROPERTIES
|
|
||||||
COMPILE_FLAGS "-Wno-unused-parameter -Wno-unused-function ${DISPATCHER_DEFINE}")
|
|
||||||
|
|
||||||
if (BUILD_STATIC_LIBS)
|
|
||||||
add_library(hs_exec_core2 OBJECT ${hs_exec_SRCS})
|
|
||||||
list(APPEND RUNTIME_LIBS $<TARGET_OBJECTS:hs_exec_core2>)
|
|
||||||
set_target_properties(hs_exec_core2 PROPERTIES
|
|
||||||
COMPILE_FLAGS "-march=core2 -msse4.2"
|
|
||||||
RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} core2 ${CMAKE_MODULE_PATH}/keep.syms.in"
|
|
||||||
)
|
|
||||||
|
|
||||||
add_library(hs_exec_corei7 OBJECT ${hs_exec_SRCS})
|
|
||||||
list(APPEND RUNTIME_LIBS $<TARGET_OBJECTS:hs_exec_corei7>)
|
|
||||||
set_target_properties(hs_exec_corei7 PROPERTIES
|
|
||||||
COMPILE_FLAGS "-march=corei7 -msse4.2"
|
|
||||||
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})
|
|
||||||
list(APPEND RUNTIME_LIBS $<TARGET_OBJECTS:hs_exec_avx2>)
|
|
||||||
set_target_properties(hs_exec_avx2 PROPERTIES
|
|
||||||
COMPILE_FLAGS "-march=core-avx2 -mavx2"
|
|
||||||
RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} avx2 ${CMAKE_MODULE_PATH}/keep.syms.in"
|
|
||||||
)
|
)
|
||||||
endif (BUILD_AVX2)
|
|
||||||
if (BUILD_AVX512)
|
|
||||||
add_library(hs_exec_avx512 OBJECT ${hs_exec_SRCS} ${hs_exec_avx2_SRCS})
|
|
||||||
list(APPEND RUNTIME_LIBS $<TARGET_OBJECTS:hs_exec_avx512>)
|
|
||||||
set_target_properties(hs_exec_avx512 PROPERTIES
|
|
||||||
COMPILE_FLAGS "${SKYLAKE_FLAG}"
|
|
||||||
RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} avx512 ${CMAKE_MODULE_PATH}/keep.syms.in"
|
|
||||||
)
|
|
||||||
endif (BUILD_AVX512)
|
|
||||||
if (BUILD_AVX512VBMI)
|
|
||||||
add_library(hs_exec_avx512vbmi OBJECT ${hs_exec_SRCS} ${hs_exec_avx2_SRCS})
|
|
||||||
list(APPEND RUNTIME_LIBS $<TARGET_OBJECTS:hs_exec_avx512vbmi>)
|
|
||||||
set_target_properties(hs_exec_avx512vbmi PROPERTIES
|
|
||||||
COMPILE_FLAGS "${ICELAKE_FLAG}"
|
|
||||||
RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} avx512vbmi ${CMAKE_MODULE_PATH}/keep.syms.in"
|
|
||||||
)
|
|
||||||
endif (BUILD_AVX512VBMI)
|
|
||||||
|
|
||||||
add_library(hs_exec_common OBJECT
|
add_library(hs_exec_corei7 OBJECT ${hs_exec_SRCS})
|
||||||
|
list(APPEND RUNTIME_LIBS $<TARGET_OBJECTS:hs_exec_corei7>)
|
||||||
|
set_target_properties(hs_exec_corei7 PROPERTIES
|
||||||
|
COMPILE_FLAGS "-march=corei7 -msse4.2"
|
||||||
|
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})
|
||||||
|
list(APPEND RUNTIME_LIBS $<TARGET_OBJECTS:hs_exec_avx2>)
|
||||||
|
set_target_properties(hs_exec_avx2 PROPERTIES
|
||||||
|
COMPILE_FLAGS "-march=core-avx2 -mavx2"
|
||||||
|
RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} avx2 ${CMAKE_MODULE_PATH}/keep.syms.in"
|
||||||
|
)
|
||||||
|
endif (BUILD_AVX2)
|
||||||
|
if (BUILD_AVX512)
|
||||||
|
add_library(hs_exec_avx512 OBJECT ${hs_exec_SRCS} ${hs_exec_avx2_SRCS})
|
||||||
|
list(APPEND RUNTIME_LIBS $<TARGET_OBJECTS:hs_exec_avx512>)
|
||||||
|
set_target_properties(hs_exec_avx512 PROPERTIES
|
||||||
|
COMPILE_FLAGS "${SKYLAKE_FLAG}"
|
||||||
|
RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} avx512 ${CMAKE_MODULE_PATH}/keep.syms.in"
|
||||||
|
)
|
||||||
|
endif (BUILD_AVX512)
|
||||||
|
if (BUILD_AVX512VBMI)
|
||||||
|
add_library(hs_exec_avx512vbmi OBJECT ${hs_exec_SRCS} ${hs_exec_avx2_SRCS})
|
||||||
|
list(APPEND RUNTIME_LIBS $<TARGET_OBJECTS:hs_exec_avx512vbmi>)
|
||||||
|
set_target_properties(hs_exec_avx512vbmi PROPERTIES
|
||||||
|
COMPILE_FLAGS "${ICELAKE_FLAG}"
|
||||||
|
RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} avx512vbmi ${CMAKE_MODULE_PATH}/keep.syms.in"
|
||||||
|
)
|
||||||
|
endif (BUILD_AVX512VBMI)
|
||||||
|
|
||||||
|
add_library(hs_exec_common OBJECT
|
||||||
|
${hs_exec_common_SRCS}
|
||||||
|
src/dispatcher.c
|
||||||
|
)
|
||||||
|
|
||||||
|
# hs_version.c is added explicitly to avoid some build systems that refuse to
|
||||||
|
# create a lib without any src (I'm looking at you Xcode)
|
||||||
|
|
||||||
|
add_library(hs_runtime STATIC src/hs_version.c
|
||||||
|
$<TARGET_OBJECTS:hs_exec_common>
|
||||||
|
${RUNTIME_LIBS})
|
||||||
|
set_target_properties(hs_runtime PROPERTIES LINKER_LANGUAGE C)
|
||||||
|
add_library(hs_compile OBJECT ${hs_compile_SRCS})
|
||||||
|
|
||||||
|
# we want the static lib for testing
|
||||||
|
add_library(hs STATIC src/hs_version.c src/hs_valid_platform.c
|
||||||
|
$<TARGET_OBJECTS:hs_compile>
|
||||||
|
$<TARGET_OBJECTS:hs_exec_common>
|
||||||
|
${RUNTIME_LIBS})
|
||||||
|
endif (BUILD_STATIC_LIBS)
|
||||||
|
|
||||||
|
if (BUILD_STATIC_AND_SHARED OR BUILD_SHARED_LIBS)
|
||||||
|
# build shared libs
|
||||||
|
add_library(hs_compile_shared OBJECT ${hs_compile_SRCS})
|
||||||
|
set_target_properties(hs_compile_shared PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
|
||||||
|
add_library(hs_exec_shared_core2 OBJECT ${hs_exec_SRCS})
|
||||||
|
list(APPEND RUNTIME_SHLIBS $<TARGET_OBJECTS:hs_exec_shared_core2>)
|
||||||
|
set_target_properties(hs_exec_shared_core2 PROPERTIES
|
||||||
|
COMPILE_FLAGS "-march=core2 -msse4.2"
|
||||||
|
POSITION_INDEPENDENT_CODE TRUE
|
||||||
|
RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} core2 ${CMAKE_MODULE_PATH}/keep.syms.in"
|
||||||
|
)
|
||||||
|
add_library(hs_exec_shared_corei7 OBJECT ${hs_exec_SRCS})
|
||||||
|
list(APPEND RUNTIME_SHLIBS $<TARGET_OBJECTS:hs_exec_shared_corei7>)
|
||||||
|
set_target_properties(hs_exec_shared_corei7 PROPERTIES
|
||||||
|
COMPILE_FLAGS "-march=corei7 -msse4.2"
|
||||||
|
POSITION_INDEPENDENT_CODE TRUE
|
||||||
|
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})
|
||||||
|
list(APPEND RUNTIME_SHLIBS $<TARGET_OBJECTS:hs_exec_shared_avx2>)
|
||||||
|
set_target_properties(hs_exec_shared_avx2 PROPERTIES
|
||||||
|
COMPILE_FLAGS "-march=core-avx2 -mavx2"
|
||||||
|
POSITION_INDEPENDENT_CODE TRUE
|
||||||
|
RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} avx2 ${CMAKE_MODULE_PATH}/keep.syms.in"
|
||||||
|
)
|
||||||
|
endif (BUILD_AVX2)
|
||||||
|
if (BUILD_AVX512)
|
||||||
|
add_library(hs_exec_shared_avx512 OBJECT ${hs_exec_SRCS} ${hs_exec_avx2_SRCS})
|
||||||
|
list(APPEND RUNTIME_SHLIBS $<TARGET_OBJECTS:hs_exec_shared_avx512>)
|
||||||
|
set_target_properties(hs_exec_shared_avx512 PROPERTIES
|
||||||
|
COMPILE_FLAGS "${SKYLAKE_FLAG}"
|
||||||
|
POSITION_INDEPENDENT_CODE TRUE
|
||||||
|
RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} avx512 ${CMAKE_MODULE_PATH}/keep.syms.in"
|
||||||
|
)
|
||||||
|
endif (BUILD_AVX512)
|
||||||
|
if (BUILD_AVX512VBMI)
|
||||||
|
add_library(hs_exec_shared_avx512vbmi OBJECT ${hs_exec_SRCS} ${hs_exec_avx2_SRCS})
|
||||||
|
list(APPEND RUNTIME_SHLIBS $<TARGET_OBJECTS:hs_exec_shared_avx512vbmi>)
|
||||||
|
set_target_properties(hs_exec_shared_avx512vbmi PROPERTIES
|
||||||
|
COMPILE_FLAGS "${ICELAKE_FLAG}"
|
||||||
|
POSITION_INDEPENDENT_CODE TRUE
|
||||||
|
RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} avx512vbmi ${CMAKE_MODULE_PATH}/keep.syms.in"
|
||||||
|
)
|
||||||
|
endif (BUILD_AVX512VBMI)
|
||||||
|
add_library(hs_exec_common_shared OBJECT
|
||||||
${hs_exec_common_SRCS}
|
${hs_exec_common_SRCS}
|
||||||
src/dispatcher.c
|
src/dispatcher.c
|
||||||
)
|
)
|
||||||
|
set_target_properties(hs_exec_common_shared PROPERTIES
|
||||||
|
OUTPUT_NAME hs_exec_common
|
||||||
|
POSITION_INDEPENDENT_CODE TRUE)
|
||||||
|
|
||||||
# hs_version.c is added explicitly to avoid some build systems that refuse to
|
endif() # SHARED
|
||||||
# create a lib without any src (I'm looking at you Xcode)
|
endif (ARCH_IA32 OR ARCH_X86_64)
|
||||||
|
if (ARCH_AARCH64)
|
||||||
|
set(BUILD_WRAPPER "${PROJECT_SOURCE_DIR}/cmake/build_wrapper.sh")
|
||||||
|
if (BUILD_STATIC_LIBS)
|
||||||
|
add_library(hs_exec_neon OBJECT ${hs_exec_SRCS})
|
||||||
|
list(APPEND RUNTIME_LIBS $<TARGET_OBJECTS:hs_exec_neon>)
|
||||||
|
set_target_properties(hs_exec_neon PROPERTIES
|
||||||
|
COMPILE_FLAGS "-march=armv8-a"
|
||||||
|
RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} neon ${CMAKE_MODULE_PATH}/keep.syms.in"
|
||||||
|
)
|
||||||
|
|
||||||
add_library(hs_runtime STATIC src/hs_version.c
|
if (BUILD_SVE)
|
||||||
$<TARGET_OBJECTS:hs_exec_common>
|
add_library(hs_exec_sve OBJECT ${hs_exec_SRCS} ${hs_exec_sve_SRCS})
|
||||||
${RUNTIME_LIBS})
|
list(APPEND RUNTIME_LIBS $<TARGET_OBJECTS:hs_exec_sve>)
|
||||||
set_target_properties(hs_runtime PROPERTIES LINKER_LANGUAGE C)
|
set_target_properties(hs_exec_sve PROPERTIES
|
||||||
add_library(hs_compile OBJECT ${hs_compile_SRCS})
|
COMPILE_FLAGS "-march=armv8-a+sve"
|
||||||
|
RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} sve ${CMAKE_MODULE_PATH}/keep.syms.in"
|
||||||
|
)
|
||||||
|
endif (BUILD_SVE)
|
||||||
|
if (BUILD_SVE2)
|
||||||
|
add_library(hs_exec_sve2 OBJECT ${hs_exec_SRCS} ${hs_exec_sve2_SRCS})
|
||||||
|
list(APPEND RUNTIME_LIBS $<TARGET_OBJECTS:hs_exec_sve2>)
|
||||||
|
set_target_properties(hs_exec_sve2 PROPERTIES
|
||||||
|
COMPILE_FLAGS "-march=armv8-a+sve2"
|
||||||
|
RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} sve2 ${CMAKE_MODULE_PATH}/keep.syms.in"
|
||||||
|
)
|
||||||
|
endif (BUILD_SVE2)
|
||||||
|
|
||||||
# we want the static lib for testing
|
add_library(hs_exec_common OBJECT
|
||||||
add_library(hs STATIC src/hs_version.c src/hs_valid_platform.c
|
${hs_exec_common_SRCS}
|
||||||
$<TARGET_OBJECTS:hs_compile>
|
src/dispatcher.c
|
||||||
$<TARGET_OBJECTS:hs_exec_common>
|
)
|
||||||
${RUNTIME_LIBS})
|
|
||||||
|
|
||||||
endif (BUILD_STATIC_LIBS)
|
# hs_version.c is added explicitly to avoid some build systems that refuse to
|
||||||
|
# create a lib without any src (I'm looking at you Xcode)
|
||||||
|
|
||||||
if (BUILD_STATIC_AND_SHARED OR BUILD_SHARED_LIBS)
|
add_library(hs_runtime STATIC src/hs_version.c
|
||||||
# build shared libs
|
$<TARGET_OBJECTS:hs_exec_common>
|
||||||
add_library(hs_compile_shared OBJECT ${hs_compile_SRCS})
|
${RUNTIME_LIBS})
|
||||||
set_target_properties(hs_compile_shared PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
|
set_target_properties(hs_runtime PROPERTIES LINKER_LANGUAGE C)
|
||||||
add_library(hs_exec_shared_core2 OBJECT ${hs_exec_SRCS})
|
add_library(hs_compile OBJECT ${hs_compile_SRCS})
|
||||||
list(APPEND RUNTIME_SHLIBS $<TARGET_OBJECTS:hs_exec_shared_core2>)
|
|
||||||
set_target_properties(hs_exec_shared_core2 PROPERTIES
|
# we want the static lib for testing
|
||||||
COMPILE_FLAGS "-march=core2 -msse4.2"
|
add_library(hs STATIC src/hs_version.c src/hs_valid_platform.c
|
||||||
POSITION_INDEPENDENT_CODE TRUE
|
$<TARGET_OBJECTS:hs_compile>
|
||||||
RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} core2 ${CMAKE_MODULE_PATH}/keep.syms.in"
|
$<TARGET_OBJECTS:hs_exec_common>
|
||||||
|
${RUNTIME_LIBS})
|
||||||
|
endif (BUILD_STATIC_LIBS)
|
||||||
|
|
||||||
|
if (BUILD_STATIC_AND_SHARED OR BUILD_SHARED_LIBS)
|
||||||
|
# build shared libs
|
||||||
|
add_library(hs_compile_shared OBJECT ${hs_compile_SRCS})
|
||||||
|
set_target_properties(hs_compile_shared PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
|
||||||
|
add_library(hs_exec_shared_neon OBJECT ${hs_exec_SRCS})
|
||||||
|
list(APPEND RUNTIME_SHLIBS $<TARGET_OBJECTS:hs_exec_shared_neon>)
|
||||||
|
set_target_properties(hs_exec_shared_neon PROPERTIES
|
||||||
|
COMPILE_FLAGS "-march=armv8-a"
|
||||||
|
POSITION_INDEPENDENT_CODE TRUE
|
||||||
|
RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} neon ${CMAKE_MODULE_PATH}/keep.syms.in"
|
||||||
|
)
|
||||||
|
|
||||||
|
if (BUILD_SVE)
|
||||||
|
add_library(hs_exec_shared_sve OBJECT ${hs_exec_SRCS} ${hs_exec_sve_SRCS})
|
||||||
|
list(APPEND RUNTIME_SHLIBS $<TARGET_OBJECTS:hs_exec_shared_sve>)
|
||||||
|
set_target_properties(hs_exec_shared_sve PROPERTIES
|
||||||
|
COMPILE_FLAGS "-march=armv8-a+sve"
|
||||||
|
POSITION_INDEPENDENT_CODE TRUE
|
||||||
|
RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} sve ${CMAKE_MODULE_PATH}/keep.syms.in"
|
||||||
|
)
|
||||||
|
endif (BUILD_SVE)
|
||||||
|
if (BUILD_SVE2)
|
||||||
|
add_library(hs_exec_shared_sve2 OBJECT ${hs_exec_SRCS} ${hs_exec_sve2_SRCS})
|
||||||
|
list(APPEND RUNTIME_SHLIBS $<TARGET_OBJECTS:hs_exec_shared_sve2>)
|
||||||
|
set_target_properties(hs_exec_shared_sve2 PROPERTIES
|
||||||
|
COMPILE_FLAGS "-march=armv8-a+sve2"
|
||||||
|
POSITION_INDEPENDENT_CODE TRUE
|
||||||
|
RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} sve2 ${CMAKE_MODULE_PATH}/keep.syms.in"
|
||||||
|
)
|
||||||
|
endif (BUILD_SVE2)
|
||||||
|
add_library(hs_exec_common_shared OBJECT
|
||||||
|
${hs_exec_common_SRCS}
|
||||||
|
src/dispatcher.c
|
||||||
)
|
)
|
||||||
add_library(hs_exec_shared_corei7 OBJECT ${hs_exec_SRCS})
|
set_target_properties(hs_exec_common_shared PROPERTIES
|
||||||
list(APPEND RUNTIME_SHLIBS $<TARGET_OBJECTS:hs_exec_shared_corei7>)
|
OUTPUT_NAME hs_exec_common
|
||||||
set_target_properties(hs_exec_shared_corei7 PROPERTIES
|
POSITION_INDEPENDENT_CODE TRUE)
|
||||||
COMPILE_FLAGS "-march=corei7 -msse4.2"
|
endif() # SHARED
|
||||||
POSITION_INDEPENDENT_CODE TRUE
|
endif (ARCH_AARCH64)
|
||||||
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})
|
|
||||||
list(APPEND RUNTIME_SHLIBS $<TARGET_OBJECTS:hs_exec_shared_avx2>)
|
|
||||||
set_target_properties(hs_exec_shared_avx2 PROPERTIES
|
|
||||||
COMPILE_FLAGS "-march=core-avx2 -mavx2"
|
|
||||||
POSITION_INDEPENDENT_CODE TRUE
|
|
||||||
RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} avx2 ${CMAKE_MODULE_PATH}/keep.syms.in"
|
|
||||||
)
|
|
||||||
endif (BUILD_AVX2)
|
|
||||||
if (BUILD_AVX512)
|
|
||||||
add_library(hs_exec_shared_avx512 OBJECT ${hs_exec_SRCS} ${hs_exec_avx2_SRCS})
|
|
||||||
list(APPEND RUNTIME_SHLIBS $<TARGET_OBJECTS:hs_exec_shared_avx512>)
|
|
||||||
set_target_properties(hs_exec_shared_avx512 PROPERTIES
|
|
||||||
COMPILE_FLAGS "${SKYLAKE_FLAG}"
|
|
||||||
POSITION_INDEPENDENT_CODE TRUE
|
|
||||||
RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} avx512 ${CMAKE_MODULE_PATH}/keep.syms.in"
|
|
||||||
)
|
|
||||||
endif (BUILD_AVX512)
|
|
||||||
if (BUILD_AVX512VBMI)
|
|
||||||
add_library(hs_exec_shared_avx512vbmi OBJECT ${hs_exec_SRCS} ${hs_exec_avx2_SRCS})
|
|
||||||
list(APPEND RUNTIME_SHLIBS $<TARGET_OBJECTS:hs_exec_shared_avx512vbmi>)
|
|
||||||
set_target_properties(hs_exec_shared_avx512vbmi PROPERTIES
|
|
||||||
COMPILE_FLAGS "${ICELAKE_FLAG}"
|
|
||||||
POSITION_INDEPENDENT_CODE TRUE
|
|
||||||
RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} avx512vbmi ${CMAKE_MODULE_PATH}/keep.syms.in"
|
|
||||||
)
|
|
||||||
endif (BUILD_AVX512VBMI)
|
|
||||||
add_library(hs_exec_common_shared OBJECT
|
|
||||||
${hs_exec_common_SRCS}
|
|
||||||
src/dispatcher.c
|
|
||||||
)
|
|
||||||
set_target_properties(hs_exec_common_shared PROPERTIES
|
|
||||||
OUTPUT_NAME hs_exec_common
|
|
||||||
POSITION_INDEPENDENT_CODE TRUE)
|
|
||||||
endif() # SHARED
|
|
||||||
|
|
||||||
|
|
||||||
endif (NOT FAT_RUNTIME)
|
endif (NOT FAT_RUNTIME)
|
||||||
|
|
||||||
if (NOT BUILD_SHARED_LIBS)
|
if (NOT BUILD_SHARED_LIBS)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2020, Intel Corporation
|
* Copyright (c) 2018-2022, Intel Corporation
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
@ -8,7 +8,6 @@ elseif (HAVE_C_INTRIN_H)
|
|||||||
set (INTRIN_INC_H "intrin.h")
|
set (INTRIN_INC_H "intrin.h")
|
||||||
elseif (HAVE_C_ARM_NEON_H)
|
elseif (HAVE_C_ARM_NEON_H)
|
||||||
set (INTRIN_INC_H "arm_neon.h")
|
set (INTRIN_INC_H "arm_neon.h")
|
||||||
set (FAT_RUNTIME OFF)
|
|
||||||
elseif (HAVE_C_PPC64EL_ALTIVEC_H)
|
elseif (HAVE_C_PPC64EL_ALTIVEC_H)
|
||||||
set (INTRIN_INC_H "altivec.h")
|
set (INTRIN_INC_H "altivec.h")
|
||||||
set (FAT_RUNTIME OFF)
|
set (FAT_RUNTIME OFF)
|
||||||
@ -77,21 +76,30 @@ if (BUILD_AVX512VBMI)
|
|||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (FAT_RUNTIME)
|
if (FAT_RUNTIME)
|
||||||
if (NOT DEFINED(BUILD_AVX2))
|
if (ARCH_IA32 OR ARCH_X86_64)
|
||||||
set(BUILD_AVX2 TRUE)
|
if (NOT DEFINED(BUILD_AVX2))
|
||||||
endif ()
|
set(BUILD_AVX2 TRUE)
|
||||||
# test the highest level microarch to make sure everything works
|
endif ()
|
||||||
if (BUILD_AVX512)
|
# test the highest level microarch to make sure everything works
|
||||||
if (BUILD_AVX512VBMI)
|
if (BUILD_AVX512)
|
||||||
set (CMAKE_REQUIRED_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_C_FLAGS} ${ICELAKE_FLAG}")
|
if (BUILD_AVX512VBMI)
|
||||||
else ()
|
set (CMAKE_REQUIRED_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_C_FLAGS} ${ICELAKE_FLAG}")
|
||||||
set (CMAKE_REQUIRED_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_C_FLAGS} ${SKYLAKE_FLAG}")
|
else ()
|
||||||
endif (BUILD_AVX512VBMI)
|
set (CMAKE_REQUIRED_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_C_FLAGS} ${SKYLAKE_FLAG}")
|
||||||
elseif (BUILD_AVX2)
|
endif (BUILD_AVX512VBMI)
|
||||||
set (CMAKE_REQUIRED_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_C_FLAGS} -march=core-avx2 -mavx2")
|
elseif (BUILD_AVX2)
|
||||||
elseif ()
|
set (CMAKE_REQUIRED_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_C_FLAGS} -march=core-avx2 -mavx2")
|
||||||
set (CMAKE_REQUIRED_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_C_FLAGS} -march=core-i7 -mssse3")
|
elseif ()
|
||||||
endif ()
|
set (CMAKE_REQUIRED_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_C_FLAGS} -march=core-i7 -mssse3")
|
||||||
|
endif ()
|
||||||
|
elseif(ARCH_AARCH64)
|
||||||
|
if (NOT DEFINED(BUILD_SVE))
|
||||||
|
set(BUILD_SVE TRUE)
|
||||||
|
endif ()
|
||||||
|
if (NOT DEFINED(BUILD_SVE2))
|
||||||
|
set(BUILD_SVE2 TRUE)
|
||||||
|
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
|
||||||
set (CMAKE_REQUIRED_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_C_FLAGS} ${ARCH_C_FLAGS}")
|
set (CMAKE_REQUIRED_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_C_FLAGS} ${ARCH_C_FLAGS}")
|
||||||
|
@ -32,7 +32,6 @@
|
|||||||
#include "ue2common.h"
|
#include "ue2common.h"
|
||||||
#if defined(ARCH_IA32) || defined(ARCH_X86_64)
|
#if defined(ARCH_IA32) || defined(ARCH_X86_64)
|
||||||
#include "util/arch/x86/cpuid_inline.h"
|
#include "util/arch/x86/cpuid_inline.h"
|
||||||
#endif
|
|
||||||
#include "util/join.h"
|
#include "util/join.h"
|
||||||
|
|
||||||
#if defined(DISABLE_AVX512_DISPATCH)
|
#if defined(DISABLE_AVX512_DISPATCH)
|
||||||
@ -83,6 +82,41 @@
|
|||||||
HS_PUBLIC_API \
|
HS_PUBLIC_API \
|
||||||
RTYPE NAME(__VA_ARGS__) __attribute__((ifunc("resolve_" #NAME)))
|
RTYPE NAME(__VA_ARGS__) __attribute__((ifunc("resolve_" #NAME)))
|
||||||
|
|
||||||
|
#elif defined(ARCH_AARCH64)
|
||||||
|
#include "util/arch/arm/cpuid_inline.h"
|
||||||
|
#include "util/join.h"
|
||||||
|
|
||||||
|
#define CREATE_DISPATCH(RTYPE, NAME, ...) \
|
||||||
|
/* create defns */ \
|
||||||
|
RTYPE JOIN(sve2_, NAME)(__VA_ARGS__); \
|
||||||
|
RTYPE JOIN(sve_, NAME)(__VA_ARGS__); \
|
||||||
|
RTYPE JOIN(neon_, NAME)(__VA_ARGS__); \
|
||||||
|
\
|
||||||
|
/* error func */ \
|
||||||
|
static inline RTYPE JOIN(error_, NAME)(__VA_ARGS__) { \
|
||||||
|
return (RTYPE)HS_ARCH_ERROR; \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
/* resolver */ \
|
||||||
|
static RTYPE (*JOIN(resolve_, NAME)(void))(__VA_ARGS__) { \
|
||||||
|
if (check_sve2()) { \
|
||||||
|
return JOIN(sve2_, NAME); \
|
||||||
|
} \
|
||||||
|
if (check_sve()) { \
|
||||||
|
return JOIN(sve_, NAME); \
|
||||||
|
} \
|
||||||
|
if (check_neon()) { \
|
||||||
|
return JOIN(neon_, NAME); \
|
||||||
|
} \
|
||||||
|
/* anything else is fail */ \
|
||||||
|
return JOIN(error_, NAME); \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
/* function */ \
|
||||||
|
HS_PUBLIC_API \
|
||||||
|
RTYPE NAME(__VA_ARGS__) __attribute__((ifunc("resolve_" #NAME)))
|
||||||
|
|
||||||
|
#endif
|
||||||
CREATE_DISPATCH(hs_error_t, hs_scan, const hs_database_t *db, const char *data,
|
CREATE_DISPATCH(hs_error_t, hs_scan, const hs_database_t *db, const char *data,
|
||||||
unsigned length, unsigned flags, hs_scratch_t *scratch,
|
unsigned length, unsigned flags, hs_scratch_t *scratch,
|
||||||
match_event_handler onEvent, void *userCtx);
|
match_event_handler onEvent, void *userCtx);
|
||||||
|
@ -199,11 +199,13 @@ hs_compile_multi_int(const char *const *expressions, const unsigned *flags,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined(FAT_RUNTIME)
|
#if defined(FAT_RUNTIME)
|
||||||
|
#if defined(ARCH_IA32) || defined(ARCH_X86_64)
|
||||||
if (!check_ssse3()) {
|
if (!check_ssse3()) {
|
||||||
*db = nullptr;
|
*db = nullptr;
|
||||||
*comp_error = generateCompileError("Unsupported architecture", -1);
|
*comp_error = generateCompileError("Unsupported architecture", -1);
|
||||||
return HS_ARCH_ERROR;
|
return HS_ARCH_ERROR;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!checkMode(mode, comp_error)) {
|
if (!checkMode(mode, comp_error)) {
|
||||||
@ -320,13 +322,14 @@ hs_compile_lit_multi_int(const char *const *expressions, const unsigned *flags,
|
|||||||
*comp_error = generateCompileError("Invalid parameter: elements is zero", -1);
|
*comp_error = generateCompileError("Invalid parameter: elements is zero", -1);
|
||||||
return HS_COMPILER_ERROR;
|
return HS_COMPILER_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(FAT_RUNTIME)
|
#if defined(FAT_RUNTIME)
|
||||||
|
#if defined(ARCH_IA32) || defined(ARCH_X86_64)
|
||||||
if (!check_ssse3()) {
|
if (!check_ssse3()) {
|
||||||
*db = nullptr;
|
*db = nullptr;
|
||||||
*comp_error = generateCompileError("Unsupported architecture", -1);
|
*comp_error = generateCompileError("Unsupported architecture", -1);
|
||||||
return HS_ARCH_ERROR;
|
return HS_ARCH_ERROR;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!checkMode(mode, comp_error)) {
|
if (!checkMode(mode, comp_error)) {
|
||||||
@ -500,10 +503,12 @@ hs_error_t hs_expression_info_int(const char *expression, unsigned int flags,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined(FAT_RUNTIME)
|
#if defined(FAT_RUNTIME)
|
||||||
|
#if defined(ARCH_IA32) || defined(ARCH_X86_64)
|
||||||
if (!check_ssse3()) {
|
if (!check_ssse3()) {
|
||||||
*error = generateCompileError("Unsupported architecture", -1);
|
*error = generateCompileError("Unsupported architecture", -1);
|
||||||
return HS_ARCH_ERROR;
|
return HS_ARCH_ERROR;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!info) {
|
if (!info) {
|
||||||
@ -631,9 +636,11 @@ hs_error_t HS_CDECL hs_populate_platform(hs_platform_info_t *platform) {
|
|||||||
extern "C" HS_PUBLIC_API
|
extern "C" HS_PUBLIC_API
|
||||||
hs_error_t HS_CDECL hs_free_compile_error(hs_compile_error_t *error) {
|
hs_error_t HS_CDECL hs_free_compile_error(hs_compile_error_t *error) {
|
||||||
#if defined(FAT_RUNTIME)
|
#if defined(FAT_RUNTIME)
|
||||||
|
#if defined(ARCH_IA32) || defined(ARCH_X86_64)
|
||||||
if (!check_ssse3()) {
|
if (!check_ssse3()) {
|
||||||
return HS_ARCH_ERROR;
|
return HS_ARCH_ERROR;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
freeCompileError(error);
|
freeCompileError(error);
|
||||||
return HS_SUCCESS;
|
return HS_SUCCESS;
|
||||||
|
@ -31,6 +31,8 @@
|
|||||||
#include "ue2common.h"
|
#include "ue2common.h"
|
||||||
#if defined(ARCH_IA32) || defined(ARCH_X86_64)
|
#if defined(ARCH_IA32) || defined(ARCH_X86_64)
|
||||||
#include "util/arch/x86/cpuid_inline.h"
|
#include "util/arch/x86/cpuid_inline.h"
|
||||||
|
#elif defined(ARCH_AARCH64)
|
||||||
|
#include "util/arch/arm/cpuid_inline.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
HS_PUBLIC_API
|
HS_PUBLIC_API
|
||||||
@ -43,7 +45,11 @@ hs_error_t HS_CDECL hs_valid_platform(void) {
|
|||||||
return HS_ARCH_ERROR;
|
return HS_ARCH_ERROR;
|
||||||
}
|
}
|
||||||
#elif defined(ARCH_ARM32) || defined(ARCH_AARCH64)
|
#elif defined(ARCH_ARM32) || defined(ARCH_AARCH64)
|
||||||
return HS_SUCCESS;
|
if (check_neon()) {
|
||||||
|
return HS_SUCCESS;
|
||||||
|
} else {
|
||||||
|
return HS_ARCH_ERROR;
|
||||||
|
}
|
||||||
#elif defined(ARCH_PPC64EL)
|
#elif defined(ARCH_PPC64EL)
|
||||||
return HS_SUCCESS;
|
return HS_SUCCESS;
|
||||||
#endif
|
#endif
|
||||||
|
@ -206,6 +206,10 @@ void makeCFG_top_edge(GoughGraph &cfg, const vector<GoughVertex> &vertices,
|
|||||||
assert(contains(src_slots, slot_id));
|
assert(contains(src_slots, slot_id));
|
||||||
|
|
||||||
shared_ptr<GoughSSAVarMin> vmin = make_shared<GoughSSAVarMin>();
|
shared_ptr<GoughSSAVarMin> vmin = make_shared<GoughSSAVarMin>();
|
||||||
|
if (!vmin) {
|
||||||
|
assert(0);
|
||||||
|
throw std::bad_alloc();
|
||||||
|
}
|
||||||
cfg[e].vars.emplace_back(vmin);
|
cfg[e].vars.emplace_back(vmin);
|
||||||
final_var = vmin.get();
|
final_var = vmin.get();
|
||||||
|
|
||||||
@ -317,6 +321,10 @@ void makeCFG_edge(GoughGraph &cfg, const map<u32, u32> &som_creators,
|
|||||||
DEBUG_PRINTF("bypassing min on join %u\n", slot_id);
|
DEBUG_PRINTF("bypassing min on join %u\n", slot_id);
|
||||||
} else {
|
} else {
|
||||||
shared_ptr<GoughSSAVarMin> vmin = make_shared<GoughSSAVarMin>();
|
shared_ptr<GoughSSAVarMin> vmin = make_shared<GoughSSAVarMin>();
|
||||||
|
if (!vmin) {
|
||||||
|
assert(0);
|
||||||
|
throw std::bad_alloc();
|
||||||
|
}
|
||||||
cfg[e].vars.emplace_back(vmin);
|
cfg[e].vars.emplace_back(vmin);
|
||||||
final_var = vmin.get();
|
final_var = vmin.get();
|
||||||
|
|
||||||
|
@ -124,6 +124,10 @@ RepeatStateInfo::RepeatStateInfo(enum RepeatType type, const depth &repeatMin,
|
|||||||
const depth &repeatMax, u32 minPeriod)
|
const depth &repeatMax, u32 minPeriod)
|
||||||
: stateSize(0), packedCtrlSize(0), horizon(0), patchCount(0),
|
: stateSize(0), packedCtrlSize(0), horizon(0), patchCount(0),
|
||||||
patchSize(0), encodingSize(0), patchesOffset(0) {
|
patchSize(0), encodingSize(0), patchesOffset(0) {
|
||||||
|
if (type == REPEAT_SPARSE_OPTIMAL_P && minPeriod == 0) {
|
||||||
|
assert(0);
|
||||||
|
throw std::domain_error("SPARSE_OPTIMAL_P must have non-zero minPeriod.");
|
||||||
|
}
|
||||||
assert(repeatMin <= repeatMax);
|
assert(repeatMin <= repeatMax);
|
||||||
assert(repeatMax.is_reachable());
|
assert(repeatMax.is_reachable());
|
||||||
assert(minPeriod || type != REPEAT_SPARSE_OPTIMAL_P);
|
assert(minPeriod || type != REPEAT_SPARSE_OPTIMAL_P);
|
||||||
|
@ -2445,6 +2445,10 @@ static
|
|||||||
bool doLitHaigSom(NG &ng, NGHolder &g, som_type som) {
|
bool doLitHaigSom(NG &ng, NGHolder &g, som_type som) {
|
||||||
ue2_literal lit;
|
ue2_literal lit;
|
||||||
shared_ptr<NGHolder> rhs = make_shared<NGHolder>();
|
shared_ptr<NGHolder> rhs = make_shared<NGHolder>();
|
||||||
|
if (!rhs) {
|
||||||
|
assert(0);
|
||||||
|
throw std::bad_alloc();
|
||||||
|
}
|
||||||
if (!ng.cc.grey.allowLitHaig) {
|
if (!ng.cc.grey.allowLitHaig) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -2509,6 +2513,11 @@ bool doHaigLitHaigSom(NG &ng, NGHolder &g,
|
|||||||
ue2_literal lit;
|
ue2_literal lit;
|
||||||
shared_ptr<NGHolder> rhs = make_shared<NGHolder>();
|
shared_ptr<NGHolder> rhs = make_shared<NGHolder>();
|
||||||
shared_ptr<NGHolder> lhs = make_shared<NGHolder>();
|
shared_ptr<NGHolder> lhs = make_shared<NGHolder>();
|
||||||
|
if (!rhs || !lhs) {
|
||||||
|
assert(0);
|
||||||
|
throw std::bad_alloc();
|
||||||
|
}
|
||||||
|
|
||||||
if (!splitOffBestLiteral(g, regions, &lit, &*lhs, &*rhs, ng.cc)) {
|
if (!splitOffBestLiteral(g, regions, &lit, &*lhs, &*rhs, ng.cc)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1036,6 +1036,11 @@ bool splitRoseEdge(const NGHolder &base_graph, RoseInGraph &vg,
|
|||||||
shared_ptr<NGHolder> lhs = make_shared<NGHolder>();
|
shared_ptr<NGHolder> lhs = make_shared<NGHolder>();
|
||||||
shared_ptr<NGHolder> rhs = make_shared<NGHolder>();
|
shared_ptr<NGHolder> rhs = make_shared<NGHolder>();
|
||||||
|
|
||||||
|
if (!lhs || !rhs) {
|
||||||
|
assert(0);
|
||||||
|
throw std::bad_alloc();
|
||||||
|
}
|
||||||
|
|
||||||
unordered_map<NFAVertex, NFAVertex> lhs_map;
|
unordered_map<NFAVertex, NFAVertex> lhs_map;
|
||||||
unordered_map<NFAVertex, NFAVertex> rhs_map;
|
unordered_map<NFAVertex, NFAVertex> rhs_map;
|
||||||
|
|
||||||
@ -1229,6 +1234,10 @@ void splitEdgesByCut(NGHolder &h, RoseInGraph &vg,
|
|||||||
DEBUG_PRINTF("splitting on pivot %zu\n", h[pivot].index);
|
DEBUG_PRINTF("splitting on pivot %zu\n", h[pivot].index);
|
||||||
unordered_map<NFAVertex, NFAVertex> temp_map;
|
unordered_map<NFAVertex, NFAVertex> temp_map;
|
||||||
shared_ptr<NGHolder> new_lhs = make_shared<NGHolder>();
|
shared_ptr<NGHolder> new_lhs = make_shared<NGHolder>();
|
||||||
|
if (!new_lhs) {
|
||||||
|
assert(0);
|
||||||
|
throw std::bad_alloc();
|
||||||
|
}
|
||||||
splitLHS(h, pivot, new_lhs.get(), &temp_map);
|
splitLHS(h, pivot, new_lhs.get(), &temp_map);
|
||||||
|
|
||||||
/* want to cut off paths to pivot from things other than the pivot -
|
/* want to cut off paths to pivot from things other than the pivot -
|
||||||
@ -1310,6 +1319,10 @@ void splitEdgesByCut(NGHolder &h, RoseInGraph &vg,
|
|||||||
if (!contains(done_rhs, adj)) {
|
if (!contains(done_rhs, adj)) {
|
||||||
unordered_map<NFAVertex, NFAVertex> temp_map;
|
unordered_map<NFAVertex, NFAVertex> temp_map;
|
||||||
shared_ptr<NGHolder> new_rhs = make_shared<NGHolder>();
|
shared_ptr<NGHolder> new_rhs = make_shared<NGHolder>();
|
||||||
|
if (!new_rhs) {
|
||||||
|
assert(0);
|
||||||
|
throw std::bad_alloc();
|
||||||
|
}
|
||||||
splitRHS(h, adj, new_rhs.get(), &temp_map);
|
splitRHS(h, adj, new_rhs.get(), &temp_map);
|
||||||
remove_edge(new_rhs->start, new_rhs->accept, *new_rhs);
|
remove_edge(new_rhs->start, new_rhs->accept, *new_rhs);
|
||||||
remove_edge(new_rhs->start, new_rhs->acceptEod, *new_rhs);
|
remove_edge(new_rhs->start, new_rhs->acceptEod, *new_rhs);
|
||||||
@ -2281,6 +2294,10 @@ void splitEdgesForSuffix(const NGHolder &base_graph, RoseInGraph &vg,
|
|||||||
assert(!splitters.empty());
|
assert(!splitters.empty());
|
||||||
|
|
||||||
shared_ptr<NGHolder> lhs = make_shared<NGHolder>();
|
shared_ptr<NGHolder> lhs = make_shared<NGHolder>();
|
||||||
|
if (!lhs) {
|
||||||
|
assert(0);
|
||||||
|
throw bad_alloc();
|
||||||
|
}
|
||||||
unordered_map<NFAVertex, NFAVertex> v_map;
|
unordered_map<NFAVertex, NFAVertex> v_map;
|
||||||
cloneHolder(*lhs, base_graph, &v_map);
|
cloneHolder(*lhs, base_graph, &v_map);
|
||||||
lhs->kind = NFA_INFIX;
|
lhs->kind = NFA_INFIX;
|
||||||
|
@ -140,7 +140,8 @@ void ParsedLogical::validateSubIDs(const unsigned *ids,
|
|||||||
}
|
}
|
||||||
hs_compile_error_t *compile_err = NULL;
|
hs_compile_error_t *compile_err = NULL;
|
||||||
hs_expr_info_t *info = NULL;
|
hs_expr_info_t *info = NULL;
|
||||||
hs_error_t err = hs_expression_info(expressions[i], flags[i], &info,
|
hs_error_t err = hs_expression_info(expressions[i],
|
||||||
|
flags ? flags[i] : 0, &info,
|
||||||
&compile_err);
|
&compile_err);
|
||||||
if (err != HS_SUCCESS) {
|
if (err != HS_SUCCESS) {
|
||||||
hs_free_compile_error(compile_err);
|
hs_free_compile_error(compile_err);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, Intel Corporation
|
* Copyright (c) 2015-2022, Intel Corporation
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
@ -72,7 +72,7 @@ bool isValidUtf8(const char *expression, const size_t len) {
|
|||||||
while (i < len) {
|
while (i < len) {
|
||||||
DEBUG_PRINTF("byte %zu: 0x%02x\n", i, s[i]);
|
DEBUG_PRINTF("byte %zu: 0x%02x\n", i, s[i]);
|
||||||
// One octet.
|
// One octet.
|
||||||
if (s[i] < 0x7f) {
|
if (s[i] <= 0x7f) {
|
||||||
DEBUG_PRINTF("one octet\n");
|
DEBUG_PRINTF("one octet\n");
|
||||||
i++;
|
i++;
|
||||||
continue;
|
continue;
|
||||||
|
@ -959,7 +959,7 @@ m128 getData128(const struct core_info *ci, s64a offset, u32 *valid_data_mask) {
|
|||||||
*valid_data_mask = 0xffff;
|
*valid_data_mask = 0xffff;
|
||||||
return loadu128(ci->buf + offset);
|
return loadu128(ci->buf + offset);
|
||||||
}
|
}
|
||||||
ALIGN_DIRECTIVE u8 data[sizeof(m128)];
|
ALIGN_DIRECTIVE u8 data[sizeof(m128)] = { 0 };
|
||||||
*valid_data_mask = getBufferDataComplex(ci, offset, data, 16);
|
*valid_data_mask = getBufferDataComplex(ci, offset, data, 16);
|
||||||
return *(m128 *)data;
|
return *(m128 *)data;
|
||||||
}
|
}
|
||||||
|
@ -561,6 +561,10 @@ bool handleMixedPrefixCliche(const NGHolder &h, RoseGraph &g, RoseVertex v,
|
|||||||
DEBUG_PRINTF("woot?\n");
|
DEBUG_PRINTF("woot?\n");
|
||||||
|
|
||||||
shared_ptr<NGHolder> h_new = make_shared<NGHolder>();
|
shared_ptr<NGHolder> h_new = make_shared<NGHolder>();
|
||||||
|
if (!h_new) {
|
||||||
|
assert(0);
|
||||||
|
throw std::bad_alloc();
|
||||||
|
}
|
||||||
unordered_map<NFAVertex, NFAVertex> rhs_map;
|
unordered_map<NFAVertex, NFAVertex> rhs_map;
|
||||||
vector<NFAVertex> exits_vec;
|
vector<NFAVertex> exits_vec;
|
||||||
insert(&exits_vec, exits_vec.end(), exits);
|
insert(&exits_vec, exits_vec.end(), exits);
|
||||||
|
@ -204,6 +204,15 @@ void RoseProgram::add_block(RoseProgram &&block) {
|
|||||||
make_move_iterator(block.prog.end()));
|
make_move_iterator(block.prog.end()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class Iter>
|
||||||
|
void RoseProgram::replace(Iter it, std::unique_ptr<RoseInstruction> ri) {
|
||||||
|
assert(!prog.empty());
|
||||||
|
|
||||||
|
const RoseInstruction *old_ptr = it->get();
|
||||||
|
*it = move(ri);
|
||||||
|
update_targets(prog.begin(), prog.end(), old_ptr, it->get());
|
||||||
|
}
|
||||||
|
|
||||||
bytecode_ptr<char> writeProgram(RoseEngineBlob &blob,
|
bytecode_ptr<char> writeProgram(RoseEngineBlob &blob,
|
||||||
const RoseProgram &program) {
|
const RoseProgram &program) {
|
||||||
u32 total_len = 0;
|
u32 total_len = 0;
|
||||||
|
@ -124,13 +124,7 @@ public:
|
|||||||
* \brief Replace the instruction pointed to by the given iterator.
|
* \brief Replace the instruction pointed to by the given iterator.
|
||||||
*/
|
*/
|
||||||
template<class Iter>
|
template<class Iter>
|
||||||
void replace(Iter it, std::unique_ptr<RoseInstruction> ri) {
|
void replace(Iter it, std::unique_ptr<RoseInstruction> ri);
|
||||||
assert(!prog.empty());
|
|
||||||
|
|
||||||
const RoseInstruction *old_ptr = it->get();
|
|
||||||
*it = move(ri);
|
|
||||||
update_targets(prog.begin(), prog.end(), old_ptr, it->get());
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
bytecode_ptr<char> writeProgram(RoseEngineBlob &blob,
|
bytecode_ptr<char> writeProgram(RoseEngineBlob &blob,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2015-2019, Intel Corporation
|
* Copyright (c) 2015-2022, Intel Corporation
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
@ -1013,6 +1013,7 @@ hs_error_t HS_CDECL hs_close_stream(hs_stream_t *id, hs_scratch_t *scratch,
|
|||||||
report_eod_matches(id, scratch, onEvent, context);
|
report_eod_matches(id, scratch, onEvent, context);
|
||||||
if (unlikely(internal_matching_error(scratch))) {
|
if (unlikely(internal_matching_error(scratch))) {
|
||||||
unmarkScratchInUse(scratch);
|
unmarkScratchInUse(scratch);
|
||||||
|
hs_stream_free(id);
|
||||||
return HS_UNKNOWN_ERROR;
|
return HS_UNKNOWN_ERROR;
|
||||||
}
|
}
|
||||||
unmarkScratchInUse(scratch);
|
unmarkScratchInUse(scratch);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2015-2019, Intel Corporation
|
* Copyright (c) 2015-2023, Intel Corporation
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2015-2019, Intel Corporation
|
* Copyright (c) 2015-2023, Intel Corporation
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
@ -77,7 +77,7 @@ namespace ue2 {
|
|||||||
struct LitTrieVertexProps {
|
struct LitTrieVertexProps {
|
||||||
LitTrieVertexProps() = default;
|
LitTrieVertexProps() = default;
|
||||||
explicit LitTrieVertexProps(u8 c_in) : c(c_in) {}
|
explicit LitTrieVertexProps(u8 c_in) : c(c_in) {}
|
||||||
size_t index; // managed by ue2_graph
|
size_t index = 0; // managed by ue2_graph
|
||||||
u8 c = 0; //!< character reached on this vertex
|
u8 c = 0; //!< character reached on this vertex
|
||||||
flat_set<ReportID> reports; //!< managed reports fired on this vertex
|
flat_set<ReportID> reports; //!< managed reports fired on this vertex
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, Intel Corporation
|
* Copyright (c) 2015-2023, Intel Corporation
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2017-2018, Intel Corporation
|
* Copyright (c) 2017-2023, Intel Corporation
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
@ -73,7 +73,9 @@ typedef u32 ReportID;
|
|||||||
|
|
||||||
/* Shorthand for attribute to mark a function as part of our public API.
|
/* Shorthand for attribute to mark a function as part of our public API.
|
||||||
* Functions without this attribute will be hidden. */
|
* Functions without this attribute will be hidden. */
|
||||||
|
#ifndef HS_PUBLIC_API
|
||||||
#define HS_PUBLIC_API __attribute__((visibility("default")))
|
#define HS_PUBLIC_API __attribute__((visibility("default")))
|
||||||
|
#endif
|
||||||
|
|
||||||
#define ARRAY_LENGTH(a) (sizeof(a)/sizeof((a)[0]))
|
#define ARRAY_LENGTH(a) (sizeof(a)/sizeof((a)[0]))
|
||||||
|
|
||||||
|
61
src/util/arch/arm/cpuid_inline.h
Normal file
61
src/util/arch/arm/cpuid_inline.h
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017-2020, Intel Corporation
|
||||||
|
* Copyright (c) 2023, VectorCamp PC
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* * Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of Intel Corporation nor the names of its contributors
|
||||||
|
* may be used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef AARCH64_CPUID_INLINE_H_
|
||||||
|
#define AARCH64_CPUID_INLINE_H_
|
||||||
|
|
||||||
|
#include <sys/auxv.h>
|
||||||
|
|
||||||
|
#include "ue2common.h"
|
||||||
|
#include "util/arch/common/cpuid_flags.h"
|
||||||
|
|
||||||
|
static inline
|
||||||
|
int check_neon(void) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline
|
||||||
|
int check_sve(void) {
|
||||||
|
unsigned long hwcap = getauxval(AT_HWCAP);
|
||||||
|
if (hwcap & HWCAP_SVE) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline
|
||||||
|
int check_sve2(void) {
|
||||||
|
unsigned long hwcap2 = getauxval(AT_HWCAP2);
|
||||||
|
if (hwcap2 & HWCAP2_SVE2) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // AARCH64_CPUID_INLINE_H_
|
@ -70,8 +70,8 @@ class undirected_graph_edge_descriptor
|
|||||||
using base_vertex_type = typename base_graph_traits::vertex_descriptor;
|
using base_vertex_type = typename base_graph_traits::vertex_descriptor;
|
||||||
|
|
||||||
base_edge_type underlying_edge;
|
base_edge_type underlying_edge;
|
||||||
const base_graph_type *g;
|
const base_graph_type *g = nullptr;
|
||||||
bool reverse; // if true, reverse vertices in source() and target()
|
bool reverse = false; // if true, reverse vertices in source() and target()
|
||||||
|
|
||||||
inline std::pair<base_vertex_type, base_vertex_type>
|
inline std::pair<base_vertex_type, base_vertex_type>
|
||||||
canonical_edge() const {
|
canonical_edge() const {
|
||||||
|
@ -29,7 +29,11 @@
|
|||||||
#ifndef UTIL_SMALL_VECTOR_H
|
#ifndef UTIL_SMALL_VECTOR_H
|
||||||
#define UTIL_SMALL_VECTOR_H
|
#define UTIL_SMALL_VECTOR_H
|
||||||
|
|
||||||
#include <vector>
|
#if defined(__has_feature)
|
||||||
|
# if __has_feature(memory_sanitizer)
|
||||||
|
#define BUILD_WITH_MSAN
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <boost/version.hpp>
|
#include <boost/version.hpp>
|
||||||
|
|
||||||
@ -37,8 +41,16 @@
|
|||||||
* We use the small_vector constructors introduced in Boost 1.61 (trac bug
|
* We use the small_vector constructors introduced in Boost 1.61 (trac bug
|
||||||
* #11866, github commit b436c91). If the Boost version is too old, we fall
|
* #11866, github commit b436c91). If the Boost version is too old, we fall
|
||||||
* back to using std::vector.
|
* back to using std::vector.
|
||||||
|
*
|
||||||
|
* Also with MSan boost::container::small_vector cannot be used because MSan
|
||||||
|
* reports some issues there, it looks similar to [1], but even adding
|
||||||
|
* __attribute__((no_sanitize_memory)) for ~small_vector_base() [2] is not
|
||||||
|
* enough since clang-16, so let's simply use std::vector under MSan.
|
||||||
|
*
|
||||||
|
* [1]: https://github.com/google/sanitizers/issues/854
|
||||||
|
* [2]: https://github.com/ClickHouse/boost/commit/229354100
|
||||||
*/
|
*/
|
||||||
#if BOOST_VERSION >= 106100
|
#if !defined(BUILD_WITH_MSAN) && BOOST_VERSION >= 106100
|
||||||
# define HAVE_BOOST_CONTAINER_SMALL_VECTOR
|
# define HAVE_BOOST_CONTAINER_SMALL_VECTOR
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -56,6 +68,8 @@ using small_vector = boost::container::small_vector<T, N, Allocator>;
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
// Boost version isn't new enough, fall back to just using std::vector.
|
// Boost version isn't new enough, fall back to just using std::vector.
|
||||||
template <class T, std::size_t N, typename Allocator = std::allocator<T>>
|
template <class T, std::size_t N, typename Allocator = std::allocator<T>>
|
||||||
using small_vector = std::vector<T, Allocator>;
|
using small_vector = std::vector<T, Allocator>;
|
||||||
|
@ -133,7 +133,7 @@ public:
|
|||||||
: lit(&lit_in), idx(idx_in) {}
|
: lit(&lit_in), idx(idx_in) {}
|
||||||
|
|
||||||
const ue2_literal *lit = nullptr;
|
const ue2_literal *lit = nullptr;
|
||||||
size_t idx;
|
size_t idx = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
|
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
|
||||||
|
@ -58,7 +58,10 @@ void readRow(sqlite3_stmt *statement, vector<DataBlock> &blocks,
|
|||||||
}
|
}
|
||||||
auto internal_stream_index = stream_indices[stream_id];
|
auto internal_stream_index = stream_indices[stream_id];
|
||||||
|
|
||||||
assert(blob || bytes > 0);
|
if (!(blob && bytes > 0)) {
|
||||||
|
assert(0);
|
||||||
|
throw std::domain_error("Invalid blob or bytes from sqlite3.");
|
||||||
|
}
|
||||||
blocks.emplace_back(id, stream_id, internal_stream_index,
|
blocks.emplace_back(id, stream_id, internal_stream_index,
|
||||||
string(blob, blob + bytes));
|
string(blob, blob + bytes));
|
||||||
}
|
}
|
||||||
|
@ -740,6 +740,11 @@ u64a byte_size(const vector<DataBlock> &corpus_blocks) {
|
|||||||
total += block.payload.size();
|
total += block.payload.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (total == 0) {
|
||||||
|
assert(0);
|
||||||
|
throw std::invalid_argument("Empty corpus.");
|
||||||
|
}
|
||||||
|
|
||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ public:
|
|||||||
std::lock_guard<std::mutex> lock(mutex);
|
std::lock_guard<std::mutex> lock(mutex);
|
||||||
if (failed) {
|
if (failed) {
|
||||||
// We have previously failed to compile this database.
|
// We have previously failed to compile this database.
|
||||||
return nullptr;
|
throw CompileFailed("Unable to compile db previously.");
|
||||||
}
|
}
|
||||||
if (db) {
|
if (db) {
|
||||||
return db;
|
return db;
|
||||||
|
@ -101,7 +101,7 @@ void NfaGeneratedCorpora::generate(unsigned id, vector<Corpus> &data) {
|
|||||||
pl.logicalKeyRenumber();
|
pl.logicalKeyRenumber();
|
||||||
const auto &m_lkey = pl.getLkeyMap();
|
const auto &m_lkey = pl.getLkeyMap();
|
||||||
assert(!m_lkey.empty());
|
assert(!m_lkey.empty());
|
||||||
u32 a_subid; // arbitrary sub id
|
u32 a_subid = 0; // arbitrary sub id
|
||||||
unordered_map<u32, vector<Corpus>> m_data;
|
unordered_map<u32, vector<Corpus>> m_data;
|
||||||
for (const auto &it : m_lkey) {
|
for (const auto &it : m_lkey) {
|
||||||
a_subid = it.first;
|
a_subid = it.first;
|
||||||
|
@ -98,6 +98,6 @@ void *Thread::runThread(void *thr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Thread::Thread(size_t num) : thread_id(num) {}
|
Thread::Thread(size_t num) : thread_id(num), thread() {}
|
||||||
|
|
||||||
Thread::~Thread() {}
|
Thread::~Thread() {}
|
||||||
|
@ -499,8 +499,8 @@ void processArgs(int argc, char *argv[], CorpusProperties &corpus_gen_prop,
|
|||||||
} else if (in_corpora) {
|
} else if (in_corpora) {
|
||||||
corpora->push_back(optarg);
|
corpora->push_back(optarg);
|
||||||
in_corpora = 2;
|
in_corpora = 2;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2015-2016, Intel Corporation
|
* Copyright (c) 2015-2021, Intel Corporation
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
@ -363,8 +363,9 @@ static const unsigned validModes[] = {
|
|||||||
// Mode bits for switching off various architecture features
|
// Mode bits for switching off various architecture features
|
||||||
static const unsigned long long featureMask[] = {
|
static const unsigned long long featureMask[] = {
|
||||||
~0ULL, /* native */
|
~0ULL, /* native */
|
||||||
~(HS_CPU_FEATURES_AVX2 | HS_CPU_FEATURES_AVX512), /* no avx2 */
|
~(HS_CPU_FEATURES_AVX2 | HS_CPU_FEATURES_AVX512 | HS_CPU_FEATURES_AVX512VBMI), /* no avx2 */
|
||||||
~HS_CPU_FEATURES_AVX512, /* no avx512 */
|
~(HS_CPU_FEATURES_AVX512 | HS_CPU_FEATURES_AVX512VBMI), /* no avx512 */
|
||||||
|
~HS_CPU_FEATURES_AVX512VBMI, /* no avx512vbmi */
|
||||||
};
|
};
|
||||||
|
|
||||||
INSTANTIATE_TEST_CASE_P(Single,
|
INSTANTIATE_TEST_CASE_P(Single,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2015-2017, Intel Corporation
|
* Copyright (c) 2015-2021, Intel Corporation
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
@ -56,6 +56,10 @@ TEST(DB, flagsToPlatform) {
|
|||||||
p.cpu_features |= HS_CPU_FEATURES_AVX512;
|
p.cpu_features |= HS_CPU_FEATURES_AVX512;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(HAVE_AVX512VBMI)
|
||||||
|
p.cpu_features |= HS_CPU_FEATURES_AVX512VBMI;
|
||||||
|
#endif
|
||||||
|
|
||||||
platform_t pp = target_to_platform(target_t(p));
|
platform_t pp = target_to_platform(target_t(p));
|
||||||
ASSERT_EQ(pp, hs_current_platform);
|
ASSERT_EQ(pp, hs_current_platform);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2015-2017, Intel Corporation
|
* Copyright (c) 2015-2022, Intel Corporation
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
@ -64,8 +64,8 @@ static ValidUtf8TestInfo valid_utf8_tests[] = {
|
|||||||
{"공동경비구역", true},
|
{"공동경비구역", true},
|
||||||
{"জলসাঘর", true},
|
{"জলসাঘর", true},
|
||||||
|
|
||||||
// Invalid one-byte caseS.
|
// Valid one-byte caseS.
|
||||||
{"\x7f", false},
|
{"\x7f", true}, // \x7f is valid
|
||||||
|
|
||||||
// These bytes should never appear in a UTF-8 stream.
|
// These bytes should never appear in a UTF-8 stream.
|
||||||
{"\xc0", false},
|
{"\xc0", false},
|
||||||
|
@ -42,7 +42,7 @@ CorpusProperties::CorpusProperties()
|
|||||||
: matchness(100), unmatchness(0), randomness(0), prefixRange(0, 0),
|
: matchness(100), unmatchness(0), randomness(0), prefixRange(0, 0),
|
||||||
suffixRange(0, 0), cycleMin(1), cycleMax(1),
|
suffixRange(0, 0), cycleMin(1), cycleMax(1),
|
||||||
corpusLimit(DEFAULT_CORPUS_GENERATOR_LIMIT), editDistance(0),
|
corpusLimit(DEFAULT_CORPUS_GENERATOR_LIMIT), editDistance(0),
|
||||||
alphabetSize(~0) {
|
alphabetSize(~0), rngSeed(0) {
|
||||||
// empty
|
// empty
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user