GCC & LLVM Clang Compiler Benchmarks On AMD's EPYC 7601
Next is a look at how beneficial the x86 tuning is for znver1 on GCC 8.0 SVN. A comparison was done when the "-march" tuning was for the old opteron-sse3, "btver2" for reflecting the Jaguar cores, and then for the new znver1 target reflecting the first-generation Zen designs, as was used for the earlier compiler tests with the native implying znver1 on EPYC.
Optimizing for znver1 rather than a generic Linux x86-64 target tends to yield at least a few percentage improvements in most workloads, though in some operations, the difference can be quite noticeable.
In some instances, the unoptimized GCC code is still superior.
In other instances, optimizing for Jaguar (btver2) provides most of the benefit with the Zen optimizations (znver1) providing just a slight increase.
For those with demanding workloads, it almost always pays to try out some compiler optimizations.
In showing more can still be done to the znver1 support within GCC (and Clang), in some instances the older Jaguar model is producing faster results than znver1.
Unfortunately, most Linux distributed binaries remain just targeted for x86-64 and not explicitly modern processors. The alternative is to make use of function multi-versioning (FMV) with GCC to allow for optimized code paths for the newer CPUs while retaining compatibility for older CPUs, such as what's driven with Intel Clear Linux packaging.
Between GCC and Clang, it was a fairly competitive race for which compiler was producing the fastest binaries for the AMD EPYC 7601 system running Debian Linux. Our complete benchmark data-set can be found via this OpenBenchmarking.org result file that includes many additional test results not included in this article because of having basically no measurable difference between the compilers.
If wondering which compiler is the fastest by outright wins across all of the benchmarks run regardless of the margin of the win, GCC 6.3 was actually the fastest with 16 of the 47 results putting GCC 6.3 in first. LLVM Clang 5.0 meanwhile would be considered in second place with having a first place finish in 12 of the 47 benchmarks, GCC 8.0 and LLVM Clang 6.0 SVN tied in third with seven wins a piece, and then GCC 7.2.0 was in last with only coming out ahead in five of the benchmarks.
If you enjoyed this article consider joining Phoronix Premium to view this site ad-free, multi-page articles on a single page, and other benefits. PayPal or Stripe tips are also graciously accepted. Thanks for your support.