Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: CPU detection fails in windows VM running on ARM Mac #25604

Closed
ngoldbaum opened this issue Jan 17, 2024 · 3 comments · Fixed by #25613
Closed

BUG: CPU detection fails in windows VM running on ARM Mac #25604

ngoldbaum opened this issue Jan 17, 2024 · 3 comments · Fixed by #25613
Labels
00 - Bug component: SIMD Issues in SIMD (fast instruction sets) code or machinery

Comments

@ngoldbaum
Copy link
Member

Describe the issue:

When I try to build numpy in the default configuration on an ARM Mac running an ARM Windows 11 VM via qemu, I get the build error below.

Building with spin build --clean -- -Ddisable-optimization=True lets me build though so this isn't a showstopper for my debugging session.

Reproduce the code example:

N/A

Error message:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\Nathan Goldbaum\numpy\build-install\usr\Lib\site-packages\numpy\__init__.py", line 114, in <module>
    from numpy.__config__ import show as show_config
  File "C:\Users\Nathan Goldbaum\numpy\build-install\usr\Lib\site-packages\numpy\__config__.py", line 4, in <module>
    from numpy._core._multiarray_umath import (
  File "C:\Users\Nathan Goldbaum\numpy\build-install\usr\Lib\site-packages\numpy\_core\__init__.py", line 23, in <module>
    from . import multiarray
  File "C:\Users\Nathan Goldbaum\numpy\build-install\usr\Lib\site-packages\numpy\_core\multiarray.py", line 10, in <module>
    from . import overrides
  File "C:\Users\Nathan Goldbaum\numpy\build-install\usr\Lib\site-packages\numpy\_core\overrides.py", line 8, in <module>
    from numpy._core._multiarray_umath import (
RuntimeError: NumPy was built with baseline optimizations:
(NEON NEON_FP16 NEON_VFPV4 ASIMD) but your machine doesn't support:
(NEON).

Python and NumPy Versions:

python 3.12.1 installed via python.org installer, numpy main.

Runtime Environment:

numpy doesn't install so I can't get this far.

Context for the issue:

No response

@mattip
Copy link
Member

mattip commented Jan 17, 2024

Weird, I thought qemu on M1 supported NEON. Maybe this is a windows-arm64 problem? What happens if you run an aarch64 VM in qemu, do you get NEON?

@ngoldbaum ngoldbaum added the component: SIMD Issues in SIMD (fast instruction sets) code or machinery label Jan 17, 2024
@ngoldbaum
Copy link
Member Author

ngoldbaum commented Jan 17, 2024

It compiles on an aarch64 Ubuntu VM, here's the show_runtime() output, not sure if NEON not being in 'found' means we didn't get NEON.

>>> import numpy; print(numpy.show_runtime())
[{'numpy_version': '2.0.0.dev0+git20240117.448e4da',
'python': '3.11.7 (main, Dec 12 2023, 21:30:01) [GCC 11.4.0]',
'uname': uname_result(system='Linux', node='ubuntuvm', release='5.15.0-91-generic', version='#101-Ubuntu SMP Tue Nov 14 13:29:11 UTC 2023', machine='aarch64')},
{'simd_extensions': {'baseline': ['NEON', 'NEON_FP16', 'NEON_VFPV4', 'ASIMD'],
'found': ['ASIMDHP', 'ASIMDFHM'],
'not_found': ['SVE']}}]
None

@mattip
Copy link
Member

mattip commented Jan 18, 2024

Successfully importing NumPy with this line means these CPU features are required and found:

simd_extensions': {'baseline': ['NEON', 'NEON_FP16', 'NEON_VFPV4', 'ASIMD'],

I wonder if npy__cpu_init_features() has a branch for windows + arm64. It seems the compiler defines macros differently to linux, so this check might be failing.

It is hard to get python + numpy running under the visual studio debugger to step through the code. Could you add some fprintf() debug statements and recompile to see which code is active there?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
00 - Bug component: SIMD Issues in SIMD (fast instruction sets) code or machinery
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants