public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/114653] New: Not vectoring the loop with openmp reduction.
@ 2024-04-09  9:53 kugan at gcc dot gnu.org
  2024-04-09 12:53 ` [Bug middle-end/114653] Not vectorizing " rguenth at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: kugan at gcc dot gnu.org @ 2024-04-09  9:53 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 114653
           Summary: Not vectoring the loop with openmp reduction.
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kugan at gcc dot gnu.org
  Target Milestone: ---

Created attachment 57910
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57910&action=edit
testcase

Main loop in the attached test case is not vectorized with -fopenmp. It gets
vectorized with -fopenmp-simd.

In the case of -fopenmp reduction variables lax,lay,laz gets assigned to an
array. data reference calculation for this seem to fail. See:

        offset from base address: (ssizetype) ((sizetype) _20 * 4)
        constant offset from base address: 0
        step: 0
        base alignment: 16
        base misalignment: 0
        offset alignment: 4
        step alignment: 128
        base_object: D.4806[_20]
Creating dr for D.4808[_20]
analyze_innermost: Applying pattern match.pd:219, generic-match-1.cc:3190
test.cpp:37:9: missed:  failed: evolution of offset is not affine.


command used: 
 test.cpp -Ofast -fopenmp -mcpu=neoverse-v2


gcc -v:
Using built-in specs.
COLLECT_GCC=/home/kvivekananda/install/bin/gcc
COLLECT_LTO_WRAPPER=/home/kvivekananda/install/libexec/gcc/aarch64-unknown-linux-gnu/14.0.1/lto-wrapper
Target: aarch64-unknown-linux-gnu
Configured with: ../gcc/configure --enable-multiarch=yes
--enable-languages=c,c++,fortran,lto --disable-bootstrap
--prefix=/home/kvivekananda/install
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 14.0.1 20240314 (experimental) (GCC)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug middle-end/114653] Not vectorizing the loop with openmp reduction.
  2024-04-09  9:53 [Bug middle-end/114653] New: Not vectoring the loop with openmp reduction kugan at gcc dot gnu.org
@ 2024-04-09 12:53 ` rguenth at gcc dot gnu.org
  2024-04-10  3:55 ` kugan at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-04-09 12:53 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |53947
           Keywords|                            |openmp
            Summary|Not vectoring the loop with |Not vectorizing the loop
                   |openmp reduction.           |with openmp reduction.

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Note the cited problem isn't the problem.  There's several OMP reduction
vectorizing PRs already.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53947
[Bug 53947] [meta-bug] vectorizer missed-optimizations

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug middle-end/114653] Not vectorizing the loop with openmp reduction.
  2024-04-09  9:53 [Bug middle-end/114653] New: Not vectoring the loop with openmp reduction kugan at gcc dot gnu.org
  2024-04-09 12:53 ` [Bug middle-end/114653] Not vectorizing " rguenth at gcc dot gnu.org
@ 2024-04-10  3:55 ` kugan at gcc dot gnu.org
  2024-04-10  3:58 ` kugan at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: kugan at gcc dot gnu.org @ 2024-04-10  3:55 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from kugan at gcc dot gnu.org ---
Thanks. I see the following in the log:
test.cpp:33:53: missed:   not vectorized: relevant stmt not supported: _54 =
.MASK_LOAD (_53, 32B, _171);
test.cpp:22:19: missed:  bad operation or unsupported loop bound.
test.cpp:22:19: note:  ***** Analysis  failed with vector mode V4SF


test.cpp:22:19: note:   === vect_analyze_data_ref_dependences ===
test.cpp:22:19: missed:  bad data dependence.
test.cpp:22:19: note:  ***** Analysis  failed with vector mode VNx16QI

test.cpp:33:53: missed:   not vectorized: relevant stmt not supported: _54 =
.MASK_LOAD (_53, 32B, _171);
test.cpp:22:19: missed:  bad operation or unsupported loop bound.
test.cpp:22:19: note:  ***** Analysis  failed with vector mode V8QI

test.cpp:22:19: note:   === vect_analyze_data_ref_dependences ===
test.cpp:22:19: missed:  bad data dependence.
test.cpp:22:19: note:  ***** Analysis  failed with vector mode VNx8QI

test.cpp:33:53: missed:   not vectorized: relevant stmt not supported: _54 =
.MASK_LOAD (_53, 32B, _171);
test.cpp:22:19: missed:  bad operation or unsupported loop bound.
test.cpp:22:19: note:  ***** Analysis  failed with vector mode V4HI

test.cpp:22:19: note:   === vect_analyze_data_ref_dependences ===
test.cpp:22:19: missed:  bad data dependence.
test.cpp:22:19: note:  ***** Analysis  failed with vector mode VNx4QI

test.cpp:33:53: missed:   not vectorized: relevant stmt not supported: _54 =
.MASK_LOAD (_53, 32B, _171);
test.cpp:22:19: missed:  bad operation or unsupported loop bound.
test.cpp:22:19: note:  ***** Analysis  failed with vector mode V2SI

test.cpp:22:19: note:   worklist: examine stmt: _57 = D.4803[_20];
test.cpp:22:19: note:   === vect_analyze_data_ref_dependences ===
test.cpp:22:19: missed:  bad data dependence.
test.cpp:22:19: note:  ***** Analysis  failed with vector mode VNx2QI
test.cpp:22:19: missed: couldn't vectorize loop
test.cpp:22:19: missed: bad data dependence.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug middle-end/114653] Not vectorizing the loop with openmp reduction.
  2024-04-09  9:53 [Bug middle-end/114653] New: Not vectoring the loop with openmp reduction kugan at gcc dot gnu.org
  2024-04-09 12:53 ` [Bug middle-end/114653] Not vectorizing " rguenth at gcc dot gnu.org
  2024-04-10  3:55 ` kugan at gcc dot gnu.org
@ 2024-04-10  3:58 ` kugan at gcc dot gnu.org
  2024-04-10  5:05 ` kugan at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: kugan at gcc dot gnu.org @ 2024-04-10  3:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from kugan at gcc dot gnu.org ---
For SVE mode in vect_analyze_loop_2, we have

(gdb) p min_vf
$15 = {coeffs = {4, 4}}
(gdb) p max_vf
$16 = 16

Thus maybe_lt (max_vf, min_vf)) is false. This results in bad data dependence.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug middle-end/114653] Not vectorizing the loop with openmp reduction.
  2024-04-09  9:53 [Bug middle-end/114653] New: Not vectoring the loop with openmp reduction kugan at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2024-04-10  3:58 ` kugan at gcc dot gnu.org
@ 2024-04-10  5:05 ` kugan at gcc dot gnu.org
  2024-04-10  6:48 ` kugan at gcc dot gnu.org
  2024-04-10  6:53 ` kugan at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: kugan at gcc dot gnu.org @ 2024-04-10  5:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from kugan at gcc dot gnu.org ---
This particular loop has loop->safelen set to 16. Does this mean this can never
be loop vectorized for VLA?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug middle-end/114653] Not vectorizing the loop with openmp reduction.
  2024-04-09  9:53 [Bug middle-end/114653] New: Not vectoring the loop with openmp reduction kugan at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2024-04-10  5:05 ` kugan at gcc dot gnu.org
@ 2024-04-10  6:48 ` kugan at gcc dot gnu.org
  2024-04-10  6:53 ` kugan at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: kugan at gcc dot gnu.org @ 2024-04-10  6:48 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from kugan at gcc dot gnu.org ---
ddd for the :
 ref_a: 
_57 = D.4803[_20];
  ref_b: 
D.4803[_20] = _ifc__174;

We get DDR_ARE_DEPENDENT (ddr) == chrec_dont_know. Hence apply_safelen ().

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug middle-end/114653] Not vectorizing the loop with openmp reduction.
  2024-04-09  9:53 [Bug middle-end/114653] New: Not vectoring the loop with openmp reduction kugan at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2024-04-10  6:48 ` kugan at gcc dot gnu.org
@ 2024-04-10  6:53 ` kugan at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: kugan at gcc dot gnu.org @ 2024-04-10  6:53 UTC (permalink / raw)
  To: gcc-bugs

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

kugan at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #6 from kugan at gcc dot gnu.org ---
Duplicate

*** This bug has been marked as a duplicate of bug 114635 ***

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-04-10  6:53 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-09  9:53 [Bug middle-end/114653] New: Not vectoring the loop with openmp reduction kugan at gcc dot gnu.org
2024-04-09 12:53 ` [Bug middle-end/114653] Not vectorizing " rguenth at gcc dot gnu.org
2024-04-10  3:55 ` kugan at gcc dot gnu.org
2024-04-10  3:58 ` kugan at gcc dot gnu.org
2024-04-10  5:05 ` kugan at gcc dot gnu.org
2024-04-10  6:48 ` kugan at gcc dot gnu.org
2024-04-10  6:53 ` kugan at gcc dot gnu.org

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).