← Back to Pull requests

Update std_detect support for AArch64 Darwin #163516

Merged
pthariensflame merged 3 files (44 lines) on Nov 18, 2026 03:15 UTC
View on GitHub
pthariensflame pthariensflame commented on Sep 30, 2026 00:03 UTC
Author

This makes it current as of mid-October, 2026. This also relaxes the requirements on FEAT_FP8 to just be NEON/ASIMD, reflecting a similar relaxation already done in LLVM.

No part of this was done using LLMs in any capacity.

<!-- homu-ignore:start -->
<!--
Please read our [LLM policy] before opening a PR,
If you used an LLM to generate any part of this PR, including the PR description, please disclose that according to our [guidelines][disclosure guidelines].
LLM contributions are not banned, but are held to a higher standard of review and correctness.

[LLM policy]: https://forge.rust-lang.org/policies/llm-usage.html
[disclosure guidelines]: https://rustc-dev-guide.rust-lang.org/llm-guidance/writing.html#disclosure-guidelines

If this PR is related to an unstable feature or an otherwise tracked effort,
please link to the relevant tracking issue here. If you don't know of a related
tracking issue or there are none, feel free to ignore this.

This PR will get automatically assigned to a reviewer. In case you would like
a specific user to review your work, you can assign it to them by using

r? <reviewer name>

When merged, your PR's description becomes part of the commit message of a merge commit.
If you do not want certain parts of it (such as your LLM disclosure) to show up in the permanent git history,
surround them with a pair of HTML comments containing homu-ignore:start and homu-ignore:end.
-->
<!-- homu-ignore:end -->

