From: David Laight <David.Laight@ACULAB.COM>
To: 'Andy Lutomirski' <luto@kernel.org>,
libc-alpha <libc-alpha@sourceware.org>,
"H. J. Lu" <hjl.tools@gmail.com>, X86 ML <x86@kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
"Bae, Chang Seok" <chang.seok.bae@intel.com>,
Florian Weimer <fweimer@redhat.com>,
"Carlos O'Donell" <carlos@redhat.com>,
Rich Felker <dalias@libc.org>
Subject: RE: Why does glibc use AVX-512?
Date: Fri, 26 Mar 2021 13:32:31 +0000 [thread overview]
Message-ID: <5cb200606c5c40d4a289dbc6ad08f437@AcuMS.aculab.com> (raw)
In-Reply-To: <CALCETrURmk4ZijJVUtJwouj=_0NPiUvUFr9XMvdniRRFqeU+fg@mail.gmail.com>
From: Andy Lutomirski
> Sent: 26 March 2021 04:38
>
> Hi all-
>
> glibc appears to use AVX512F for memcpy by default. (Unless
> Prefer_ERMS is default-on, but I genuinely can't tell if this is the
> case. I did some searching.) The commit adding it refers to a 2016
> email saying that it's 30% on KNL. Unfortunately, AVX-512 is now
> available in normal hardware, and the overhead from switching between
> normal and AVX-512 code appears to vary from bad to genuinely
> horrible. And, once anything has used the high parts of YMM and/or
> ZMM, those states tend to get stuck with XINUSE=1.
Yes I wonder how much faster 'normal' copies ever get because
of these optimisations.
Not many programs sit in a loop repeatedly copying the same 8k buffer.
Not to mention the cpu where the 'wide' instructions either
use the 'narrow' execution unit twice or at half frequency.
So while supported, using them isn't really useful.
IIRC the [XYZ]MM registers are all caller saved?
So system calls (or rather the C wrapper) is allowed to
trash them all.
So the system call entry could zero all the [XYZ]MM registers.
I think they XSAVExxx and later XRESTORExxx are then quick.
In particular they don't need saving on a context switch from
a system call.
This might get them marked 'not in use' more often.
But probably not if memcpy() starts using them.
(This doesn't help signal handlers.)
ISTR one cpu family where ZVEROUPPER goes from 'cheap' to
'expensive'.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
prev parent reply other threads:[~2021-03-26 13:33 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-26 4:38 Why does glibc use AVX-512? Andy Lutomirski
2021-03-26 10:06 ` Borislav Petkov
2021-03-26 18:17 ` Andy Lutomirski
2021-03-26 12:12 ` Florian Weimer
2021-03-26 18:14 ` Andy Lutomirski
2021-03-26 19:34 ` Florian Weimer
2021-03-26 19:47 ` Andy Lutomirski
2021-03-26 20:06 ` Andrew Cooper
2021-03-26 20:35 ` Florian Weimer
2021-03-26 20:43 ` H.J. Lu
2021-03-26 20:48 ` Andy Lutomirski
2021-03-26 21:11 ` Florian Weimer
2021-03-26 21:21 ` Andy Lutomirski
2021-03-26 13:32 ` David Laight [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5cb200606c5c40d4a289dbc6ad08f437@AcuMS.aculab.com \
--to=david.laight@aculab.com \
--cc=carlos@redhat.com \
--cc=chang.seok.bae@intel.com \
--cc=dalias@libc.org \
--cc=fweimer@redhat.com \
--cc=hjl.tools@gmail.com \
--cc=libc-alpha@sourceware.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox