public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/99100] Inconsistent vector length used in autovectorizer for AVX-512
Date: Mon, 15 Feb 2021 09:01:53 +0000	[thread overview]
Message-ID: <bug-99100-4-xrRPexX9fl@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-99100-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99100

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|tree-optimization           |target

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
What's odd is that with -mavx512f -mtune=skylake-avx512 we don't vectorize it
at all.  I'm looking at a smaller test:

#pragma omp declare simd simdlen(8) notinbranch
extern double __attribute__((const)) myfunc(double x);

#define N 1024
__attribute__ ((__aligned__(256))) double a[N], b[N], c[N];

void foo()
{
   for (int i = 0; i < N; i++) a[i] = myfunc(b[i]);
}


we have 3 simd clones here and the only discriminator is the target badness
returned by targetm.simd_clone.usable (n).  I suspect

  switch (node->simdclone->vecsize_mangle)
    {
    case 'b':
      if (!TARGET_SSE2)
        return -1;
      if (!TARGET_AVX)
        return 0;
      return TARGET_AVX2 ? 2 : 1;
    case 'c':
      if (!TARGET_AVX)
        return -1;
      return TARGET_AVX2 ? 1 : 0;
    case 'd':
      if (!TARGET_AVX2)
        return -1;
      return 0;
    case 'e':
      if (!TARGET_AVX512F)
        return -1;
      return 0;

since 'd' behaves the same as 'e' here we prefer 'd' or 'e' dependent on
the order in the simd clones.

Note the odd thing is we produce a 'c' mangling clone _and_ a 'd' mangling
one.  But indeed once we reach 'd' badness is zero and can't improve anymore.

There's also no sign of handling of prefered SIMD modes in the above
function...

Target issue.  Not sure about the -mtune=skylake-avx512 issue though.

  parent reply	other threads:[~2021-02-15  9:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-15  5:23 [Bug c/99100] New: " shibatch.sf.net at gmail dot com
2021-02-15  8:36 ` [Bug tree-optimization/99100] " rguenth at gcc dot gnu.org
2021-02-15  9:01 ` rguenth at gcc dot gnu.org [this message]
2021-02-15  9:43 ` [Bug target/99100] " jakub at gcc dot gnu.org
2021-02-16  8:01 ` cvs-commit at gcc dot gnu.org
2021-02-16  8:03 ` jakub at gcc dot gnu.org

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=bug-99100-4-xrRPexX9fl@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.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).