-
Notifications
You must be signed in to change notification settings - Fork 17
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
Improve apple M1 support #384
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll leave it to @rosecers to test if this fixes her problem, I have a small question in the meantime
"${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang") | ||
# detect if the local architechture is arm64 or x86_64 | ||
if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "arm64") | ||
set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64" CACHE STRING "") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why build a universal binary instead of detecting which architecture we actually need?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought it would be needed to handle the case where you have a python distribution built for x86_64
while working on an arm64
. I need @rosecers input to check that it's actually working though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My understanding is that if Python is an x86_64
binary, it will only need x86_64
libraries. Rosetta 2 will then deal with the emulation of x86 on ARM. The main issue with building universal binary is the increased compile time (and file size when we upload this to PyPI).
If there is an easy way to detect the required architecture insead of doing both that would be nice, otherwise we'll survive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could not find one.
From the CI, it seems that compilation/runtime increased twofold causing the valgrind workflow to timeout. |
Just trying this now -- unfortunately it doesn't fix the issue and I get:
|
Ok then there is no point compiling for x86_64 then. Could you try to setup a native python environment and check that it works as it does on my machine ? |
Why? If the Python install is x86_64, we want to compile for that. For me the issue is also about |
From Rose's test it seems that the attempt to compile for both x86_64 and arm64 on arm64 failed.
The arch argument is set to native as default but can be very easily overiden at the cmake level so I am not sure to understand your concern. |
Because
My concern is 100% about the default value. By default, everything should work for everyone, and |
Fixed in #403 for now |
As referenced in #383, setting explicitly
-march
in the compilation arguments has yet to be supported by clang.Thanks to CMake, for the specific case of arm64 we can build universal binaries which work on my machine. I made the change so that it does not affect the build settings on other architectures.
We don't have a test in the CI for the arm64 architecture so could you check that it works on your machines ? @rosecers
Also, I am using clang from homebrew (built for arm64) so my current python does not use roseta.
Note that llvm 12 (current stable version) does not have arm64 as a target architecture even though it has apple-a14 which is basically the same). It seems that it should exist in llvm 13.