public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "thomas.koopman at ru dot nl" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/113358] New: OpenMP inhibits vectorization
Date: Fri, 12 Jan 2024 17:23:31 +0000	[thread overview]
Message-ID: <bug-113358-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 113358
           Summary: OpenMP inhibits vectorization
           Product: gcc
           Version: 13.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: thomas.koopman at ru dot nl
  Target Milestone: ---

Created attachment 57054
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57054&action=edit
The three different versions as well as preprocessed output.

I attached three programs that compute an array accel of points in R^3 from a
3d array of positions in R^3. accel[i] is sum_j ||positions[i] -
positions[j]||^2. 

These are seq.c which is the most basic, omp.c which parallelises the outer
loop with OpenMP and block.c which uses the blocking optimisation. The first
version vectorizes as expected, but the other two do not. objdump -d omp.o |
grep ymm  shows up empty.

They are compiled with

gcc -c seq.c -Ofast -mavx2 -mfma -save-temps -Wall -Wextra -o seq.o -lm

gcc -c omp.c -Ofast -mavx2 -mfma -save-temps -Wall -Wextra -o omp.o -lm
-fopenmp

gcc -c block.c -Ofast -mavx2 -mfma -save-temps -Wall -Wextra -o block.o -lm

and

gcc -v gives the following.

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/home/thomas/.local/libexec/gcc/x86_64-pc-linux-gnu/13.2.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ./configure --prefix=/home/thomas/.local
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.2.0 (GCC)

             reply	other threads:[~2024-01-12 17:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-12 17:23 thomas.koopman at ru dot nl [this message]
2024-01-12 17:41 ` [Bug tree-optimization/113358] " pinskia at gcc dot gnu.org
2024-01-12 17:44 ` pinskia at gcc dot gnu.org
2024-01-15  8:16 ` 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-113358-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).