Diff: 44 lines (+35 / -9) across 3 files Reviewer: davidtwco Review duration: 70751m
All Vouch review confidence checks passed
Residual risk 0.05 = Change Risk (0.34) × (1 − Review Confidence (0.85)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.34 · 44 lines diff across 3 files
0.34
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.87 · 5 substantive comment(s)
0.87
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 50%
85%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.228
Ai Authored ai_authored
0.050
Real PR Conversation Timeline
17 items
rustbot rustbot commented on Sep 30, 2026 00:03 UTC
Contributor

Some changes occurred in std_detect

cc @Amanieu, @folkertdev, @sayantn

rustbot rustbot commented on Sep 30, 2026 00:03 UTC
Contributor

r? @Darksonn

rustbot has assigned @Darksonn.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

<details>
<summary>Why was this reviewer chosen?</summary>

The reviewer was selected based on:

  • Owners of files modified in this PR: libs

  • libs expanded to 12 candidates

  • Random selection from Darksonn, JohnTitor, Mark-Simulacrum, clarfonthey, jhpratt
  • </details>

    Darksonn Darksonn commented on code on Sep 30, 2026 06:46 UTC
    Code Review
    library/std_detect/src/detect/os/darwin/aarch64.rs:1
    @@ -131,12 +137,15 @@ pub(crate) fn detect_features() -> cache::Initializer {
         enable_feature(Feature::dpb, dpb);
         enable_feature(Feature::dpb2, dpb2);
         enable_feature(Feature::ecv, ecv);
    +    enable_feature(Feature::faminmax, faminmax);
         enable_feature(Feature::fcma, fcma);
         enable_feature(Feature::fhm, fhm);
         enable_feature(Feature::flagm, flagm);
         enable_feature(Feature::flagm2, flagm2);
         enable_feature(Feature::fp, fp);
         enable_feature(Feature::fp16, fp16);
    +    enable_feature(Feature::fp8, fp8);

    This doesn't match the Linux check:

    https://github.com/rust-lang/rust/blob/c1bf6e13fa5ff2c753a49fd5ef37371c6fed729f/library/std_detect/src/detect/os/linux/aarch64.rs#L372-L373

    Note that the fp8 feature was changed in LLVM to depend on just neon rather than FeatureFAMINMAX, FeatureLUT, FeatureBF16 in https://github.com/llvm/llvm-project/pull/125874. But rustc still lists those three features. Should this also be updated to match LLVM?

    View changes since the review

    pthariensflame pthariensflame commented on code on Sep 30, 2026 16:47 UTC
    Code Review
    library/std_detect/src/detect/os/darwin/aarch64.rs:1
    @@ -131,12 +137,15 @@ pub(crate) fn detect_features() -> cache::Initializer {
         enable_feature(Feature::dpb, dpb);
         enable_feature(Feature::dpb2, dpb2);
         enable_feature(Feature::ecv, ecv);
    +    enable_feature(Feature::faminmax, faminmax);
         enable_feature(Feature::fcma, fcma);
         enable_feature(Feature::fhm, fhm);
         enable_feature(Feature::flagm, flagm);
         enable_feature(Feature::flagm2, flagm2);
         enable_feature(Feature::fp, fp);
         enable_feature(Feature::fp16, fp16);
    +    enable_feature(Feature::fp8, fp8);

    We have no idea; who would be the best person to consult for this?

    Darksonn Darksonn commented on code on Sep 30, 2026 17:02 UTC
    Code Review
    library/std_detect/src/detect/os/darwin/aarch64.rs:1
    @@ -131,12 +137,15 @@ pub(crate) fn detect_features() -> cache::Initializer {
         enable_feature(Feature::dpb, dpb);
         enable_feature(Feature::dpb2, dpb2);
         enable_feature(Feature::ecv, ecv);
    +    enable_feature(Feature::faminmax, faminmax);
         enable_feature(Feature::fcma, fcma);
         enable_feature(Feature::fhm, fhm);
         enable_feature(Feature::flagm, flagm);
         enable_feature(Feature::flagm2, flagm2);
         enable_feature(Feature::fp, fp);
         enable_feature(Feature::fp16, fp16);
    +    enable_feature(Feature::fp8, fp8);

    Hopefully one of the people cc'd above by the bot can help.

    folkertdev folkertdev commented on code on Sep 30, 2026 17:08 UTC
    Code Review
    library/std_detect/src/detect/os/darwin/aarch64.rs:1
    @@ -131,12 +137,15 @@ pub(crate) fn detect_features() -> cache::Initializer {
         enable_feature(Feature::dpb, dpb);
         enable_feature(Feature::dpb2, dpb2);
         enable_feature(Feature::ecv, ecv);
    +    enable_feature(Feature::faminmax, faminmax);
         enable_feature(Feature::fcma, fcma);
         enable_feature(Feature::fhm, fhm);
         enable_feature(Feature::flagm, flagm);
         enable_feature(Feature::flagm2, flagm2);
         enable_feature(Feature::fp, fp);
         enable_feature(Feature::fp16, fp16);
    +    enable_feature(Feature::fp8, fp8);

    cc @davidtwco @adamgemmell (target maintainers), but seems to me that we should follow LLVM here?

    adamgemmell adamgemmell commented on code on Oct 01, 2026 17:03 UTC
    Code Review
    library/std_detect/src/detect/os/darwin/aarch64.rs:1
    @@ -131,12 +137,15 @@ pub(crate) fn detect_features() -> cache::Initializer {
         enable_feature(Feature::dpb, dpb);
         enable_feature(Feature::dpb2, dpb2);
         enable_feature(Feature::ecv, ecv);
    +    enable_feature(Feature::faminmax, faminmax);
         enable_feature(Feature::fcma, fcma);
         enable_feature(Feature::fhm, fhm);
         enable_feature(Feature::flagm, flagm);
         enable_feature(Feature::flagm2, flagm2);
         enable_feature(Feature::fp, fp);
         enable_feature(Feature::fp16, fp16);
    +    enable_feature(Feature::fp8, fp8);

    Unfortunately it's a breaking change to do so as this example would require an unsafe context on the call:

    #[target_feature(enable="fp8")]
    fn fp8() {
        bf16();
    }
    
    #[target_feature(enable="bf16")]
    fn bf16() {}
    

    pthariensflame pthariensflame commented on code on Oct 01, 2026 21:54 UTC
    Code Review
    library/std_detect/src/detect/os/darwin/aarch64.rs:1
    @@ -131,12 +137,15 @@ pub(crate) fn detect_features() -> cache::Initializer {
         enable_feature(Feature::dpb, dpb);
         enable_feature(Feature::dpb2, dpb2);
         enable_feature(Feature::ecv, ecv);
    +    enable_feature(Feature::faminmax, faminmax);
         enable_feature(Feature::fcma, fcma);
         enable_feature(Feature::fhm, fhm);
         enable_feature(Feature::flagm, flagm);
         enable_feature(Feature::flagm2, flagm2);
         enable_feature(Feature::fp, fp);
         enable_feature(Feature::fp16, fp16);
    +    enable_feature(Feature::fp8, fp8);

    Unfortunately it's a breaking change to do so as this example would require an unsafe context on the call

    Would that be potentially solvable by use of a new feature (fp8cvt, name subject to bikeshedding) to represent the actual FEAT_FP8 and then redefining fp8 retroactively to imply fp8cvt+lut+bf16+faminmax?

    Or is it okay to do this breaking change as fp8 is currently unstable anyway?

    adamgemmell adamgemmell commented on code on Oct 02, 2026 09:04 UTC
    Code Review
    library/std_detect/src/detect/os/darwin/aarch64.rs:1
    @@ -131,12 +137,15 @@ pub(crate) fn detect_features() -> cache::Initializer {
         enable_feature(Feature::dpb, dpb);
         enable_feature(Feature::dpb2, dpb2);
         enable_feature(Feature::ecv, ecv);
    +    enable_feature(Feature::faminmax, faminmax);
         enable_feature(Feature::fcma, fcma);
         enable_feature(Feature::fhm, fhm);
         enable_feature(Feature::flagm, flagm);
         enable_feature(Feature::flagm2, flagm2);
         enable_feature(Feature::fp, fp);
         enable_feature(Feature::fp16, fp16);
    +    enable_feature(Feature::fp8, fp8);

    Oh, if fp8 is still unstable then we can just make that change :)

    pthariensflame pthariensflame commented on code on Oct 15, 2026 03:13 UTC
    Code Review
    library/std_detect/src/detect/os/darwin/aarch64.rs:1
    @@ -131,12 +137,15 @@ pub(crate) fn detect_features() -> cache::Initializer {
         enable_feature(Feature::dpb, dpb);
         enable_feature(Feature::dpb2, dpb2);
         enable_feature(Feature::ecv, ecv);
    +    enable_feature(Feature::faminmax, faminmax);
         enable_feature(Feature::fcma, fcma);
         enable_feature(Feature::fhm, fhm);
         enable_feature(Feature::flagm, flagm);
         enable_feature(Feature::flagm2, flagm2);
         enable_feature(Feature::fp, fp);
         enable_feature(Feature::fp16, fp16);
    +    enable_feature(Feature::fp8, fp8);

    If we wanted to make that change, where in the Rust repo would we do that?

    EDIT: Figured it out.

    rustbot rustbot commented on Oct 15, 2026 03:50 UTC
    Contributor

    Target features are being changed; ensure all ABI effects are being accounted for

    cc @RalfJung

    rustbot rustbot commented on Oct 15, 2026 03:50 UTC
    Contributor

    This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

    Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

    rustbot rustbot commented on Oct 28, 2026 04:20 UTC
    Contributor

    This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

    Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

    davidtwco davidtwco approved these changes on Nov 17, 2026 15:12 UTC
    Approved Reviewer

    Approved these changes.

    davidtwco davidtwco commented on Nov 17, 2026 15:12 UTC
    Contributor

    @bors r+ rollup

    rust-bors[bot] rust-bors[bot] commented on Nov 17, 2026 15:12 UTC
    Bot

    :pushpin: Commit c1cf18705fa49357a66a87020c6050405b2243c4 has been approved by davidtwco

    It is now in the queue for this repository.

    Reviewers
    Assignees
    pthariensflame pthariensflame
    Labels
    risk: low confidence: 85.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 33.7% (LOW) · Higher = larger blast radius
    33.7%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 85.5% · Lower = rushed or shallow review
    85.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 4.9% · Safe to merge
    4.9%
    Repository