LLVM Clang 12 Performance Benchmarks On AMD Ryzen 9 5950X
With LLVM 12 due for release next month and GCC 11 not being far behind, it's the season for fresh compiler benchmarks. In today's article is a look at the AMD Ryzen 9 5950X (Zen 3) compiler performance between LLVM Clang 11.1 against the current LLVM Clang 12.0 Git development code in its feature-frozen state.
LLVM/Clang 12 brings initial albeit basic support for AMD Zen 3 (Znver3) that adds in the newly-supported instructions but is not yet fully-tuned/optimized. Outside of the Zen 3 addition, LLVM Clang 12 brings more C++20 support, the machine function splitter was merged, -mtune for x86/x86_64 CPUs, and a lot of additions and improvements to the various LLVM sub-projects. There is also support for forthcoming Intel and ARM processors and other improvements there, which will be benchmarked in their own separate forthcoming articles on Phoronix.
In today's tests the performance of LLVM Clang 11.1 against LLVM Clang 12.0 is being compared when building both from source in their respective release/optimized configurations. Both Clang 11 and Clang 12 were tested in three different configurations: CFLAGS/CXXFLAGS of "-O2 -march=x86-64" as the generic/common baseline, "-O2 -march=native" in targeting the CPU with the common -O2 optimization level, and "-O3 -march=native" as the CFLAGS/CXXFLAGS configuration for those tending to care about performance and trying to pursue optimal performance out of their systems.
Via the Phoronix Test Suite a variety of C/C++ benchmarks were carried out in this initial Clang 12 performance comparison with Intel and ARM tests as well as GCC compiler benchmark comparisons coming in the weeks ahead on Phoronix.
The dav1d AV1 decoder was seeing significant uplift with Clang 12 for the benchmark runs involving the "-march=native" tuning for making use of the processor's instruction set capabilities rather than relying just on x86-64 base instructions. The uplift was really great going from Clang 11 to Clang 12 for the Ryzen 9 595X with this popular open-source AV1 decoder.
With various video encode benchmarks, there was no change to only minor improvements to find out of Clang 12 relative to the current Clang 11 stable release. In a few cases, Clang 12 was slightly lower. Many of these encoders are already relying on hand-tuned Assembly code and thus not too prone to compiler changes.