Skip to content

[Bug]: SIGILL (Illegal Instruction) during import on x86_64 (AVX-512BW vmovdqu8 requirement) #128

@gavmor

Description

@gavmor

Description

The zvec Python package (v0.1.0 - v0.2.0) crashes with an Illegal instruction (core dumped) error immediately upon import on certain x86_64 systems. Debugging reveals that the _zvec shared object contains instructions from the AVX-512BW subset (specifically vmovdqu8) which are not supported by many CPUs that otherwise support base AVX-512 or AVX2.

System Information:

  • OS: Linux (Ubuntu 24.04)
  • Architecture: x86_64
  • Python Version: 3.11.10
  • Zvec Version: 0.2.0 (also reproduced on 0.1.1 and 0.1.0)
  • CPU 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 constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb cat_l3 cdp_l3 hw_pstate ssbd mba ibpb stibp vmmcall fsgsbase bmi1 avx2 smep bmi2 cqm rdt_a rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local clzero irperf xsaveerptr rdpru wbnoinvd arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif v_spec_ctrl umip rdpid overflow_recov succor smca sev sev_es ibpb_exit_to_user
  • Missing Instructions: Notably lacks avx512bw.

Suggested Fix:
The current wheels seem to be compiled with -march=skylake-avx512 or similar aggressive optimizations. Providing a generic x86-64-v3 (AVX2) wheel or ensuring the build pipeline targets a broader set of x86_64 features would resolve this for users on older or mid-range hardware.

Steps to Reproduce

1. Install `zvec` via pip: `pip install zvec`
2. Attempt to import: `python -c "import zvec"`
3. Result: `Illegal instruction (core dumped)`

Logs / Stack Trace

Program received signal SIGILL, Illegal instruction.
   0x00007fffc65e33a7 in ?? () from .venv/lib/python3.11/site-packages/_zvec.cpython-311-x86_64-linux-gnu.so

   (gdb) x/i $rip
   => 0x7fffc65e33a7:      vmovdqu8 %xmm0,0x28(%r15)

   (gdb) bt
   #0  0x00007fffc65e33a7 in ?? () from .venv/lib/python3.11/site-packages/_zvec.cpython-311-x86_64-linux-gnu.so
   #1  0x00007fffc65e380f in ?? () from .venv/lib/python3.11/site-packages/_zvec.cpython-311-x86_64-linux-gnu.so
   #2  0x00007fffc65e3a5a in ?? () from .venv/lib/python3.11/site-packages/_zvec.cpython-311-x86_64-linux-gnu.so
   #3  0x00007fffc655804d in ?? () from .venv/lib/python3.11/site-packages/_zvec.cpython-311-x86_64-linux-gnu.so
   #4  0x00007ffff7fca71f in call_init (...) at ./elf/dl-init.c:74
   ...
   #11 0x00007ffff7fd2164 in _dl_open (file="/.../site-packages/_zvec.cpython-311-x86_64-linux-gnu.so", ...)

Operating System

Ubuntu 24.04.4 LTS (Noble Numbat) Kernel: Linux 6.8.0-52-generic #53-Ubuntu SMP PREEMPT_DYNAMIC Architecture: x86_64

Build & Runtime Environment

Runtime: Python 3.11.10    Package Version: zvec==0.2.0 (reproducible on 0.1.1 and 0.1.0)    Processor: x86_64    CPU 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 constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf rapl pni    pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext    perfctr_llc mwaitx cpb cat_l3 cdp_l3 hw_pstate ssbd mba ibpb stibp vmmcall fsgsbase bmi1 avx2 smep bmi2 cqm rdt_a rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local clzero    irperf xsaveerptr rdpru wbnoinvd arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif v_spec_ctrl umip rdpid overflow_recov succor smca sev sev_es    ibpb_exit_to_user    Note: The CPU supports AVX and AVX2 but lacks the AVX-512BW extension required for the 'vmovdqu8' instruction present in the wheel.

Additional Context

  • I've checked git status — no uncommitted submodule changes
  • I built with CMAKE_BUILD_TYPE=Debug
  • This occurs with or without COVERAGE=ON
  • The issue involves Python ↔ C++ integration (pybind11)

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Status

In progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions