Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'Illegal instruction' error on x86_64 CentOS 7.9 #110

Closed
xiaokang opened this issue Jun 12, 2022 · 12 comments
Closed

'Illegal instruction' error on x86_64 CentOS 7.9 #110

xiaokang opened this issue Jun 12, 2022 · 12 comments

Comments

@xiaokang
Copy link

I got a error 'Illegal instruction' to run unit test and example on x86_64 CentOS 7.9. It's appreciated to get help from the community.

build

wget https://github.com/VectorCamp/vectorscan/archive/refs/tags/vectorscan/5.4.7.zip
unzip 5.4.7.zip
cd vectorscan-vectorscan-5.4.7
mkdir build
cd build
PATH=$RAGEL_PATH:$PATH cmake -DBOOST_ROOT=$BOOST_SOURCE ..
make

run

./bin/unit-hyperscan
Illegal instruction

./bin/simplegrep cpp Makefile
Illegal instruction

Env

  • CentOS Linux release 7.9.2009 (Core)
  • Linux hostname 3.10.0-1160.59.1.el7.x86_64 Feature/add arm support #1 SMP Wed Feb 23 16:47:03 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
  • gcc version 11.1.0

Using built-in specs.
COLLECT_GCC=/home/xiaokang/opt/ldb/bin/gcc-11
COLLECT_LTO_WRAPPER=/mnt/disk3/xiaokang/opt/ldb_toolchain/bin/../lib/gcc/x86_64-linux-gnu/11/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 11.1.0-1ubuntu118.04.1' --with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-11 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --disable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-11-YRKbe7/gcc-11-11.1.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-11-YRKbe7/gcc-11-11.1.0/debian/tmp-gcn/usr --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.1.0 (Ubuntu 11.1.0-1ubuntu1
18.04.1)

  • cat /proc/cpuinfo

processor : 0
vendor_id : AuthenticAMD
cpu family : 23
model : 49
model name : AMD EPYC 7K62 48-Core Processor
stepping : 0
microcode : 0x1000065
cpu MHz : 2595.124
cache size : 512 KB
physical id : 0
siblings : 48
core id : 0
cpu cores : 24
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm art rep_good nopl extd_apicid amd_dcm eagerfpu pni pclmulqdq ssse3 fma cx16 sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm cmp_legacy cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw topoext retpoline_amd ibpb vmmcall fsgsbase bmi1 avx2 smep bmi2 rdseed adx smap clflushopt sha_ni xsaveopt xsavec xgetbv1 arat
bogomips : 5190.24
TLB size : 1024 4K pages
clflush size : 64
cache_alignment : 64
address sizes : 48 bits physical, 48 bits virtual
power management:

@xiaokang
Copy link
Author

I have tried version 5.4.6 and got the same error. I also tried original hyperscan 5.4.0 and it's ok.

@markos
Copy link

markos commented Jun 12, 2022

Hi, could you please send the cmake output? it would help to know what is the misconfiguration here. My guess is that AVX512 is auto-enabled, but the AMD chips don't support it hence the SIGILL.

@xiaokang
Copy link
Author

@markos , thanks for you help!

The cmake output is as bellow:

CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
Compatibility with CMake < 2.8.12 will be removed from a future version of
CMake.

Update the VERSION argument value or use a ... suffix to tell
CMake that the project does not need compatibility with older versions.

