iains / gcc-darwin-arm64

GCC master branch for Darwin with experimental support for Arm64. Currently GCC-15.0.0 [September 2024]
GNU General Public License v2.0
268 stars 33 forks source link

Support -mcpu=apple-a12 #86

Closed fxcoudert closed 11 months ago

fxcoudert commented 2 years ago

clang supports passing apple-a12 as a valid CPU choice, probably GCC should align itself with that? Brings trouble in Julia: https://github.com/JuliaLang/julia/issues/44517

iains commented 2 years ago

At present we have no customisation of the CPU profiles for Apple Arm processors. It is something to add, although I am not 100% clear about what is published.

At least we can use the same set of features that clang does (where those are supported).

However things like scheduling etc. are much more complex - and it is hard to see how to implement them without documentation about the chip characteristics.

Courses of action:

fxcoudert commented 2 years ago

Yes, I think “not erroring out” would already be great.

giordano commented 2 years ago

Note that https://github.com/JuliaLang/julia/pull/44347 changed the flag to -mcpu=apple-m1.

Related question: what would be a good -mcpu value at the moment for this CPU? It isn't quite easy to just guess a close enough CPU from https://gcc.gnu.org/onlinedocs/gcc/AArch64-Options.html

Bo98 commented 2 years ago

Related question: what would be a good -mcpu value at the moment for this CPU? It isn't quite easy to just guess a close enough CPU from https://gcc.gnu.org/onlinedocs/gcc/AArch64-Options.html

In terms of -march, in LLVM it's something like -march=armv8.5-a+fullfp16+fp16fml+sha3. I think the GCC equivalent is something like -march=armv8.5-a+fp16+sha3+crypto+rcpc.

-mtune is harder so the safest is probably generic for now.

iains commented 11 months ago

This:

Sources of information;

Unfortunately, these sources are in conflict; in particular the clang-claimed feature set disagrees with the output of sysctl -a, and the base Arm revs. claimed in some cases miss features that ARM DDI 0487J.a lists as mandatory for the rev.

GCC does not seem to have a scheduler that is similar to the "Cyclone" one in LLVM - so I've guessed to use cortex57 (but, maybe we miss 8-issue, it's not clear - and my experience with the scheduler is ≈ 0).

Thus, the choices here are intended to be conservative.

TODO: