-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
Building NumPy from source for Windows on ARM using Clang-cl compiler #28106
Comments
Ping @Mousius, might be interesting to you (or you have a quick idea). |
@Mousius Any suggestions on this issue? |
These look like MSVC intrinsics - https://learn.microsoft.com/en-us/cpp/intrinsics/arm64-intrinsics?view=msvc-170. We do not have support for all of these in clang-cl at the moment. Just 2 days ago someone asked about this in fact - llvm/llvm-project#121689. Without knwoing the numpy source code I can't suggest how to work around this, but the table on the Microsoft page tells you what each one does and for example, one of them produces the https://developer.arm.com/documentation/100069/0606/Data-Transfer-Instructions/LDARB instruction. So in theory you could use alternative APIs to do the same thing. If anyone needs help figuring out the details of what the instructions do, I can help with that. As for adding these intrinsics to clang-cl, I'll expand on that in the LLVM issue. |
Ah, sorry, I misdiagnosed thinking it was related to SIMD (the second screenshot is so small... text would be easier). This seems to be related to the atomics definitions, ping @ngoldbaum, I thought these are borrowed from Python, so it seems a bit surprising. |
As a temporary workaround, it might work to edit the source so that the numpy/numpy/_core/src/common/npy_atomic.h Line 37 in 1d77082
I recall Linaro doing work for Windows on Arm Python but it may not have been using clang-cl. Edit: It was all done with msvc/Visual Studio not clang-cl. |
Is there any other workarounds I could perform for compiling NumPy on WoA? |
Unless you want to dig into it yourself, please be patient for at least a few days. This will be fixed, but don't expect it to be fixed within hours. |
I can install Windows in a VM on my ARM Macbook and hopefully reproduce this. Sorry for the trouble... By the way, what command are you using to build NumPy? IIRC you need to go a little out of your way to build with clang-cl properly. |
Is there a reason why STDC_ATOMICS isn't defined on the reporter's system? |
I just successfully built NumPy after making the patch to I suspect that there is something subtly wrong about the OP's compilation environment. Here's how I built NumPy, doing all this in a checkout of the NumPy repo: "[binaries]","c = 'clang-cl'","cpp = 'clang-cl'","ar = 'llvm-lib'","c_ld = 'lld-link'","cpp_ld = 'lld-link'" | Out-File $PWD/clang-cl-build.ini -Encoding ascii
pip install -r requirements/build_requirements.txt
spin build -- --vsenv --native-file=$PWD/clang-cl-build.ini Or alternatively via python -m pip install -v . --no-build-isolation -C'setup-args=--vsenv' -C'setup-args=--native-file='$PWD'\clang-cl-build.ini' I did this following our CI setup on github actions for clang-cl. |
OP is short for original post, I was referring to the patch you found for the multiarray tests file. You should be able to build NumPy using one of the commands I shared in my last comment after applying the patch you suggested for the tests file. At least right now with Please feel free to send in a pull request for the fix you found for the multiarray tests file. |
@ngoldbaum the following is my workflow to build NumPy natively on WoA
But still the error points out to the same issue: As per logic you said the code flow should enter stdatomic but still the definiton fails out to enter it |
I used MSVC's build of clang-cl. I don't know if it's possible to use clang's. Ping @rgommers who knows more about this than me. |
It should be possible in principle; we use I have no knowledge specific to WoA + Clang-cl though. |
I'm confused why |
Hello Developers,
Steps to Reproduce
Compilers used for compilation:
Error and Workaround:
Workaround:
before:
After:
Issue:
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!
The text was updated successfully, but these errors were encountered: