-
Notifications
You must be signed in to change notification settings - Fork 13.8k
std_detect on Darwin AArch64: update features #146397
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 not add to this block for the new detected features? Do the changes in this PR expose new stable surface area (I'm not super familiar with how std_detect is wired up...
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.
This commented out part of the list contains features that std_detect doesn’t currently keep track of; if and when any of them become trackable they should get moved to the non-commented list above. See
detect/arch/aarch64.rs
for the list of features that are currently tracked; it’s related to LLVM’s support for them.As for “stable surface area”, this changes it to the extent that existing code recompiled with a new Rust release may start detecting features on AArch64 Darwin that it didn’t before, if running on a sufficiently new Apple Silicon chip. That’s the only possible change; no new symbols are exposed, nor is any program able to ask/talk about anything new it couldn’t before. It just might get different answers to those existing questions than it used to, under the above circumstances.
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.
Can you write up a description of what answers are different with this PR?
Uh oh!
There was an error while loading. Please reload this page.
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.
Absolutely!
The specific questions whose answers might change are all of the form
is_aarch64_feature_detected!(…)
executed on an Apple OS on an Arm CPU, where…
is one of the following:"crc"
: this currently returnstrue
for all Apple Silicon chips; prior to this PR, there is a possibility that under future Apple OSes that answer could incorrectly becomefalse
. This PR ensures that it remainstrue
for the foreseeable future, accurately reflecting the presence of this mandatory CPU feature."mte"
: this currently always returnsfalse
on these platforms, reflecting that no current Apple Silicon CPU supports the Memory Tagging Extension. Apple have at this point publicly announced that their incoming A19 and A19 Pro CPUs support this feature, and it’s a safe bet given the history of Apple Silicon that future chips (M5 family and onward) will also have it. Darwin now exposes a way to check for this, so after this PR Rust code running on Darwin on such a near-future CPU will accurately reporttrue
to this question."sme2p1"
: Similarly to"mte"
’s case above, this is a feature that Darwin newly exposes a way to check for; it is version 2.1 of the Scalable Matrix Extension (SME). SME 2.0 is already exposed correctly on Apple M4/A18 family chips, and while no official word has come that A19/M5 will have SME 2.1, unofficial sources heavily suggest it, and taking advantage of the newly exposed ability to check for it is a good idea anyway.No other uses of
is_aarch64_feature_detected!
are changed by this PR, and it remains entirely unaffected on all non-Darwin platforms. The only other change to the non-commented code in this PR is to alphabetize the list properly since it was a bit out of order before; that doesn’t change the functionality of the code at all. Commented code is altered to reflect that Darwin now exposes a variety of subversions and subfeatures of MTE, of which only MTE(1) and MTE2 are somethingis_aarch64_feature_detected!
can ask about (and then only as a pair).