On Tue, 2019-04-09 at 06:48:59 +0000, Mo Zhou wrote: > On Sat, Apr 06, 2019 at 10:55:35PM +0200, Guillem Jover wrote: > > If what you are interested in though is just a small subset of the > > archive, another option that would benefit everyone and is perhaps > > less cumbersome than having to jugle around with multiple archives > > and package rebuilds/variants, is to make use of libc's hwcaps [H] > > support, which means the dynamic linker will automatically load the > > best optimized shared object for the current hardware. This of course > > can complicate a bit the packaging, and bloat it, but if the performance > > improvement is substantial, it might be a very good trade-off. > > [H] man ld.so "NOTES" / "Hardware capabilities" > > This sounds like a nice feature. However, unfortunately, the "avx2" and > "avx512" features I wanted didn't show up in the list... IIRC in my > original post I presented a C++ example with Eigen (a header-only > library). Reverse deps such as TensorFlow would benefit from this HWCAPS > feature if ld.so supported amd64's avx2 and avx512.
I guess the man page is just not exhaustive. ld.so should support those hwcaps, as it handles them mostly as opaque ASCII strings sent by the kernel. On a system with a CPU supporting those, just check the output for something like: $ LD_SHOW_AUXV=1 /lib/ld-linux.so.2 2>/dev/null|grep AT_HWCAP: Thanks, Guillem