Re: Why does glibc use AVX-512?

From: Andy Lutomirski
Date: Fri Mar 26 2021 - 17:21:44 EST




> On Mar 26, 2021, at 2:11 PM, Florian Weimer <fw@xxxxxxxxxxxxx> wrote:
>
> * Andy Lutomirski:
>
>>> On Fri, Mar 26, 2021 at 1:35 PM Florian Weimer <fw@xxxxxxxxxxxxx> wrote:
>>>
>>> I mean the immense slowdown you get if you use %xmm registers after
> their %ymm counterparts (doesn't have to be %zmm, that issue is
> present starting with AVX) and you have not issued VZEROALL or
> VZEROUPPER between the two uses.

It turns out that it’s not necessary to access the registers in question to trigger this behavior. You just need to make the CPU think it should penalize you. For example, LDMXCSR appears to be a legacy SSE insn for this purpose, and VLDMXCSR is an AVX insn for this purpose. I wouldn’t trust that using ymm9 would avoid the penalty just because common sense says it should.

>> What kind of system has that problem?
>
> It's a standard laptop after a suspend/resume cycle. It's either a
> kernel or firmware bug.

What kernel version? I think fixing the kernel makes more sense than fixing glibc.