Skip to content

apple-m3 detected as the native CPU for nightly rustc on apple-m4 #133414

Closed
llvm/llvm-project
#117530
@mmizutani

Description

@mmizutani

I tried the following code with the latest nightly toolchain on a MacBook Pro M4 Max device:

$ rustup run nightly rustc --print target-cpus | head -n2

I expected to see this happen:

The output is expected to be as follows, indicating that the detected CPU is apple-m4.

Available CPUs for this target:
    native          - Select the CPU of the current host (currently apple-m4).

Instead, this happened:

The output indicates that the detected CPU is apple-m3, not apple-m4.

Available CPUs for this target:
    native          - Select the CPU of the current host (currently apple-m3).

The latest nightly rustc does recognize apple-m4 as a valid target-cpu, though:

$ rustup run nightly rustc --print=cfg -C target-cpu=apple-m4 | grep feature
target_feature="aes"
target_feature="bf16"
target_feature="bti"
...
target_feature="wfxt"

Meta

$ rustup run nightly rustc --version --verbose 

rustc 1.85.0-nightly (a47555110 2024-11-22)
binary: rustc
commit-hash: a47555110cf09b3ed59811d9b02235443e76a595
commit-date: 2024-11-22
host: aarch64-apple-darwin
release: 1.85.0-nightly
LLVM version: 19.1.4
$ /usr/sbin/sysctl -n machdep.cpu.brand_string
Apple M4 Max

As was the case in the past similar issue, #127448 (mis-detection of apple-m3 as apple-m2), this might be addressed by an upcoming update to the upstream LLVM.
This fix (llvm/llvm-project#106599) in LLVM 19.x might be relevant.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.C-external-bugCategory: issue that is caused by bugs in software beyond our controlO-AArch64Armv8-A or later processors in AArch64 modeO-appleOperating system: Apple (macOS, iOS, tvOS, visionOS, watchOS)T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.llvm-fixed-upstreamIssue expected to be fixed by the next major LLVM upgrade, or backported fixes

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions