public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "mtzguido at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/105363] New: -ftree-slp-vectorize decreases performance significantly (x64)
Date: Sun, 24 Apr 2022 14:25:04 +0000	[thread overview]
Message-ID: <bug-105363-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 105363
           Summary: -ftree-slp-vectorize decreases performance
                    significantly (x64)
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mtzguido at gmail dot com
  Target Milestone: ---

Created attachment 52857
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52857&action=edit
Source file and outputs

Hello,

I found this example where using -O2 (which implies -ftree-slp-vectorize)
decreases performance by about 4x wrt -O1. I've pinned it down to the
-ftree-slp-vectorize, and -O3 -fno-tree-slp-vectorize works very well.

   $ gcc bug_opt.c -O3 -o bug_opt-O3
   $ time ./bug_opt-O3

   real 0m6.627s
   user 0m6.619s
   sys  0m0.005s

   $ gcc bug_opt.c -O3 -fno-tree-slp-vectorize -o bug_opt-O3-novec
   $ time ./bug_opt-O3-novec

   real 0m1.703s
   user 0m1.701s
   sys  0m0.000s

I've verified this with the current HEAD (1ceddd7497) and with 11.2 (though in
that version -O2 does not imply -ftree-slp-vectorize, so the problem starts to
appear at -O3).

I've minimized the example into a pretty basic insertion sort.

I have not checked the generated assembly.

I'm attaching the .c source, which has some more comments with timings. Also
attaching my /proc/cpuinfo, and the temp files generated with -O3. I imagine
the .o and binary is not too helpful, but can send them if needed.

Thanks,
Guido

             reply	other threads:[~2022-04-24 14:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-24 14:25 mtzguido at gmail dot com [this message]
2022-04-25  3:16 ` [Bug c/105363] " crazylht at gmail dot com
2022-04-25  3:37 ` crazylht at gmail dot com
2022-04-25  7:21 ` [Bug tree-optimization/105363] " rguenth 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-105363-4@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).