8000 import numpy crashes at xgetbv instruction in npy_cpu_supports on a VM · Issue #15342 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content
import numpy crashes at xgetbv instruction in npy_cpu_supports on a VM #15342
Closed
@ryandesign

Description

@ryandesign

Hi, I run the MacPorts automated build system and we have been experiencing an issue for awhile where import numpy causes Python to crash. I don't know if this happens for any users running macOS directly on their Macs but it does happen on one of our build machines—the one running macOS Sierra 10.12. The other build machines (which run earlier and later macOS versions) don't experience the problem. All the build machines are virtual machines running under VMware ESXi 6 on 2009-model Xserves.

I believe this is similar to or the same as #13059 but in case it's not I didn't want to mix up my information in that issue. In that issue, @eric-wieser speculated that HAVE_XGETBV is being set incorrectly. As my lldb trace below shows, we are crashing at the xgetbv instruction.

@seberg asked in #13059 if the problem was the VM claiming to support AVX when it does not. I have used the sample program posted by @ulido in #10330 to check whether the machine claims to have avx support (using __builtin_cpu_supports("avx")). In my case here in this macOS 10.12 VM, the sample program says "AVX not supported!"

Reproducing code example:

import numpy

Error message:

I am sorry, I am not familiar with gdb, but here's what happens under lldb:

Process 3114 resuming
Python 3.7.6 (default, Jan 17 2020, 18:32:15)
[Clang 9.0.0 (clang-900.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
Process 3114 stopped
* thread #2, queue = 'com.apple.main-thread', stop reason = EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
    frame #0: 0x000000010391c691 _multiarray_umath.cpython-37m-darwin.so`npy_cpu_supports + 118
_multiarray_umath.cpython-37m-darwin.so`npy_cpu_supports:
->  0x10391c691 <+118>: xgetbv
    0x10391c694 <+121>: andl   $0x76, %eax
    0x10391c697 <+124>: movl   $0x76, %ecx
    0x10391c69c <+129>: jmp    0x10391c6dc               ; <+193>
Target 0: (Python) stopped.

Numpy/Python version information:

Python 3.7.6
Numpy 1.18.1
macOS 10.12.6 Build version 16G2136
Xcode 9.2 Build version 9C40b
Apple LLVM version 9.0.0 (clang-900.0.39.2)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0