Skip to content

Numpy crashes during tests with a "Illegal instruction (core dumped)". #9532

Closed

Description

Hello,

I've run into a really cryptic problem with numpy's functionality on a virtual machine running Ubuntu 16.04 with ~2GB of RAM (just a tad less) and 100MB of video memory on Python2.7. The virtual machine was done on my laptop and then exported. It was tested on another laptop where it worked. When we tried running it on third laptop it kept crashing. The laptop configuration is:

OS Name	Microsoft Windows 10 Pro
Version	10.0.14393 Build 14393
Other OS Description 	Not Available
OS Manufacturer	Microsoft Corporation
System Name	DESKTOP-N693E6G
System Manufacturer	LENOVO
System Model	80EW
System Type	x64-based PC
System SKU	LENOVO_MT_80EW_BU_idea_FM_Lenovo B50-80
Processor	Intel(R) Core(TM) i3-5005U CPU @ 2.00GHz, 2000 Mhz, 2 Core(s), 4 Logical Processor(s)
BIOS Version/Date	LENOVO A8CN51WW(V3.04), 26.2.2016.
SMBIOS Version	2.7
Embedded Controller Version	3.51
BIOS Mode	Legacy
BaseBoard Manufacturer	LENOVO
BaseBoard Model	Not Available
BaseBoard Name	Base Board
Platform Role	Mobile
Secure Boot State	Unsupported
PCR7 Configuration	Binding Not Possible
Windows Directory	C:\WINDOWS
System Directory	C:\WINDOWS\system32
Boot Device	\Device\HarddiskVolume1
Locale	Hrvatska
Hardware Abstraction Layer	Version = "10.0.14393.1378"
User Name	DESKTOP-N693E6G\Korisnik
Time Zone	Central European Daylight Time
Installed Physical Memory (RAM)	4,00 GB
Total Physical Memory	3,92 GB
Available Physical Memory	1,30 GB
Total Virtual Memory	5,79 GB
Available Virtual Memory	1,95 GB
Page File Space	1,88 GB
Page File	C:\pagefile.sys
Hyper-V - VM Monitor Mode Extensions	Yes
Hyper-V - Second Level Address Translation Extensions	Yes
Hyper-V - Virtualization Enabled in Firmware	No
Hyper-V - Data Execution Protection	Yes

The error manifests itself as an Illegal instruction (core dumped) and the shell restarts, or if you ran the program from the terminal you get back to a clean terminal line. Eventually the error was tracked to a np.where command which seems to reproduce the behavior consistently. I've used the following code to test it:

student@vsa:~/Desktop/PracticeExamples/6_contours_fitObj$ cat test.py
import numpy as np

a = np.arange(0, 100, 1)
np.where(a>90)

When I run it with gdb I get:

student@vsa:~/Desktop/PracticeExamples/6_contours_fitObj$ gdb -ex r --args python test.py
GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.04) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from python...(no debugging symbols found)...done.
Starting program: /usr/bin/python test.py
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/i386-linux-gnu/libthread_db.so.1".

Program received signal SIGILL, Illegal instruction.
0xb61338a8 in LONG_greater_avx2 (args=args@entry=0xbfffe52c,
    dimensions=dimensions@entry=0xbfffe538, steps=steps@entry=0xbfffe544,
    __NPY_UNUSED_TAGGEDfunc=__NPY_UNUSED_TAGGEDfunc@entry=0x0)
    at numpy/core/src/umath/loops.c.src:936
936    numpy/core/src/umath/loops.c.src: No such file or directory.
(gdb) bt
#0  0xb61338a8 in LONG_greater_avx2 (args=args@entry=0xbfffe52c,
    dimensions=dimensions@entry=0xbfffe538, steps=steps@entry=0xbfffe544,
    __NPY_UNUSED_TAGGEDfunc=__NPY_UNUSED_TAGGEDfunc@entry=0x0)
    at numpy/core/src/umath/loops.c.src:936
#1  0xb617d5a6 in trivial_three_operand_loop (op=op@entry=0xbfffe8f0,
    innerloop=0xb61337ac <LONG_greater_avx2>, innerloopdata=0x0)
    at numpy/core/src/umath/ufunc_object.c:1339
