Skip to content

illegal instruction on system without avx2 #203

@atom-andrew

Description

@atom-andrew

I'm trying to use python-blosc2 (2.6.2) on a system without avx2 but I'm getting an illegal instruction error on using avx2 instructions. The failed instruction disassembles as follows:

=> 0x00007f4773378934 <+212>:	vinserti128 $0x1,%xmm1,%ymm0,%ymm0

As you can see below (using gcc 10, which appears to be the major version used to compile the binary), avx2 is not reported as available on the system.

> cat builtin.c
#include <stdio.h>

int main(void) {
  __builtin_cpu_init();
  printf("%d\n", __builtin_cpu_supports ("sse2"));
  printf("%d\n", __builtin_cpu_supports ("avx"));
  printf("%d\n", __builtin_cpu_supports ("avx2"));
  printf("%d\n", __builtin_cpu_supports ("avx512bw"));
}
> /usr/bin/gcc-10 ./builtin.c; ./a.out
16
512
0
0

The c-blosc2 library I'm using is from the wheel and appears to be have been built with gcc 10.2.1:

strings -a  lib/python3.12/site-packages/blosc2/blosc2_ext.cpython-312-x86_64-linux-gnu.so | grep GCC
GCC: (GNU) 10.2.1 20210130 (Red Hat 10.2.1-11)

My expectation is that the library would not use shuffle_axv2 based on the runtime flags, but for some reason we python-blosc2 is trying to use it anyway. Is there any other reason that we might still try to use this despite the values from __builtin_cpu_supports? Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions