-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Add Apple M4 host detection #117530
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
Add Apple M4 host detection #117530
Conversation
✅ With the latest revision this PR passed the C/C++ code formatter. |
7944594
to
82bd606
Compare
6074a26
to
7b5d723
Compare
78fd5d4
to
a9966d9
Compare
llvm/lib/TargetParser/Host.cpp
Outdated
case CPUFAMILY_ARM_EVEREST_SAWTOOTH: // A16 | ||
case CPUFAMILY_ARM_IBIZA: // M3 | ||
case CPUFAMILY_ARM_PALMA: // M3 Max | ||
case CPUFAMILY_ARM_COLL: // A17 |
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.
apple-a17
is it's own thing, this shouldn't get merged with apple-m3
. See the ProcessorAlias<>
entries in AArch64Processors.td
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.
Hmm, why is apple-m3
aliased to apple-a16
and not apple-a17
in the first place?
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.
apple-m3
shouldn't be (and isn't) aliased with apple-a17
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.
But why not? The Wikipedia article (which of course isn't a reliable resource) lists Apple M3 as a variant of Apple A17 Pro?
In any case, apple-a16
and apple-a17
don't seem to have any functional differences in the source code (yet), so the point is perhaps a bit moot anyways?
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.
Wikipedia isn't a reliable source for this at all. Those pages often quote llvm's tablegen files as a source of truth on things, which sometimes aren't precisely correct for various reasons, both upstream-visible, and sometimes not-upstream-visible ones that I'm not going to explain here. We have them as separate processor definitions in AArch64Processors.td
for reasons, and as lame of a justification that is, this code should respect that.... please.
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.
Fair, apologies if it came out wrong, my intention wasn't to contest your knowledge, I was mostly just curious ;)
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.
Yea, sorry, these things sometimes tread close to topics we can't really discuss externally.
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.
No worries!
I've updated the PR, please verify that you think it's correct?
a9966d9
to
6aa2846
Compare
Also add support for older ARM families (this is likely never going to get used, since only macOS is officially supported as host OS, but nice to have for completeness sake). Error handling (checking CPUFAMILY_UNKNOWN) is also included here. Finally, add links to extra documentation to make it easier for others to update this in the future. These values should be up to date with Xcode 16.2 beta 3.
6aa2846
to
b4efe4b
Compare
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.
Forgot about this... sorry. LGTM
No problem! (I can't merge it myself, btw, if you're expecting that ;) ). |
Add Apple M4 host detection, which fixes rust-lang/rust#133414.
Also add support for older ARM families (this is likely never going to get used, since only macOS is officially supported as host OS, but nice to have for completeness sake). Error handling (checking
CPUFAMILY_UNKNOWN
) is also included here.Finally, add links to extra documentation to make it easier for others to update this in the future.
NOTE: These values are taken from
mach/machine.h
the Xcode 16.2 SDK, and has been confirmed on an M4 Max in rust-lang/rust#133414 (comment).