-- The C compiler identification is GNU 11.1.0
-- The CXX compiler identification is GNU 11.1.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /home/xiaokang/opt/ldb/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /home/xiaokang/opt/ldb/bin/g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test ARCH_X86_64
-- Performing Test ARCH_X86_64 - Success
-- Performing Test ARCH_IA32
-- Performing Test ARCH_IA32 - Failed
-- Performing Test ARCH_AARCH64
-- Performing Test ARCH_AARCH64 - Failed
-- Performing Test ARCH_ARM32
-- Performing Test ARCH_ARM32 - Failed
-- Performing Test ARCH_PPC64EL
-- Performing Test ARCH_PPC64EL - Failed
-- Default build type 'Release with debug info'
-- using release build
-- Boost version: 1.73.0
-- Found PythonInterp: /usr/bin/python (found version "2.7.5")
-- Build date: 2022-06-13
-- Building static libraries
-- gcc version 11.1.0
-- gcc will tune for bdver4, bdver4
-- ARCH_C_FLAGS : -msse4.2
-- ARCH_CXX_FLAGS : -msse4.2
-- g++ version 11.1.0
-- Looking for include file unistd.h
-- Looking for include file unistd.h - found
-- Looking for include file intrin.h
-- Looking for include file intrin.h - not found
-- Looking for C++ include intrin.h
-- Looking for C++ include intrin.h - not found
-- Looking for include file x86intrin.h
-- Looking for include file x86intrin.h - found
-- Looking for C++ include x86intrin.h
-- Looking for C++ include x86intrin.h - found
-- Looking for posix_memalign
-- Looking for posix_memalign - found
-- Looking for _aligned_malloc
-- Looking for _aligned_malloc - not found
-- Performing Test HAS_C_HIDDEN
-- Performing Test HAS_C_HIDDEN - Success
-- Performing Test HAS_CXX_HIDDEN
-- Performing Test HAS_CXX_HIDDEN - Success
-- Looking for _LIBCPP_VERSION
-- Looking for _LIBCPP_VERSION - not found
-- generator is Unix Makefiles
-- Performing Test HAS_C_ATTR_IFUNC
-- Performing Test HAS_C_ATTR_IFUNC - Success
-- Performing Test HAVE_SSE42
-- Performing Test HAVE_SSE42 - Success
-- Performing Test HAVE_AVX2
-- Performing Test HAVE_AVX2 - Success
-- Performing Test HAVE_AVX512
-- Performing Test HAVE_AVX512 - Failed
-- Performing Test HAVE_AVX512VBMI
-- Performing Test HAVE_AVX512VBMI - Failed
-- Performing Test HAVE_CC_BUILTIN_ASSUME_ALIGNED
-- Performing Test HAVE_CC_BUILTIN_ASSUME_ALIGNED - Success
-- Performing Test HAVE_CXX_BUILTIN_ASSUME_ALIGNED
-- Performing Test HAVE_CXX_BUILTIN_ASSUME_ALIGNED - Success
-- Performing Test HAVE__BUILTIN_CONSTANT_P
-- Performing Test HAVE__BUILTIN_CONSTANT_P - Success
-- Performing Test C_FLAG_Wvla
-- Performing Test C_FLAG_Wvla - Success
-- Performing Test C_FLAG_Wpointer_arith
-- Performing Test C_FLAG_Wpointer_arith - Success
-- Performing Test C_FLAG_Wstrict_prototypes
-- Performing Test C_FLAG_Wstrict_prototypes - Success
-- Performing Test C_FLAG_Wmissing_prototypes
-- Performing Test C_FLAG_Wmissing_prototypes - Success
-- Performing Test CXX_FLAG_Wvla
-- Performing Test CXX_FLAG_Wvla - Success
-- Performing Test CXX_FLAG_Wpointer_arith
-- Performing Test CXX_FLAG_Wpointer_arith - Success
-- Performing Test CC_SELF_ASSIGN
-- Performing Test CC_SELF_ASSIGN - Failed
-- Performing Test CXX_SELF_ASSIGN
-- Performing Test CXX_SELF_ASSIGN - Failed
-- Performing Test CC_PAREN_EQUALITY
-- Performing Test CC_PAREN_EQUALITY - Failed
-- Performing Test CXX_UNUSED_CONST_VAR
-- Performing Test CXX_UNUSED_CONST_VAR - Success
-- Performing Test CXX_IGNORED_ATTR
-- Performing Test CXX_IGNORED_ATTR - Success
-- Performing Test CXX_REDUNDANT_MOVE
-- Performing Test CXX_REDUNDANT_MOVE - Success
-- Performing Test CXX_WEAK_VTABLES
-- Performing Test CXX_WEAK_VTABLES - Failed
-- Performing Test CXX_MISSING_DECLARATIONS
-- Performing Test CXX_MISSING_DECLARATIONS - Success
-- Performing Test CXX_UNUSED_LOCAL_TYPEDEFS
-- Performing Test CXX_UNUSED_LOCAL_TYPEDEFS - Success
-- Performing Test CXX_WUNUSED_VARIABLE
-- Performing Test CXX_WUNUSED_VARIABLE - Success
-- Performing Test CC_STRINGOP_OVERFLOW
-- Performing Test CC_STRINGOP_OVERFLOW - Success
-- Building runtime for multiple microarchitectures
-- Looking for mmap
-- Looking for mmap - found
-- Sphinx not found, unable to generate developer reference
-- Found PkgConfig: /home/xiaokang/opt/ldb/bin/pkg-config (found version "0.29.1")
-- Checking for module 'libpcre>=8.41'
-- No package 'libpcre' found
-- PCRE version 8.41 or above not found
-- PCRE 8.41 or above not found
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Checking for module 'sqlite3'
-- No package 'sqlite3' found
-- looking for sqlite3 in source tree
-- no sqlite3 in source tree
-- sqlite3 not found, not building hsbench
-- PCRE 8.41 not found, not building hscollider
-- Could not find libpcap - some examples will not be built
-- Configuring done
CMake Warning (dev) at CMakeLists.txt:1253 (add_library):
Policy CMP0115 is not set: Source file extensions must be explicit. Run
"cmake --help-policy CMP0115" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.

