Skip to content

Building NumPy from source for Windows on ARM using Clang-cl compiler #28106

Closed
@Mugundanmcw

Description

@Mugundanmcw

Hello Developers,

  • I am facing an issue while trying to build NumPy for Windows on ARM (WoA) using the Clang-cl compiler. Building NumPy from source requires C and C++ compilers with proper intrinsic support.
  • Previously, I was able to successfully compile NumPy for WoA using the MSVC-optimized C/C++ CL compiler, enabling CPU baseline features that support ARM.
  • However, I encountered limitations with the MSVC C/C++ CL compiler, as it does not support certain CPU dispatcher features like ASIMDHP, ASIMDFHM, and SVE. Is there any specific reason why these CPU dispatch features are not supported for WoA in MSVC?
  • Meanwhile, I attempted to compile NumPy for WoA using the clang-cl compiler (both from MSVC and LLVM toolchains) to check if the CPU dispatcher features would be enabled. While I found that, apart from SVE, all other test features—including baseline features—were supported, I ran into compilation errors due to unidentified instructions.

Steps to Reproduce

  1. Clone the Source code of NumPy and checkout to latest branch
  2. Install LLVM toolchain/MSVC clang toolset
  3. Remove the clang and clang++ from the bin directory to avoid conflicts
  4. Add the bin path at the top of environment path variable

Compilers used for compilation:
image

Error and Workaround:

  1. While building meson_cpu target, got an error with respect to invalid operand "fstcw" in multiarray_tests_c source file. Upon going through source code, the fstcw is floating-point control instructions for x86 assembly. So I made workaround to make one more condition to check whether it is a ARM64 arch build. Then the build proceeded:
    Screenshot 2025-01-06 123245
    Workaround:
    before:
    image
    After:
    image

Issue:

  1. Currently the build fails at 240+ targets while compiling meson_cpu due to unidentified assembly instructions:
    image

Can anyone give some suggestions to overcome this issue? I need enable CPU dispatch support for NumPy on WoA to get better optimised version of NumPy.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    component: SIMDIssues in SIMD (fast instruction sets) code or machinery

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions