AMD Sends Out Zen 3 Compiler Support For GCC + AOCC 2.3 Compiler Released
Following last month's release of the Ryzen 5000 "Zen 3" processors, AMD has now begun publishing their official compiler support for this extremely compelling processor family.
For as extremely great as Zen 3 is, it's the belated compiler support as one of the few critiques we've had -- normally on the Intel side they are often plumbing their compiler targets and new instruction set extension support a year or more ahead of CPU launches (e.g. the most recent example back in July Intel added Alder Lake and Sapphire Rapids to GCC), and that's for when those processors are shipping on schedule. Having the compiler support out well ahead of the launches ensure the support is worked into stable compiler releases by the time the CPUs ship and ideally already used as the default compiler version in major Linux distribution releases. Intel generally remains spot-on in that regard while AMD has been much tighter -- or in the case of Zen 3, basically one month after launch.
Out this morning is the initial patch adding support for Zen 3 CPUs to the GNU Compiler Collection with the new "-march=znver3" option. The patch though is admittedly the "very basic enablement" and doesn't yet have any Zen 3 changes around the instruction cost tables, tuning, and scheduler differences with the architecture changes of Zen 3. For now all that specialized tuning is kept the same as Zen 2 -- which in the case of the scheduling at least, is still the same as Zen 1. At a later date that more precise tuning will come to the znver3 code for GCC.
This basic Znver3 enablement is looking to land in trunk now for GCC 11, which should debut in March~April as the annual update to the GNU Compiler Collection. That basic enablement patch will likely be allowed to land even though GCC 11 recently passed the end of feature development but given the timing likely means that any scheduler updates and other fine tuning won't land in time. That polished Znver3 support then won't come until GCC 12 or sought as a back-port later on for a GCC 11 point release. But due to the timing of these projects and the various launches, basically means a released/stable GCC compiler won't take full advantage of the Zen 3 microarchitecture until well into 2021. Hopefully AMD will be able to work on better timing alignment moving forward.
For now the GCC znver3 support basically takes the Zen 2 state while adding in the instructions for PKU, VPCLMULQDQ, and VAES. It's basically quite similar to the basic Znver3 support for LLVM that was done while waiting on AMD. I've heard AMD will be putting out their official Znver3 LLVM/Clang patch out soon.
Today they also released AOCC 2.3 as their LLVM Clang based compiler with various AMD Zen patches added. AOCC 2.3 remains tuned for Zen 2 and based on LLVM 11.0 upstream but does contain their initial Zen 3 support.
I'll be running some benchmarks shortly to see any impact from these Znver3 compiler updates on common workloads.