python-hyperscan icon indicating copy to clipboard operation
python-hyperscan copied to clipboard

Illegal instruction crash on import

Open prot0man opened this issue 1 year ago • 1 comments

When attempting to import hyperscan (0.7.7) on my machine that has an Intel Xeon E5-2690 CPU, it crashes my Python (3.12) interpreter with an illegal instruction error.

prot0man avatar Mar 20 '24 15:03 prot0man

I understand that my cpu doesn't support avx2, which is required, but I don't think it should crash on import.

prot0man avatar Mar 20 '24 15:03 prot0man

Was able to reproduce this issue on the latest 0.7.13 (0.7.16) wheel published on Github. To reproduce:

  • Install Ubuntu 24.04 in a VM
  • Disable AVX instructions in grub by adding noxsave to the kernel bootargs. For example, add the following to /etc/default/grub: GRUB_CMDLINE_LINUX_DEFAULT="quiet splash noxsave"
  • Update grub/cmdline args for kernel: sudo apt update-grub
  • Reboot
  • Install hyperscan 0.7.13
  • import hyperscan:
(venv312) user@user-VM2404:~/Downloads$ python
Python 3.12.3 (main, Jun 18 2025, 17:59:45) [GCC 13.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import hyperscan
Illegal instruction (core dumped)

greateggsgreg avatar Jul 04 '25 16:07 greateggsgreg

Following up on this again, it should be solvable by simply adding -DSIMDE_BACKEND=ON to your list of passed cmake args here

This should enable the SIMDe (SIMD everywhere) option, as mentioned in Vectorscan's configuration documentation

Since this project comes with a statically linked version of Vectorscan (a huge plus!), this change seems necessary to support the "most" platforms out there, even if it comes at a marginal cost to performance

greateggsgreg avatar Jul 24 '25 21:07 greateggsgreg