Fedora Linux already supports the use of glibcHWCAPs, allowing libraries to be built for different x86_64 microarchitecture feature levels for performance-sensitive code so that performance payoffs can be achieved when leveraging AVX/AVX2 or other newer Intel/AMDC CPU instruction set extensions. Now, Fedora42 proposes to further extend this feature to allow binary executables to also leverage glibcHWCAP for better performance.

Fedora42 has submitted a change proposal to allow optimized binaries for the x86_64 microarchitecture feature level. Its purpose is to extend the glibc-hwcaps mechanism to complete executables, not just shared libraries.

"A single package can provide optimized libraries via the glibc-hwcaps mechanism. This approach will be extended to executables. Packages provide optimized variants of binaries in different directories. It is a symbolic link to a small program that replaces the binary in /usr/bin. When run, the program will find the most suitable variant and execute it.

Which packages provide optimized code, and at what level, will be determined by individual package maintainers based on benchmark results.

...

This change is about extending the glibc-hwcaps mechanism to executable files. We provide a small helper binary. Programs in /usr/bin (or other paths) are linked to this helper program. When executed, the helper program checks the capabilities of the CPU and searches a separate directory hierarchy for the most suitable variant of the target program. Then launch the optimized binary or the "universal" binary compiled for the baseline. "

The proposed change goes on to add:

"Developers interested in such optimization work can perform it in Fedora without having to build separate software sources. Users with corresponding hardware will receive performance benefits. Faster code is also more energy efficient. This change will be automatic and transparent to users.

Note that other distributions use higher levels of microarchitecture. For example, RHEL9 uses x86-64-v2 as the baseline, RHEL10 uses x86-64-v3, and other distributions provide optimized variants (OpenSUSE, ArchLinux, Ubuntu). The way we implement the same changes in Fedora is much narrower and therefore significantly lower in development effort, code compilation time, storage and release overhead, but should provide the same performance and energy consumption benefits. "

It will still be up to Fedora packagers/developers to evaluate the performance benefits themselves and decide whether to provide their packages with optimized executables for different x86_64 microarchitecture feature levels.