public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: Noah Goldstein <goldstein.w.n@gmail.com>
Cc: GNU C Library <libc-alpha@sourceware.org>,
	"Carlos O'Donell" <carlos@systemhalted.org>
Subject: Re: [PATCH v1] x86: Add EVEX optimized memchr family not safe for RTM
Date: Wed, 5 May 2021 10:54:37 -0700	[thread overview]
Message-ID: <CAMe9rOq1+k27Pxhg3eGeoU93sawm1-0bA7weu=bSj-vtas5yfg@mail.gmail.com> (raw)
In-Reply-To: <CAFUsyfLxpYrgaqHstPb6JeEH15FwC3mbbP0KUbZ6=3aDFBuyfg@mail.gmail.com>

On Wed, May 5, 2021 at 9:25 AM Noah Goldstein <goldstein.w.n@gmail.com> wrote:
>
> On Wed, May 5, 2021 at 9:23 AM H.J. Lu <hjl.tools@gmail.com> wrote:
> >
> > On Tue, May 4, 2021 at 4:34 PM Noah Goldstein <goldstein.w.n@gmail.com> wrote:
> > >
> > > No bug.
> > >
> > > This commit adds a new implementation for EVEX memchr that is not safe
> > > for RTM because it uses vzeroupper. The benefit is that by using
> >
> > EVEX memchr won't cause RTM abort if YMM16-YMM31 are used
> > since there is no need to use vzeroupper.  Please remove vzeroupper from
> > EVEX memchr and remove EVEX RTM functions.
>
> That's impossible for this implementation.
>
> The reason ymm0-ymm15 are used is so that we can use vpcmpeq which is
> not encodable with ymm16-ymm31.
>
> This implementation is optimized for CPUs which dont support RTM but
> do support EVEX.
>

Are you seeing something along the line of Prefer_AVX2_STRCMP:

commit 1da50d4bda07f04135dca39f40e79fc9eabed1f8
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Fri Feb 26 05:36:59 2021 -0800

    x86: Set Prefer_No_VZEROUPPER and add Prefer_AVX2_STRCMP

    1. Set Prefer_No_VZEROUPPER if RTM is usable to avoid RTM abort triggered
    by VZEROUPPER inside a transactionally executing RTM region.
    2. Since to compare 2 32-byte strings, 256-bit EVEX strcmp requires 2
    loads, 3 VPCMPs and 2 KORDs while AVX2 strcmp requires 1 load, 2 VPCMPEQs,
    1 VPMINU and 1 VPMOVMSKB, AVX2 strcmp is faster than EVEX strcmp.  Add
    Prefer_AVX2_STRCMP to prefer AVX2 strcmp family functions.


-- 
H.J.

  reply	other threads:[~2021-05-05 17:55 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-04 23:32 Noah Goldstein
2021-05-05 13:22 ` H.J. Lu
2021-05-05 16:24   ` Noah Goldstein
2021-05-05 17:54     ` H.J. Lu [this message]
2021-05-05 18:18       ` Noah Goldstein
2021-05-05 18:29         ` H.J. Lu
2021-05-05 18:38           ` Noah Goldstein
2021-05-05 18:44             ` Noah Goldstein
2021-05-06 13:38 ` H.J. Lu
2021-05-06 18:14   ` Noah Goldstein
2021-05-06 19:06     ` H.J. Lu
2021-05-06 13:55 ` H.J. Lu
2021-05-06 18:01   ` Noah Goldstein
2021-05-06 19:09     ` H.J. Lu
2021-05-06 23:55 ` [PATCH v2] " Noah Goldstein
2021-05-07 13:22   ` H.J. Lu
2021-05-07 18:17 ` [PATCH v3] " Noah Goldstein
2021-05-07 18:24   ` H.J. Lu
2021-05-08  4:06 ` [PATCH v4] " Noah Goldstein
2021-05-08 12:58   ` H.J. Lu
2022-04-27 23:57     ` Sunil Pandey

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='CAMe9rOq1+k27Pxhg3eGeoU93sawm1-0bA7weu=bSj-vtas5yfg@mail.gmail.com' \
    --to=hjl.tools@gmail.com \
    --cc=carlos@systemhalted.org \
    --cc=goldstein.w.n@gmail.com \
    --cc=libc-alpha@sourceware.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).