Glibc-HWCAPS To Help With AMD Zen Optimizations, Other Per-CPU Performance Bits

Written by Michael Larabel in GNU on 7 July 2020 at 04:00 AM EDT. 3 Comments
GNU
Experimental patches under discussion for the GNU C Library (glibc) would make it easier to dynamically load optimized libraries (shared objects) on systems depending upon the CPU in use and its hardware capabilities. This glibc-hwcaps work stems from the desired work on being able to better leverage Linux performance optimizations on AMD Zen-based systems but the hardware capabilities patches themselves can help any CPU microarchitecture family in more easily shipping optimized support.

This glibc-hwcaps work sent out under a "request for comments" flag at the end of June was carried out by Red Hat's Florian Weimer. He began this patch series stemming from the work on the bug/issue around providing better optimized AMD Zen support by potentially following Haswell optimizations rather than a more generic target. Prior to this glibc-hwcaps patch series, it was a few months back that AMD was said to be engaged on this matter as well.

With the new patches, a new subdirectory called "glibc-hwcaps" can be used with nested sub-directories for containing alternative library implementations. This glibc-hwcaps subdirectory can be used on every sub-directory of the library search path. The ldconfig command and dynamic loader are plumbed to properly check for files in the sub-directories and add to the cache with that file. The dynamic loader will check for the presence of any specialized files and if supported use the alternative library.

Ultimately with glibc-hwcaps is the start of the infrastructure for more easily being able to ship optimized libraries / shared objects depending upon the hardware capabilities. This is at the library level for providing drop-in optimized libraries as opposed to the likes of GCC's FMV (Function Multi-Versioning) that at build-time is trying to provide optimized functions that are then chose at run-time depending upon the CPU host.

Thus the likes of AMD Zen processors could leverage this infrastructure for more easily deploying Zen-optimized versions of key libraries in the name of greater performance. This common infrastructure can also be used by other x86_64 CPUs as well as other architectures like POWER9 and s390x.

More details via this patch series which hopefully will come to stable fruition soon enough and unfortunate that it has taken until 2020 for having such infrastructure in place.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week