The recent glibc 2.33 version recently available in Tumbleweed includes this change:

The dynamic linker loads optimized implementations of shared objects from subdirectories under the glibc-hwcaps directory on the library search path if the system's capabilities meet the requirements for that subdirectory. Initially supported subdirectories include "power9" and "power10" for the powerpc64le-linux-gnu architecture, "z13", "z14", "z15" for s390x-linux-gnu, and "x86-64-v2", "x86-64-v3", "x86-64-v4" for x86_64-linux-gnu. In the x86_64-linux-gnu case, the subdirectory names correspond to the vendor-independent x86-64 microarchitecture levels defined in the x86-64 psABI supplement. ʳᵉˡᵉᵃˢᵉ ⁿᵒᵗᵉ

This means we can now build different optimized libraries for each of those microarchitectures and have the dynamic linker use them if the host cpu supports the optimizations.

There are currently 4 levels of optimizations:

  • baseline (the current default)
    • CMOV
    • CX8
    • FPU
    • FXSR
    • MMX
    • OSFXSR
    • SCE
    • SSE
    • SSE2
  • x86-64-v2
    • CMPXCHG16
    • LAHF-SAHF
    • POPCNT
    • SSE3
    • SSE4-1
    • SSE4-2
    • SSSE3
  • x86-64-v3
    • AVX
    • AVX2
    • BMI1
    • BMI2
    • F16C
    • FMA
    • LZCNT
    • MOVBE
    • OSXSAVE
  • x86-64-v4
    • AVX512F
    • AVX512BW
    • AVX512CD
    • AVX512DQ
    • AVX512VL

ᵈᵒᶜ ʳᵉᶠᵉʳᵉⁿᶜᵉ

The idea for hackweek would be to first build a couple of optimized libraries manually, put them on those directories and test that it actually works. Then work on providing rpm macros and some documentation to make it easy to build different flavors of libraries with -march=x86-64-v2/v3/v4, install them in the right locations and get subpackages generated.

For example, the libfoo1 package would have libfoo1-x86-64-v2, libfoo1-x86-64-v3 and libfoo1-x86-64-v4 subpackages with only the respective optimized libraries in their filelist and they would use Supplements: packageand(libfoo1:x86-64-v3) so a user could install a x86-64-v3 package (name TBD) and get the optimized flavor for that microarchitecture installed automatically for installed libraries.

This would hopefully get a performance benefit in openSUSE Tumbleweed (and in SLE/Leap once they include the new glibc version).

Looking for hackers with the skills:

Nothing? Add some keywords!

This project is part of:

Hack Week 20


Comments

Be the first to comment!

Similar Projects

This project is one of its kind!