-
Notifications
You must be signed in to change notification settings - Fork 13.7k
ggml-cpu: detect correct cpu flags for arm64 (#16229) #16239
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
Conversation
When using GCC 9 and GCC 12 on the arm64 platform of ubuntu 2004, the command "gcc -mcpu=native -E -v -" fails to detect the correct CPU flags, which results in compilation failures for certain extended instructions, but the correct CPU flags can be obtained by using gcc -march. Signed-off-by: lizhenneng <[email protected]>
|
Hi, Could you share the output of your test ? From my understanding, |
kylin@kylin-pc:~$ gcc -mcpu=native -E -v - |
|
Thanks for the help! |
|
up :) This PR is still relevant. gcc-12: gcc-14: |
ggerganov
left a comment
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.
It's still confusing to me how -mcpu and -march work and when to use one or the other. But it seems you've confirmed their usage, so should be good to merge.
Will let @slaren have the final word.
|
Indeed it is! The key point is that ARM's arch covers a very large range of CPUs. |
|
This is very hard to test for, and I am starting to think that this approach to detect the CPU features on ARM is never going to work reliably. It may make more sense to write a program that returns the features in a similar way to |
|
I agree the current approach is not ideal and we can definitely do something better, maybe similar to how I handle it in the new packaging layer: https://github.com/angt/target-features. But today, gcc 12 si still very common and does not optimize correctly for ARM. |
|
Ok, let's merge this to fix the immediate issue. |
|
Damn.... i commented the wrong PR... :( It was this one: #16333 |
…ggml-org#16239)" This reverts commit 7c23f3f.
When using GCC 9 and GCC 12 on the arm64 platform of ubuntu 2004, the command "gcc -mcpu=native -E -v -" fails to detect the correct CPU flags, which results in compilation failures for certain extended instructions, but the correct CPU flags can be obtained by using gcc -march.
Make sure to read the contributing guidelines before submitting a PR