#2  0xb61856d7 in execute_legacy_ufunc_loop (arr_prep_args=0x0, arr_prep=0xbfffe680,
    buffersize=8192, order=NPY_KEEPORDER, dtypes=0xbfffe600, op=0xbfffe8f0,
    trivial_loop_ok=<optimized out>, ufunc=0x84eadb8) at numpy/core/src/umath/ufunc_object.c:1700
#3  PyUFunc_GenericFunction (ufunc=ufunc@entry=0x84eadb8, args=args@entry=0xb7cda78c,
    kwds=kwds@entry=0x0, op=op@entry=0xbfffe8f0) at numpy/core/src/umath/ufunc_object.c:2749
#4  0xb61869c0 in ufunc_generic_call (ufunc=0x84eadb8, args=0xb7cda78c, kwds=0x0)
    at numpy/core/src/umath/ufunc_object.c:4411
#5  0x080f90d9 in PyObject_Call ()
#6  0x081017e9 in PyObject_CallFunctionObjArgs ()
#7  0xb79a2dd7 in PyArray_GenericBinaryFunction (m1=0xb7a73a98, m2=0x8412c3c, op=0x84eadb8)
    at numpy/core/src/multiarray/number.c:260
#8  0x080f4f1c in PyObject_RichCompare ()
#9  0x08111a00 in PyEval_EvalFrameEx ()
#10 0x0810a47b in PyEval_EvalCodeEx ()
#11 0x0810a26e in PyEval_EvalCode ()
#12 0x08139418 in ?? ()
#13 0x08133ea5 in PyRun_FileExFlags ()
#14 0x08132838 in PyRun_SimpleFileExFlags ()
#15 0x08132684 in PyRun_AnyFileExFlags ()
#16 0x080e65bc in Py_Main ()
#17 0x080e5ec6 in main ()
(gdb) p a
No symbol "a" in current context.
(gdb) u

Program terminated with signal SIGILL, Illegal instruction.
The program no longer exists.
(gdb) 

not sure if relevant but numpy also consistently fails to survive the tests on the buss dates:

student@vsa:~/Desktop/PracticeExamples/6_contours_fitObj$ python
Python 2.7.12 (default, Nov 19 2016, 06:48:10)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> numpy.__version__
'1.13.1'
>>> numpy.__file__
'/usr/local/lib/python2.7/dist-packages/numpy/__init__.pyc'
>>> numpy.test(verbose=10)
Running unit tests for numpy
NumPy version 1.13.1
NumPy relaxed strides checking option: True
NumPy is installed in /usr/local/lib/python2.7/dist-packages/numpy
Python version 2.7.12 (default, Nov 19 2016, 06:48:10) [GCC 5.4.0 20160609]
nose version 1.3.7
nose.config: INFO: Ignoring files matching ['^\\.', '^_', '^setup\\.py$']
test_complex (test_abc.ABC) ... ok
test_floats (test_abc.ABC) ... ok
test_int (test_abc.ABC) ... ok
test_uint (test_abc.ABC) ... ok
test_api.test_array_array ... ok
test_api.test_fastCopyAndTranspose ... ok
test_api.test_array_astype ... ok
test_api.test_copyto_fromscalar ... ok
test_api.test_copyto ... ok
test_api.test_copyto_permut ... ok
test_api.test_copy_order ... ok
test_api.test_contiguous_flags ... ok
test_api.test_broadcast_arrays ... ok
Basic test of array2string. ... ok
Test custom format function for each element in array. ... ok
test_structure_format (test_arrayprint.TestArray2String) ... ok
This should only apply to 0-D arrays. See #1218. ... ok
test_arrayprint.TestArrayRepr.test_containing_list ... ok
test_arrayprint.TestArrayRepr.test_nan_inf ... ok
test_arrayprint.TestArrayRepr.test_self_containing ... ok
test_arrayprint.TestArrayRepr.test_subclass ... ok
test_str (test_arrayprint.TestComplexArray) ... ok
test_arrayprint.TestPrintOptions.test_basic ... ok
test_arrayprint.TestPrintOptions.test_formatter ... ok
test_arrayprint.TestPrintOptions.test_formatter_reset ... ok
test_arrayprint.TestPrintOptions.test_precision_zero ... ok
test_arrayprint.test_unicode_object_array ... ok
test_cast_overflow (test_datetime.TestDateTime) ... ok
test_compare_generic_nat (test_datetime.TestDateTime) ... ok
test_creation_overflow (test_datetime.TestDateTime) ... ok
test_datetime_add (test_datetime.TestDateTime) ... ok
test_datetime_arange (test_datetime.TestDateTime) ... ok
test_datetime_arange_no_dtype (test_datetime.TestDateTime) ... ok
test_datetime_array_find_type (test_datetime.TestDateTime) ... ok
test_datetime_array_str (test_datetime.TestDateTime) ... ok
test_datetime_as_string (test_datetime.TestDateTime) ... ok
test_datetime_as_string_timezone (test_datetime.TestDateTime) ... ok
test_datetime_busday_holidays_count (test_datetime.TestDateTime) ... Illegal instruction (core dumped)
student@vsa:~/Desktop/PracticeExamples/6_contours_fitObj$ 

The plan is to use the virtual machines on a summer school to avoid having to setup the whole machine for everyone individually which would include setting up the virtual machine, installing Ubuntu on it, installing numpy, scipy, fitsio and then compiling OpenCV 3.0. Some help would be greatly appreciated.

Thanks!

Activity

  1. juliantaylor commented on Aug 8, 2017

    @juliantaylor
    Contributor

    the virtual machine probably exports cpu capabilities your real cpu does not have.
    what is /proc/cpuinfo on the host and the guest?

  2. juliantaylor commented on Aug 8, 2017

    @juliantaylor
    Contributor

    hm the host is windows? that cpu should have avx2 so maybe the vm is configured to not support it but in a way numpy does not detect (numpy essentially uses cpuid)

  3. juliantaylor commented on Aug 8, 2017

    @juliantaylor
    Contributor

    In the guest avx2 is not listed in the flags, that is a misconfiguration when cpuid still returns it.
    Might make sense to put an extra check into numpy for wrongly configured vms

  4. juliantaylor commented on Aug 8, 2017

    @juliantaylor
    Contributor

    depends on the vm software used, there should be a way to change the cpu features the guest has somewhere in it.

  5. njsmith commented on Aug 8, 2017

    @njsmith
    Member

    I wonder how Linux is detecting avx2 if not via cpuid...

  6. juliantaylor commented on Aug 8, 2017

    @juliantaylor
    Contributor

    Reinstalling numpy won't change anything, numpy tries to detect avx2 at runtime via the cpuid instruction.
    It is strange that the VM sigills the instruction but still returns essentially wrong results with cpuid. Maybe the used VM software just doesn't support avx2 at all.

  7. njsmith commented on Aug 8, 2017

    @njsmith
    Member

    @ljetibo: @juliantaylor's theory is that numpy is like "hey, virtual CPU, do you support AVX2?" and it's like "yep, I sure do!" and then numpy's like "okay, here's some AVX2 instructions to execute!" and the virtual CPU is like "omgwtf are these I never heard of this AVX2 thing". This can happen if the VM hypervisor is buggy. (What hypervisor are you using btw?)

    @juliantaylor: I guess one way to eliminate this class of bugs entirely would be to make our AVX2 detection logic be: (1) try to execute some AVX2, (2) if we get SIGILL, then the CPU doesn't support AVX2. Making this actually work would require some gross stuff with signal handlers and longjmp though, plus I don't know, SEH or something on Windows? And we'd get some very confused bug reports by people trying to debug something else using gdb and seeing a SIGILL and freaking out. OTOH, "actually works" is a nice feature.

  8. bashtage commented on Aug 9, 2017

    @bashtage
    Contributor

    One solution would be to create your VM on a old CPU that doesn't have AVX2 (or possibly AVX, if you want maximum portability).

  9. bashtage commented on Aug 9, 2017

    @bashtage
    Contributor

    Also, that the Intel(R) Core(TM) i3-5005U CPU @ 2.00GHz laptop doesn't report AVX support, even though it should (http://ark.intel.com/products/84695/Intel-Core-i3-5005U-Processor-3M-Cache-2_00-GHz), suggests that laptop's OS is mis-configured, since OS support is required to use AVX.

  10. bashtage commented on Aug 9, 2017

    @bashtage
    Contributor

    I don't think setting up student PCs using Anaconda or Miniconda is particularly hard. You could easily provide a script that would do all of the work, even pinning packages if you need to.

  11. juliantaylor commented on Aug 9, 2017

    @juliantaylor
    Contributor

    to remove avx use you currently have to patch numpy/core/include/numpy/npy_common.h, the lines with AVX in them, e.g. just set all cases to 0.
    An environment variable to switch cpu instruction sets without recompile might be a good idea for the future.

  12. ghost closed this as completedon Aug 15, 2017
  13. snig-b commented on Aug 30, 2017

    @snig-b

    I ran into the same issue. I'm using a virtual environment but not a virtualbox, only virtualenv. The OS config remains the same. I have the following OS config for Ubuntu 16.04 (it has the avx flag):

    processor	: 0
    vendor_id	: GenuineIntel
    cpu family	: 6
    model		: 63
    model name	: Intel(R) Xeon(R) CPU E5-2698 v3 @ 2.30GHz
    stepping	: 2
    microcode	: 0x36
    cpu MHz		: 2300.068
    cache size	: 40960 KB
    physical id	: 0
    siblings	: 1
    core id		: 7
    cpu cores	: 1
    apicid		: 15
    initial apicid	: 15
    fpu		: yes
    fpu_exception	: yes
    cpuid level	: 15
    wp		: yes
    flags		: fpu de tsc msr pae cx8 apic sep cmov pat clflush mmx fxsr sse sse2 ss ht syscall nx lm constant_tsc rep_good nopl pni pclmulqdq ssse3 sdbg fma cx16 sse4_1 sse4_2 movbe popcnt tsc_deadline_timer aes f16c rdrand hypervisor lahf_lm abm epb fsgsbase bmi1 avx2 bmi2 erms dtherm ida arat pln pts
    bugs		:
    bogomips	: 4600.13
    clflush size	: 64
    cache_alignment	: 64
    address sizes	: 46 bits physical, 48 bits virtual
    power management:
    
    

    And the following on a separate laptop - mac:

    machdep.cpu.tsc_ccc.denominator: 0
    machdep.cpu.tsc_ccc.numerator: 0
    machdep.cpu.thread_count: 4
    machdep.cpu.core_count: 2
    machdep.cpu.address_bits.virtual: 48
    machdep.cpu.address_bits.physical: 36
    machdep.cpu.tlb.shared: 512
    machdep.cpu.tlb.data.large: 32
    machdep.cpu.tlb.data.small: 64
    machdep.cpu.tlb.inst.large: 8
    machdep.cpu.tlb.inst.small: 64
    machdep.cpu.cache.size: 256
    machdep.cpu.cache.L2_associativity: 8
    machdep.cpu.cache.linesize: 64
    machdep.cpu.arch_perf.fixed_width: 48
    machdep.cpu.arch_perf.fixed_number: 3
    machdep.cpu.arch_perf.events: 0
    machdep.cpu.arch_perf.events_number: 7
    machdep.cpu.arch_perf.width: 48
    machdep.cpu.arch_perf.number: 4
    machdep.cpu.arch_perf.version: 3
    machdep.cpu.xsave.extended_state1: 1 0 0 0
    machdep.cpu.xsave.extended_state: 7 832 832 0
    machdep.cpu.thermal.energy_policy: 0
    machdep.cpu.thermal.hardware_feedback: 0
    machdep.cpu.thermal.package_thermal_intr: 1
    machdep.cpu.thermal.fine_grain_clock_mod: 1
    machdep.cpu.thermal.core_power_limits: 1
    machdep.cpu.thermal.ACNT_MCNT: 1
    machdep.cpu.thermal.thresholds: 2
    machdep.cpu.thermal.invariant_APIC_timer: 1
    machdep.cpu.thermal.dynamic_acceleration: 1
    machdep.cpu.thermal.sensor: 1
    machdep.cpu.mwait.sub_Cstates: 135456
    machdep.cpu.mwait.extensions: 3
    machdep.cpu.mwait.linesize_max: 64
    machdep.cpu.mwait.linesize_min: 64
    machdep.cpu.processor_flag: 4
    machdep.cpu.microcode_version: 21
    machdep.cpu.cores_per_package: 8
    machdep.cpu.logical_per_package: 16
    machdep.cpu.extfeatures: SYSCALL XD EM64T LAHF RDTSCP TSCI
    machdep.cpu.leaf7_features: SMEP ERMS RDWRFSGS
    machdep.cpu.features: FPU VME DE PSE TSC MSR PAE MCE CX8 APIC SEP MTRR PGE MCA CMOV PAT PSE36 CLFSH DS ACPI MMX FXSR SSE SSE2 SS HTT TM PBE SSE3 PCLMULQDQ DTES64 MON DSCPL VMX EST TM2 SSSE3 CX16 TPR PDCM SSE4.1 SSE4.2 x2APIC POPCNT AES PCID XSAVE OSXSAVE TSCTMR AVX1.0 RDRAND F16C
    machdep.cpu.brand: 0
    machdep.cpu.signature: 198313
    machdep.cpu.extfeature_bits: 4967106816
    machdep.cpu.leaf7_feature_bits: 641
    machdep.cpu.feature_bits: 9203919201183202303
    machdep.cpu.stepping: 9
    machdep.cpu.extfamily: 0
    machdep.cpu.extmodel: 3
    machdep.cpu.model: 58
    machdep.cpu.family: 6
    machdep.cpu.brand_string: Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz
    machdep.cpu.vendor: GenuineIntel
    machdep.cpu.max_ext: 2147483656
    machdep.cpu.max_basic: 13
    

    On which it works

    Incidently an np.array comparison
    np.array(range(0,31)) < 0
    works for upto this length of the list, but all other lengths greater than this fail with Illegal Instruction.
    Any help regarding this is appreciated.

  14. juliantaylor commented on Sep 1, 2017

    @juliantaylor
    Contributor

    that is very odd, so you are using real hardware no virtual machine and it still crashes? virtualenv has nothing to do with virtual machines.
    That should not happen was your machine does support avx2 according to the cpuinfo.
    Can you run this script on your machine?
    Put into a .c file and compile with gcc -mavx2 file.c and run the resulting ./a.out file and just see if it crashes or not.

    #include <immintrin.h>
    int main(void)
    {
        __m256i v1 = _mm256_set1_epi32(5);
        __m256i v2 = _mm256_set1_epi32(7);
        __m256i v3 = _mm256_add_epi32(v1 , v2);
        int r[8];
        _mm256_storeu_si256((__m256i *)&r[0], v3);
    }
    
  15. snig-b commented on Sep 3, 2017

    @snig-b

    I ran the test, and yeah it is crashing.
    What is missing in the system?

  16. juliantaylor commented on Sep 3, 2017

    @juliantaylor
    Contributor

    Odd that cpu is supposed to have avx2 according to intel and the OS is definitely new enough to support it. I am not aware of any method to disable the instructions and keep the kernel reporting it available.
    So I do not know what is wrong.

  17. mknorps commented on Jan 29, 2018

    @mknorps

    I have the same problem on my VM. As @juliantaylor suggested, I changed lines with AVX in them to 0 in numpy/core/include/numpy/npy_common.h, but I have problem with building numpy with those changes:

    (venv) knorpma1@knorpma1-VirtualBox:~/Documents/DATA_projects/venv/lib/python3.5/site-packages/numpy/core$ python setup.py build_ext -i
    Traceback (most recent call last):
      File "setup.py", line 14, in <module>
        from numpy._build_utils.apple_accelerate import (
    ImportError: No module named 'numpy._build_utils'
    

    Can you help me?

    The setup of my virtual environment:

    (venv) knorpma1@knorpma1-VirtualBox:~/Documents/DATA_projects/venv/lib/python3.5/site-packages/numpy/core$ pip list
    numpy (1.14.0)
    pandas (0.22.0)
    pip (9.0.1)
    pkg-resources (0.0.0)
    python-dateutil (2.6.1)
    pytz (2017.3)
    setuptools (38.4.0)
    six (1.11.0)
    wheel (0.30.0)
    

    EDIT:
    I needed to download module 'numpy._build_utils' from numpy/numpy github code, because it is not included in pip release. Now

    python setup.py ...
    

    works,
    but even after changing lines with AVX in to 0 the program test.py is crashing.

  18. njsmith commented on Jan 29, 2018

    @njsmith
    Member
  19. krassowski commented on Jan 29, 2018

    @krassowski

    @mknorps, if I remember correctly, this worked for me:

    # beeing inside of your virtual environment:
    pip uninstall numpy
    git clone https://github.com/numpy/numpy.git numpy
    cd numpy
    # now edit and comment out 8 lines in numpy/core/setup_common.py
    # that refer to "avx2" or "LINK_AVX2" - these are in two global lists:
    # OPTIONAL_INTRINSICS and OPTIONAL_FUNCTION_ATTRIBUTES
    pip install cython
    python3 setup.py install

    This assumes that you have standard build tools and python3-dev installed.
    For more detailed instructions refer to https://docs.scipy.org/doc/numpy/user/building.html

    Just to prevent any doubts, here is my git diff:

    diff --git a/numpy/core/setup_common.py b/numpy/core/setup_common.py
    index 1fe9539..04626ea 100644
    --- a/numpy/core/setup_common.py
    +++ b/numpy/core/setup_common.py
    @@ -142,10 +142,10 @@ OPTIONAL_INTRINSICS = [("__builtin_isnan", '5.'),
                            ("_mm_load_pd", '(double*)0', "emmintrin.h"),  # SSE2
                            ("__builtin_prefetch", "(float*)0, 0, 3"),
                            # check that the linker can handle avx
    -                       ("__asm__ volatile", '"vpand %xmm1, %xmm2, %xmm3"',
    -                        "stdio.h", "LINK_AVX"),
    -                       ("__asm__ volatile", '"vpand %ymm1, %ymm2, %ymm3"',
    -                        "stdio.h", "LINK_AVX2"),
    +                       #("__asm__ volatile", '"vpand %xmm1, %xmm2, %xmm3"',
    +                       # "stdio.h", "LINK_AVX"),
    +                       #("__asm__ volatile", '"vpand %ymm1, %ymm2, %ymm3"',
    +                       # "stdio.h", "LINK_AVX2"),
                            ]
     
     # function attributes
    @@ -157,10 +157,10 @@ OPTIONAL_FUNCTION_ATTRIBUTES = [('__attribute__((optimize("unroll-loops")))',
                                      'attribute_optimize_opt_3'),
                                     ('__attribute__((nonnull (1)))',
                                      'attribute_nonnull'),
    -                                ('__attribute__((target ("avx")))',
    -                                 'attribute_target_avx'),
    -                                ('__attribute__((target ("avx2")))',
    -                                 'attribute_target_avx2'),
    +                                #('__attribute__((target ("avx")))',
    +                                # 'attribute_target_avx'),
    +                                #('__attribute__((target ("avx2")))',
    +                                # 'attribute_target_avx2'),
                                     ]
     
     # variable attributes tested via "int %s a" % attribute
  20. mknorps commented on Jan 30, 2018

    @mknorps

    Thank you for your help, this solved this issue indeed.
    Unfortunately after restart my virtual machine does not boot, but this is whole another issue with Virtual Box, specificaly with running 32 bit guest system on 64 bit host.

  21. pcordes commented on Dec 8, 2022

    @pcordes

    BTW, disabling AVX support in NumPY is a backwards approach if your CPU does support AVX. AVX (and FMA3) are quite helpful for throughput in some types of problems, so you want to use it. Fix your VM, and/or your ancient guest OS, so AVX works properly.

    I ran into the same issue. I'm using a virtual environment but not a virtualbox, only virtualenv. The OS config remains the same. I have the following OS config for Ubuntu 16.04 (it has the avx flag):

    No, it doesn't. That /proc/cpuinfo includes avx2 but not avx. So perhaps that's why the guest kernel wouldn't set the control-register bit to allow AVX1/2 instruction to run without faulting, if it was just looking for the base AVX feature bit. (That's the one that matters for context switches saving full YMM registers).

    A CPUID that reports AVX2 but not AVX1 is a broken config, only possible in a VM (since the cpuid instruction is always a vm-exit, so the VM can tweak what feature flags and other info the guest sees).

    Related:

    NumPY uses cpuid in the guest (via GCC's builtin) to check for AVX2 and AVX. (And FMA3).

    IDK why people would be getting crashes with a non-ancient OS like Ubuntu 16.04, unless a VM is screwing up XCR0 settings, if the VM exposes AVX feature bits to the guest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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