From f68a1e526c4fbd0630b827db668d65d436ec6963 Mon Sep 17 00:00:00 2001 From: Konstantinos Margaritis Date: Wed, 10 Jan 2024 18:25:31 +0200 Subject: [PATCH 1/2] Enable Fat runtime on x86 by default to help migration from hyperscan --- CMakeLists.txt | 5 ++++- cmake/osdetection.cmake | 7 ++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d256e7ed..0cf3c0f8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,7 +23,6 @@ INCLUDE (CheckLibraryExists) INCLUDE (CheckSymbolExists) include (CMakeDependentOption) include (GNUInstallDirs) -include (${CMAKE_MODULE_PATH}/platform.cmake) include (${CMAKE_MODULE_PATH}/boost.cmake) include (${CMAKE_MODULE_PATH}/ragel.cmake) @@ -123,6 +122,10 @@ if (RELEASE_BUILD) add_definitions(-DNDEBUG) endif() +# Architecture detection + +include (${CMAKE_MODULE_PATH}/platform.cmake) + # Detect OS and if Fat Runtime is available include (${CMAKE_MODULE_PATH}/osdetection.cmake) diff --git a/cmake/osdetection.cmake b/cmake/osdetection.cmake index 343e16b5..59f2b342 100644 --- a/cmake/osdetection.cmake +++ b/cmake/osdetection.cmake @@ -6,7 +6,12 @@ if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD") set(FREEBSD true) endif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD") -option(FAT_RUNTIME "Build a library that supports multiple microarchitectures" OFF) +if (ARCH_IA32 OR ARCH_X86_64) + option(FAT_RUNTIME "Build a library that supports multiple microarchitectures" ON) +else() + option(FAT_RUNTIME "Build a library that supports multiple microarchitectures" OFF) +endif() + if (FAT_RUNTIME) message("Checking Fat Runtime Requirements...") if (NOT LINUX) From 6f4409365a03e1364f2b86f616befcbf090ab2ff Mon Sep 17 00:00:00 2001 From: Konstantinos Margaritis Date: Wed, 10 Jan 2024 18:26:12 +0200 Subject: [PATCH 2/2] enable AVX2,AVX512,AVX512 for fat runtimes on x86 --- cmake/cflags-x86.cmake | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmake/cflags-x86.cmake b/cmake/cflags-x86.cmake index 7b9cbf81..5ae21ee4 100644 --- a/cmake/cflags-x86.cmake +++ b/cmake/cflags-x86.cmake @@ -26,6 +26,9 @@ if (NOT FAT_RUNTIME) set(ARCH_CXX_FLAGS "-msse4.2") endif() else() + set(BUILD_AVX512VBMI ON) + set(BUILD_AVX512 ON) + set(BUILD_AVX2 ON) set(ARCH_C_FLAGS "-msse4.2") set(ARCH_CXX_FLAGS "-msse4.2") endif() @@ -129,5 +132,3 @@ else (NOT FAT_RUNTIME) message(FATAL_ERROR "A minimum of SSE4.2 compiler support is required") endif () endif () - -