From: Uros Bizjak <ubizjak@gmail.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: Richard Biener <rguenther@suse.de>,
Jeff Law <jeffreyalaw@gmail.com>,
gcc-patches@gcc.gnu.org, Florian Weimer <fweimer@redhat.com>,
"H.J. Lu" <hjl.tools@gmail.com>
Subject: Re: [PATCH] libatomic: Handle AVX+CX16 AMD like Intel for 16b atomics [PR104688]
Date: Mon, 14 Nov 2022 08:55:11 +0100 [thread overview]
Message-ID: <CAFULd4avaPhry66MvWmZDqnPn4ShKbvmPw6K_VQYuVpae5pe8A@mail.gmail.com> (raw)
In-Reply-To: <Y3Hy1ckL3ZluEOSi@tucnak>
On Mon, Nov 14, 2022 at 8:48 AM Jakub Jelinek <jakub@redhat.com> wrote:
>
> Hi!
>
> Working virtually out of Baker Island.
>
> We got a response from AMD in
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104688#c10
> so the following patch starts treating AMD with AVX and CMPXCHG16B
> ISAs like Intel by using vmovdqa for atomic load/store in libatomic.
>
> Ok for trunk if it passes bootstrap/regtest?
>
> 2022-11-13 Jakub Jelinek <jakub@redhat.com>
>
> PR target/104688
> * config/x86/init.c (__libat_feat1_init): Revert 2022-03-17 change
> - on x86_64 no longer clear bit_AVX if CPU vendor is not Intel.
>
> --- libatomic/config/x86/init.c.jj 2022-03-17 18:48:56.708723194 +0100
> +++ libatomic/config/x86/init.c 2022-11-13 18:23:26.315440071 -1200
> @@ -34,18 +34,6 @@ __libat_feat1_init (void)
> unsigned int eax, ebx, ecx, edx;
> FEAT1_REGISTER = 0;
> __get_cpuid (1, &eax, &ebx, &ecx, &edx);
> -#ifdef __x86_64__
> - if ((FEAT1_REGISTER & (bit_AVX | bit_CMPXCHG16B))
> - == (bit_AVX | bit_CMPXCHG16B))
> - {
> - /* Intel SDM guarantees that 16-byte VMOVDQA on 16-byte aligned address
> - is atomic, but so far we don't have this guarantee from AMD. */
> - unsigned int ecx2 = 0;
> - __get_cpuid (0, &eax, &ebx, &ecx2, &edx);
> - if (ecx2 != signature_INTEL_ecx)
> - FEAT1_REGISTER &= ~bit_AVX;
We still need this, but also bypass it for AMD signature. There are
other vendors than Intel and AMD.
OK with the above addition.
Thanks,
Uros.
> - }
> -#endif
> /* See the load in load_feat1. */
> __atomic_store_n (&__libat_feat1, FEAT1_REGISTER, __ATOMIC_RELAXED);
> return FEAT1_REGISTER;
>
> Jakub
>
next prev parent reply other threads:[~2022-11-14 7:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-14 7:48 Jakub Jelinek
2022-11-14 7:55 ` Uros Bizjak [this message]
2022-11-14 8:19 ` Xi Ruoyao
2022-11-14 8:34 ` Jakub Jelinek
2022-11-14 8:44 ` Xi Ruoyao
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=CAFULd4avaPhry66MvWmZDqnPn4ShKbvmPw6K_VQYuVpae5pe8A@mail.gmail.com \
--to=ubizjak@gmail.com \
--cc=fweimer@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=hjl.tools@gmail.com \
--cc=jakub@redhat.com \
--cc=jeffreyalaw@gmail.com \
--cc=rguenther@suse.de \
/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).