Re: Why does glibc use AVX-512?
From: Florian Weimer
Date: Fri Mar 26 2021 - 16:36:19 EST
* Andy Lutomirski:
> On Fri, Mar 26, 2021 at 12:34 PM Florian Weimer <fw@xxxxxxxxxxxxx> wrote:
>> x86: Sporadic failures in tst-cpu-features-cpuinfo
>> <https://sourceware.org/bugzilla/show_bug.cgi?id=27398#c3>
>
> It's worth noting that recent microcode updates have make RTM
> considerably less likely to actually work on many parts. It's
> possible you should just disable it. :(
Sorry, I'm not sure who should disable it.
Let me sum up the situation:
We have a request for a performance enhancement in glibc, so that
applications can use it on server parts where RTM actually works.
For CPUs that support AVX-512, we may be able to meet that with a
change that uses the new 256-bit registers, t avoid the %xmm
transition penalty. (This is the easy case, hopefully—there shouldn't
be any frequency issues associated with that, and if the kernel
doesn't optimize the context switch today, that's a nonissue as well.)
For CPUs that do not support AVX-512 but support RTM (and AVX2), we
need a dynamic run-time check whether the string function is invoked
in a transaction. In that case, we need to use VZEROALL instead of
VZEROUPPER. (It's apparently too costly to issue VZEROALL
unconditionally.)
All this needs to work transparently without user intervention. We
cannot require firmware upgrades to fix the incorrect RTM reporting
issue (the bug I referenced). I think we can require software updates
which tell glibc when to use RTM-enabled string functions if the
dynamic selection does not work (either for performance reasons, or
because of the RTM reporting bug).
I want to avoid a situation where one in eight processes fail to work
correctly because the CPUID checks ran on CPU 0, where RTM is reported
as available, and then we trap when executing XTEST on other CPUs.