The Impact Of GCC Zen Compiler Tuning On AMD Ryzen Performance

Written by Michael Larabel in Software on 3 March 2017 at 09:52 AM EST. Page 1 of 5. 50 Comments.

The latest in our AMD Ryzen Linux benchmarking is looking at the impact of compiled binaries when making use of Zen "znver1" compiler optimizations with the GNU Compiler Collection (GCC) compared to other optimization levels like Bulldozer and K8-SSE3.

With the AMD Ryzen 7 1800X running on Ubuntu 17.04 development with Linux 4.10 and GCC 6.3, I carried out some compiler benchmarks when trying different tuning levels for the Ryzen processor. It was way back in March of 2015 when AMD began on Zen support in GCC with the introduction of the "znver1" CPU type for signifying the first version of Zen.

The znver1 Family 17h CPU type for GCC enables 64-bit instructions and includes the instruction set extensions for BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX, SHA, CLZERO, AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, and POPCNT. The new instructions over Excavator / bdver4 is ADCX, RDSEED, MWAITX, SHA, CLZERO, XSAVEC, XSAVES, CLFLUSHOPT, and POPCNT.

But with Zen being a clean-sheet design, there are some instruction set extensions found in Bulldozer processors not found in Zen/znver1. Those no longer present include FMA4 and XOP.

GCC AMD Ryzen Zen znver1 Compiler Optimizations

The CFLAGS/CXXFLAGS tested for this benchmarking comparison were "-O3" for a very generic optimized build, "-O3 -march=k8-sse3" for K8 SSE3 for those old K8s that added SSE3 support, "-O3 -march=bdver1" for first-generation Bulldozer support, "-O3 -march=bdver4" for the Excavator level and last of Bulldozer architecture, and then finally "-O3 -march=znver1" for the Zen optimizations. But as mentioned with Bulldozer having some instruction set extensions not supported by Zen, during the bdver1/bdver4 benchmarks not all of the tests would run for those tests that ended up making use of FMA4/XOP, but still some of the tests did run so that's why I left in those bdver1/bdver4 tests.

All of these Linux compiler benchmarks were carried out in a fully-automated and reproducible manner using the open-source Phoronix Test Suite benchmarking software. As mentioned in other articles, I will also have Ryzen GCC vs. LLVM Clang benchmarks, tests of the upcoming GCC 7 compiler, and other Ryzen Linux benchmarks in the days ahead.


Related Articles