intel / hyperscan

High-performance regular expression matching library
https://www.hyperscan.io
Other
4.83k stars 722 forks source link

i edited fully arch.cmake but variable keep as undefined #366

Open Azaretdodo opened 2 years ago

Azaretdodo commented 2 years ago

hello,

i edited fully arch.cmake but variable keep as undefined when i try to build hyperscan with boost :

arch.cmake :

# detect archiif
#
# must be called after determining where compiler intrinsics are defined

if (HAVE_C_X86INTRIN_H)
    set (INTRIN_INC_H "x86intrin.h")
elseif (HAVE_C_INTRIN_H)
    set (INTRIN_INC_H "intrin.h")
else ()
    message (FATAL_ERROR "No intrinsics header found")
endif ()

if (BUILD_AVX512)
    CHECK_C_COMPILER_FLAG(${SKYLAKE_FLAG} HAS_ARCH_SKYLAKE)
    if (NOT HAS_ARCH_SKYLAKE)
        message (FATAL_ERROR "AVX512 not supported by compiler")
    endif ()
endif ()

if (BUILD_AVX512VBMI)
    CHECK_C_COMPILER_FLAG(${ICELAKE_FLAG} HAS_ARCH_ICELAKE)
    if (NOT HAS_ARCH_ICELAKE)
        message (FATAL_ERROR "AVX512VBMI not supported by compiler")
    endif ()
endif ()

if (BUILD_core2_memcpy)
    CHECK_C_COMPILER_FLAG(${core2_memcpy_FLAG} HAS_ARCH_core2_memcpy)
    if (NOT HAS_ARCH_core2_memcpy)
        message (FATAL_ERROR "core2_memcpy not supported by compiler")
    endif ()
endif ()

if (BUILD_corei7_memcpy)
    CHECK_C_COMPILER_FLAG(${corei7_memcpy_FLAG} HAS_ARCH_corei7_memcpy)
    if (NOT HAS_ARCH_corei7_memcpy)
        message (FATAL_ERROR "corei7_memcpy not supported by compiler")
    endif ()
endif ()

if (BUILD_core2_memset)
    CHECK_C_COMPILER_FLAG(${core2_memset_FLAG} HAS_ARCH_core2_memset)
    if (NOT HAS_ARCH_core2_memset)
        message (FATAL_ERROR "core2_memset not supported by compiler")
    endif ()
endif ()

if (BUILD_corei7_memset)
    CHECK_C_COMPILER_FLAG(${corei7_memset_FLAG} HAS_ARCH_corei7_memset)
    if (NOT HAS_ARCH_corei7_memset)
        message (FATAL_ERROR "corei7_memset not supported by compiler")
    endif ()
endif ()

if (BUILD_avx2_memset)
    CHECK_C_COMPILER_FLAG(${avx2_memset_FLAG} HAS_ARCH_avx2_memset)
    if (NOT HAS_ARCH_avx2_memset)
        message (FATAL_ERROR "avx2_memset not supported by compiler")
    endif ()
endif ()
if (BUILD_avx2_memcpy)
    CHECK_C_COMPILER_FLAG(${avx2_memcpy_FLAG} HAS_ARCH_avx2_memcpy)
    if (NOT HAS_ARCH_avx2_memcpy)
        message (FATAL_ERROR "avx2_memcpy not supported by compiler")
    endif ()
endif ()

if (BUILD_avx2_memmove)
    CHECK_C_COMPILER_FLAG(${avx2_memmove_FLAG} HAS_ARCH_avx2_memmove)
    if (NOT HAS_ARCH_avx2_memmove)
        message (FATAL_ERROR "avx2_memmove not supported by compiler")
    endif ()
endif ()
if (FAT_RUNTIME)
    # test the highest level microarch to make sure everything works
    if (BUILD_AVX512)
        if (BUILD_AVX512VBMI)
            if (BUILD_avx2_memmove)
                if (BUILD_avx2_memcpy)
                    if (BUILD_corei7_memset)
                        if (BUILD_corei7_memcpy)
                            if (BUILD_core2_memset)
                                if (BUILD_avx2_memset)
                                    if (BUILD_core2_memcpy)
                                        set (CMAKE_REQUIRED_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_C_FLAGS} ${ICELAKE_FLAG}")
                                    elseif ()
                                        set (CMAKE_REQUIRED_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_C_FLAGS} ${SKYLAKE_FLAG}")
                                    elseif ()
                                        set (CMAKE_REQUIRED_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_C_FLAGS} ${avx2_memmove_FLAG}")
                                    elseif ()
                                        set (CMAKE_REQUIRED_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_C_FLAGS} ${avx2_memcpy_FLAG}")
                                    elseif ()
                                        set (CMAKE_REQUIRED_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_C_FLAGS} ${avx2_memset_FLAG}")
                                    elseif ()
                                        set (CMAKE_REQUIRED_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_C_FLAGS} ${corei7_memset_FLAG}")
                                    elseif ()
                                        set (CMAKE_REQUIRED_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_C_FLAGS} ${core2_memset_FLAG}")
                                    elseif ()
                                        set (CMAKE_REQUIRED_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_C_FLAGS} ${corei7_memcpy_FLAG}")
                                    else ()
                                        set (CMAKE_REQUIRED_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_C_FLAGS} ${core2_memcpy_FLAG}")
                                    endif (BUILD_AVX512VBMI)
                                endif (BUILD_avx2_memmove)
                            endif (BUILD_avx2_memcpy)
                        endif (BUILD_corei7_memset)
                    endif (BUILD_corei7_memcpy)
                endif (BUILD_core2_memset)
            endif (BUILD_avx2_memset)
        endif (BUILD_core2_memcpy)
    else ()
        set (CMAKE_REQUIRED_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_C_FLAGS} -march=core-avx2")
    endif ()
