AMD Sends Out Basic Zen 4 "Znver4" Enablement For The GCC Compiler
AMD has posted the "basic enablement patch" for the new Znver4 target with the GCC compiler. While coming post-launch, sadly this is indeed basic: it's still carrying over the same tunings as Zen 3 without any update cost tables for instruction latency differences, etc. Hopefully we will see them improve their Znver4 target with time but sadly refining the Zen compiler targets particularly with GCC has been a rare occurrence.
So what this amounts to at this point is getting -march=native working for Zen 4, honoring -march=znver4, and then over the Znver3 target just flipping on AVX512F, AVX512DQ, AVX512IFMA, AVX512CD, AVX512BW, AVX512VL, AVX512BF16, AVX512VBMI, AVX512VBMI2, GFNI, AVX512VNNI, AVX512BITALG, and AVX512VPOPCNTDQ.
For now the initial Znver4 GCC enablement is on the mailing list and looking to get it into GCC 13 trunk for that feature release due out around next April. Hopefully before then they manage to get out the optimized cost tables / tunings and any other compiler-side optimizations for Zen 4.
Sadly this is yet another example of the new GCC compiler support from AMD coming rather tardy post-launch and given the compiler release schedules means this Znver4 support won't be widespread in released versions of compilers and Linux distributions until next year. Meanwhile Intel generally gets their new CPU compiler support added to GCC (and Clang) usually years ahead of schedule especially in cases of major ISA additions. This same week as AMD posting Zen 4 for GCC saw Intel with the GCC patches for Meteor Lake and Sierra Forest.