archspec / archspec-json

Other
20 stars 32 forks source link

mcpu for apple clang version 14.0.0 and M2 incompatible #63

Closed jdoerfert closed 1 year ago

jdoerfert commented 1 year ago

For an M2 and apple clang > 13 it specifies -mcpu=vortex but that is not a supported cpu option. https://github.com/archspec/archspec-json/blob/b70be5ca6a072afdb731e47c3cea51faf0a54a10/cpu/microarchitectures.json#L2794

Supported options (except apple-latest which doesn't actually work):

clang --print-supported-cpus
Apple clang version 14.0.0 (clang-1400.0.29.202)
Target: arm64-apple-darwin22.3.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
Available CPUs for this target:

    a64fx
    apple-a10
    apple-a11
    apple-a12
    apple-a13
    apple-a14
    apple-a7
    apple-a8
    apple-a9
    apple-latest
    apple-m1
    apple-s4
    apple-s5
    carmel
    cortex-a34
    cortex-a35
    cortex-a510
    cortex-a53
    cortex-a55
    cortex-a57
    cortex-a65
    cortex-a65ae
    cortex-a72
    cortex-a73
    cortex-a75
    cortex-a76
    cortex-a76ae
    cortex-a77
    cortex-a78
    cortex-a78c
    cortex-r82
    cortex-x1
    cyclone
    exynos-m3
    exynos-m4
    exynos-m5
    falkor
    generic
    kryo
    neoverse-e1
    neoverse-n1
    neoverse-n2
    neoverse-v1
    saphira
    thunderx
    thunderx2t99
    thunderx3t110
    thunderxt81
    thunderxt83
    thunderxt88
    tsv110

I'm assuming we should fallback to m1 if m2 and a15/16 are not available. That said, it picks apple-a12 if you choose native.

Thoughts?

alalazo commented 1 year ago

Thanks for the report! That flag was added based on this discussion: https://github.com/archspec/archspec-json/pull/55#issuecomment-1276552320 Do you know of any authoritative places where to look for the appropriate microarchitecture flag to use for Apple M2?

The best I could find are sparse answers like: https://stackoverflow.com/questions/65966969/why-does-march-native-not-work-on-apple-m1

jdoerfert commented 1 year ago

Do you know of any authoritative places where to look for the appropriate microarchitecture flag to use for Apple M2?

Not really. I would probably reach out to apple people. Other than that, I would have chosen a12 as that is what native resolves too.