-
-
Notifications
You must be signed in to change notification settings - Fork 52
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
Test '-march=native' support for all architectures and platforms #96
Comments
Is this supported on other compilers like GCC and MSVC? |
I don't see the same problem with GCC. And I don't have an environment to test with MSVC. |
I tested inside Godbolt, and it seems that GCC doesn't support it either! gcc arm clang arm It also seems that It seems it only accepts the exact instruction set like AVX |
I found another issue while testing this. |
I'm glad you found that. Maybe my ARM machine is supported by GCC but not clang. The key is that not all ARM machines are supported by these two compilers with that flag. |
I suspect that the reason why your GCC test on Godbolt doesn't work is that Godbolt uses cross-compiling on an x86_64 machine and the "native" flag means using the processor's features of the host machine for compiling code, which doesn't work if the toolchain is for Arm and you ask it to optimize for a different type of CPU (e.g., x86_64). Therefore, for cross-compiling, the flag should be explicit for a relevant type of CPU. This article suggests that the optimization flag for x86 and Arm cannot be the same and we should use -mcpu for Arm and -march for x86: |
For GCC and clang, we can use I guess MSVC will have a similar way to test, but I don't have the environment for testing. Originally posted by @ljishen in #98 (comment) |
I found a project that does this! We can use that |
This flag fails on some ARM platforms including the Apple M1 (1, 2). We may be able to check whether it is supported by using
clang -march=native -cx /dev/null
(1, 2) before adding to the compile options.Upvote & Fund
I am using Polar.sh so you can upvote and help fund this issue. The funding is received once the issue is completed & confirmed by you.
Thank you in advance for helping prioritize & fund our backlog.
The text was updated successfully, but these errors were encountered: