AMD Submits Initial Zen 5 Enablement For LLVM/Clang Compiler
Early in the year we enjoyed seeing AMD Zen 5 "znver5" support upstreamed for the GCC 14 compiler in making it into that annual GNU Compiler Collection feature release. It was great seeing AMD Zen 5 support make it into this open-source compiler well ahead of any Zen 5 products being announced. Since then the GCC support for the new Znver5 target has continued to be improve upon meanwhile we've been waiting to see similar treatment for the LLVM/Clang compiler stack. Finally this week that AMD Zen 5 (znver5) support has been submitted for review in upstreaming it for LLVM.
I was delighted to check this morning and see there's finally a pull request pending for adding Znver5 to upstream LLVM. Yesterday this pull request was opened by an AMD compiler engineer for adding the Zen 5 support to upstream open-source LLVM.
This adds the "-march=znver5" support for Clang, the Family 1Ah detection, and enabling the new instructions added into Zen 5 over Zen 4. This LLVM patch is still making use of the AMD Zen 4 tuning data without any new tuning metrics submitted by AMD. In time they'll hopefully have the tuned support for Zen 5 CPUs ready for upstreaming.
One bit I did enjoy in going through this compiler patch is that as a code comment they've added a bit of a decoder for the AMD Zen 5 model IDs... So far the GCC and Linux kernel patches and other Family 1Ah patches have just treated the models as all Zen 5 as model IDs 128 or less. This code comment for the LLVM Znver5 patch actually lays out what models belong to what codenames. Codenames covered include Breithorn, Breithorn-Dense, Strix 1, Strix 2, Strix 3, Granite Ridge, Weisshorn, Krackan1, and Sarlak. Those codenames really shouldn't come as a surprise but I don't believe "Strix 3" has been brought up in rumors yet. AMD "Weisshorn" was previously reported elsewhere as rumored to be a Zen 6 codename but given that it's showing up as part of this Zen 5 listing leads to that potentially being an inaccurate description.
In any case this Znver5 patch for LLVM is now undergoing review for hopefully merging soon to LLVM Git. The timing is a bit unfortunate though. Besides coming more than six months after the initial GCC Znver5 patch, this pull request is coming just days before the LLVM 19 compiler is being released as stable -- and that code being branched back in August. LLVM 19 stable will be out this week or next and it's too bad this Znver5 support didn't make it into that six-month compiler release but hopefully it will be back-ported to one of the LLVM 19.1 point releases otherwise users will need to wait until LLVM 20 around March of next year.
In any case this remains one of the areas I wish AMD would improve upon in providing compiler support sooner ahead of CPU launches given the long lead times between compiler releases and even longer until they are picked up by prominent Linux distributions. Intel does a good job here with often getting new core support 1~2 years ahead of time into GCC and Clang. LLVM 18 added Clearwater Forest and Panther Lake targets ahead of planned 2025 debut while only LLVM 20 or a LLVM 19 point release will be adding Zen 5 with the Ryzen AI 300 series and Ryzen 9000 series products already shipping.
For those not wanting to wait on a supported compiler release or looking for something to run on your aging enterprise Linux distribution, AMD will presumably release soon an updated version of its LLVM-based AOCC compiler with Zen 5 support.
I was delighted to check this morning and see there's finally a pull request pending for adding Znver5 to upstream LLVM. Yesterday this pull request was opened by an AMD compiler engineer for adding the Zen 5 support to upstream open-source LLVM.
This adds the "-march=znver5" support for Clang, the Family 1Ah detection, and enabling the new instructions added into Zen 5 over Zen 4. This LLVM patch is still making use of the AMD Zen 4 tuning data without any new tuning metrics submitted by AMD. In time they'll hopefully have the tuned support for Zen 5 CPUs ready for upstreaming.
One bit I did enjoy in going through this compiler patch is that as a code comment they've added a bit of a decoder for the AMD Zen 5 model IDs... So far the GCC and Linux kernel patches and other Family 1Ah patches have just treated the models as all Zen 5 as model IDs 128 or less. This code comment for the LLVM Znver5 patch actually lays out what models belong to what codenames. Codenames covered include Breithorn, Breithorn-Dense, Strix 1, Strix 2, Strix 3, Granite Ridge, Weisshorn, Krackan1, and Sarlak. Those codenames really shouldn't come as a surprise but I don't believe "Strix 3" has been brought up in rumors yet. AMD "Weisshorn" was previously reported elsewhere as rumored to be a Zen 6 codename but given that it's showing up as part of this Zen 5 listing leads to that potentially being an inaccurate description.
In any case this Znver5 patch for LLVM is now undergoing review for hopefully merging soon to LLVM Git. The timing is a bit unfortunate though. Besides coming more than six months after the initial GCC Znver5 patch, this pull request is coming just days before the LLVM 19 compiler is being released as stable -- and that code being branched back in August. LLVM 19 stable will be out this week or next and it's too bad this Znver5 support didn't make it into that six-month compiler release but hopefully it will be back-ported to one of the LLVM 19.1 point releases otherwise users will need to wait until LLVM 20 around March of next year.
In any case this remains one of the areas I wish AMD would improve upon in providing compiler support sooner ahead of CPU launches given the long lead times between compiler releases and even longer until they are picked up by prominent Linux distributions. Intel does a good job here with often getting new core support 1~2 years ahead of time into GCC and Clang. LLVM 18 added Clearwater Forest and Panther Lake targets ahead of planned 2025 debut while only LLVM 20 or a LLVM 19 point release will be adding Zen 5 with the Ryzen AI 300 series and Ryzen 9000 series products already shipping.
For those not wanting to wait on a supported compiler release or looking for something to run on your aging enterprise Linux distribution, AMD will presumably release soon an updated version of its LLVM-based AOCC compiler with Zen 5 support.
1 Comment