else (NOT FAT_RUNTIME)
    # if not fat runtime, then test given cflags
    set (CMAKE_REQUIRED_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_C_FLAGS} ${ARCH_C_FLAGS}")
endif ()
# ensure we have the minimum of SSSE3 - call a SSSE3 intrinsic
CHECK_C_SOURCE_COMPILES("#include <${INTRIN_INC_H}>
int main() {
    __m128i a = _mm_set1_epi8(1);
    (void)_mm_shuffle_epi8(a, a);
}" HAVE_SSSE3)

# now look for AVX2
CHECK_C_SOURCE_COMPILES("#include <${INTRIN_INC_H}>
#if !defined(__AVX2__)
#error no avx2
#endif

int main(){
    __m256i z = _mm256_setzero_si256();
    (vo`# detect archiif (BUILD_SSSE3 AND NOT HAVE_SSSE3)
#
# must be called after determining where compiler intrinsics are defined

if (HAVE_C_X86INTRIN_H)
    set (INTRIN_INC_H "x86intrin.h")
elseif (HAVE_C_INTRIN_H)
    set (INTRIN_INC_H "intrin.h")
else ()
    message (FATAL_ERROR "No intrinsics header found")
endif ()

if (FAT_RUNTIME)
    if (BUILD_SSSE3 AND NOT HAVE_SSSE3)
        message(FATAL_ERROR "SSSE3 support requested but not supported")
    endif ()
    if (BUILD_AVX2 AND NOT HAVE_AVX2)
        message(FATAL_ERROR "AVX2 support requested but not supported")
    endif ()
    if (BUILD_AVX512 AND NOT HAVE_AVX512)
        message(FATAL_ERROR "AVX512 support requested but not supported")
    endif ()
    if (BUILD_AVX512VBMI AND NOT HAVE_AVX512VBMI)
        message(FATAL_ERROR "AVX512VBMI support requested but not supported")
    endif ()
    if (BUILD_SSSE3 AND NOT HAVE_SSSE3)
        message(FATAL_ERROR "SSSE3 support requested but not supported")
    endif ()
    if (BUILD_AVX2 AND NOT HAVE_AVX2)
        message(FATAL_ERROR "AVX2 support requested but not supported")
    endif ()
    if (BUILD_AVX512 AND NOT HAVE_AVX512)
        message(FATAL_ERROR "AVX512 support requested but not supported")
    endif ()
    if (BUILD_AVX512VBMI AND NOT HAVE_AVX512VBMI)
        message(FATAL_ERROR "AVX512VBMI support requested but not supported")
    endif ()
if (BUILD_core2_memcpy AND NOT HAVE_core2_memcpy)
        message(FATAL_ERROR "core2_memcpy support requested but not supported")
    endif ()
    if (BUILD_corei7_memcpy AND NOT HAVE_corei7_memcpy)
        message(FATAL_ERROR "corei7_memcpy support requested but not supported")
    endif ()
    if (BUILD_core2_memset AND NOT HAVE_core2_memset)
        message(FATAL_ERROR "core2_memset support requested but not supported")
    endif ()
    if (BUILD_corei7_memset AND NOT HAVE_corei7_memset)
        message(FATAL_ERROR "corei7_memset support requested but not supported")
    endif ()
    if (BUILD_avx2_memset AND NOT HAVE_avx2_memset)
        message(FATAL_ERROR "avx2_memset support requested but not supported")
    endif ()        message(FATAL_ERROR "core2_memcpy support requested but not supported")
    endif ()
    if (BUILD_corei7_memcpy AND NOT HAVE_corei7_memcpy)
        message(FATAL_ERROR "corei7_memcpy support requested but not supported")
    endif ()
    if (BUILD_core2_memset AND NOT HAVE_core2_memset)
        message(FATAL_ERROR "core2_memset support requested but not supported")
    endif ()
    if (BUILD_corei7_memset AND NOT HAVE_corei7_memset)
        message(FATAL_ERROR "corei7_memset support requested but not supported")
    endif ()
    if (BUILD_avx2_memset AND NOT HAVE_avx2_memset)
        message(FATAL_ERROR "avx2_memset support requested but not supported")
    endif ()
    if (BUILD_avx2_memcpy AND NOT HAVE_avx2_memcpy)
        message(FATAL_ERROR "avx2_memcpy support requested but not supported")
    endif ()
    if (BUILD_avx2_memmove AND NOT HAVE_avx2_memmove)
        message(FATAL_ERROR "avx2_memmove support requested but not supported")
    else (NOT FAT_RUNTIME)
endif ()
endif ()

unset (CMAKE_REQUIRED_FLAGS)
unset (INTRIN_INC_H)

the errors says some cpu aren't define thus can i use the script i have edited for hyperscan-built ?

thanks you in advance for your answer,

regards.

Azaretdodo.