AMD Ryzen 9 5950X + GCC 11 Compiler Benchmarks At Varying Optimization Levels
Following last month's initial benchmarks of the AMD "znver3" support that landed in the GCC 11 compiler was a request by a premium supporter to see the AMD Zen 3 benchmarks at more compiler optimizations. Well, here are those numbers for those wanting to pursue aggressive compiler optimizations on a shiny AMD Ryzen 9 5950X.
As outlined last month, GCC 11 now has the initial "-march=znver3" CPU target support. However, this is basically a copy of the Zen 2 GCC code at this point with the few new Zen 3 instructions flipped on. There isn't yet any optimized scheduler model or other performance enhancements over the existing Znver2 support. So this articles does include both znver2 and znver3 runs for those interested.
On the AMD Ryzen 9 5950X test system running Ubuntu 20.04 LTS with the Linux 5.10 kernel and a snapshot of the feature-frozen GCC 11.0 compiler, the following CFLAGS/CXXFLAGS configurations were tested:
-O2 -march=x86-64
-O3 -march=x86-64
-O3 -march=znver2
-O2 -march=znver3
-O3 -march=znver3
-O2 -march=znver3 -flto
-O3 -march=znver3 -flto
-Ofast -march=znver3 -flto
So there is a mix of generic x86-64 and Zen2/Zen3 and common -O2 and -O3 optimization levels as well as -Ofast, plus runs with enabling link-time optimizations (LTO). Via the Phoronix Test Suite a wide range of open-source C/C++ benchmarks were used for providing these reference results on the Ryzen 9 5950X.