File:

/path/to/vectorscan-vectorscan-5.4.6/src/hs_version.h.in

This warning is for project developers. Use -Wno-dev to suppress it.

-- Generating done
-- Build files have been written to: /path/to/vectorscan-vectorscan-5.4.6/build

@markos
Copy link

markos commented Jun 13, 2022

ok, so it's not what I thought, AVX512 is not enabled, would you mind running a debug version of the failing binary inside gdb and telling me where it fails?

@xiaokang
Copy link
Author

gdb bt is as follows:

Program received signal SIGILL, Illegal instruction.
getSomPrecision (mode=1) at /src/vectorscan-vectorscan-5.4.6/src/hs.cpp:162
162 } else if (mode & HS_MODE_SOM_HORIZON_SMALL) {
(gdb) bt
#0 getSomPrecision (mode=1) at /src/vectorscan-vectorscan-5.4.6/src/hs.cpp:162
#1 getSomPrecision (mode=1) at /src/vectorscan-vectorscan-5.4.6/src/hs.cpp:152
#2 ue2::hs_compile_multi_int (expressions=0x7fffffffdff8, flags=0x7fffffffdff4, ids=0x7fffffffe008, ext=0x0, elements=1, mode=,
platform=0x0, db=0x7fffffffe190, comp_error=0x7fffffffe198, g=...) at /src/vectorscan-vectorscan-5.4.6/src/hs.cpp:230
#3 0x000055555561387a in hs_compile (expression=, expression@entry=0x7fffffffe597 "cppxx", flags=, flags@entry=2,
mode=mode@entry=1, platform=platform@entry=0x0, db=db@entry=0x7fffffffe190, error=error@entry=0x7fffffffe198)
at /src/vectorscan-vectorscan-5.4.6/src/hs.cpp:429
#4 0x000055555561015e in main (argc=, argv=)
at /src/vectorscan-vectorscan-5.4.6/examples/simplegrep.c:163

@xiaokang
Copy link
Author

I found a interesting phenomenon, that if I rerun cmake and make, the new compiled binary will run ok without any error.

@xiaokang
Copy link
Author

@markos can you give me some suggestion?

@markos
Copy link

markos commented Jul 6, 2022

@xiaokang if it doesn't happen the second time then it's most definitely a misconfiguration issue. I cannot reproduce this here.

@xiaokang
Copy link
Author

@markos What I mean is that for the first time run cmake and make the error appears and for the second time the error disappears. The difference between the first time and second time is reproduced in my env.

@markos
Copy link

markos commented Sep 8, 2022

Hi, could you please try with latest develop branch on a clean environment? And paste the exact cmake commands?

@markos
Copy link

markos commented Sep 19, 2022

Hi @xiaokang, could you please try with 5.4.8 or recent develop? I cannot reproduce this behaviour on my my system, or at least paste the exact cmake command used?
Otherwise I will have to close this issue. Thanks.

@markos
Copy link

markos commented Mar 23, 2023

Closing as unreproducible.

@markos markos closed this as completed Mar 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants