GCC 12 Compiler Optimization Tuning With The AMD Ryzen Threadripper 3990X

Written by Michael Larabel in Software on 19 July 2022. Page 1 of 5. 16 Comments

Following the recent discussions about -O3'ing the Linux kernel and other compiler optimizations, a request came in to see some fresh GCC compiler optimization benchmarks with the recently released GCC 12. So here is a fresh look at various GCC optimization levels up through -Ofast as well as with link-time optimizations (LTO) and "-march=native" tuning on the new GCC 12 with the mature AMD Ryzen Threadripper 3990X platform.

As some fresh reference benchmarks with various GCC compiler optimizations, various user-space application workloads/benchmarks were built with the following CFLAGS/CXXFLAGS:

-O2 -march=native
-O3 -march=native
-Ofast -march=native
-O2 -march=native -flto
-O3 -march=native -flto
-Ofast -march=native -flto

All of the testing was making use of GCC 12.1.1 as shipped by Fedora Workstation 36 as one of the first Linux distributions using GCC 12 stable along with the rest of the bleeding-edge open-source GNU toolchain. All of the testing occurred on an AMD Ryzen Threadripper 3990X workstation.

No other changes were made to the system state besides rebuilding all of the tests each time with the different CFLAGS/CXXFLAGS under test.

Related Articles