-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[AArch64] Improve host feature detection. #160410
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
base: main
Are you sure you want to change the base?
Conversation
✅ With the latest revision this PR passed the C/C++ code formatter. |
SVE depends on a combination of host support and operating system support. Sometimes those don't line up with detected host CPU name; make sure SVE is disabled when it isn't available. Implement this for both Windows and Linux. (We don't have a codepath for other operating systems. If someone wants to implement this, it should be possible to adapt fmv code from compiler-rt.) While I'm here, also add support for detecting other Windows CPU features. For Windows, declare constants ourselves so the code builds on older SDKs; we also do this in compiler-rt.
13bdb5f
to
fc5d883
Compare
On my Surface Pro 11 with a Qualcomm Snapdragon X I get:
|
Is that the same as what you get without the patch? I messed up the feature string for jscvt; I'll push a fix. (On a side-note, I just downloaded the newest SDK, and there are a bunch of new feature flags defined; we probably want to look at that at some point... but probably not in this patch.) |
Before the patch:
Looks like the patch adds the following target feature args:
|
Does not appear to have fixed feature detection on Linux or Android.
I'm not sure you're actually doing a feature check? I know cpuinfo does not have sve:
|
If the code inside the if statement is reached, it should disable SVE, I think. There are a few different ways we might not get there, I guess:
|
SVE depends on a combination of host support and operating system support. Sometimes those don't line up with detected host CPU name; make sure SVE is disabled when it isn't available. Implement this for both Windows and Linux. (We don't have a codepath for other operating systems. If someone wants to implement this, it should be possible to adapt fmv code from compiler-rt.)
While I'm here, also add support for detecting other Windows CPU features.
For Windows, declare constants ourselves so the code builds on older SDKs; we also do this in compiler-rt.
Currently untested; help testing for both Windows and Linux would be appreciated.