public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/104152] New: ICE with -Ofast -march=armv8.2-a+sve -msve-vector-bits=scalable
@ 2022-01-20 23:48 gilles.gouaillardet at gmail dot com
  2022-01-21  0:17 ` [Bug tree-optimization/104152] [12 Regression] ICE with -Ofast -march=armv8.2-a+sve pinskia at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: gilles.gouaillardet at gmail dot com @ 2022-01-20 23:48 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 104152
           Summary: ICE with -Ofast -march=armv8.2-a+sve
                    -msve-vector-bits=scalable
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gilles.gouaillardet at gmail dot com
  Target Milestone: ---

Created attachment 52248
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52248&action=edit
a simple reproducer

The attached reproducer crashes with the trunk branch when -Ofast
-march=armv8.2-a+sve -msve-vector-bits=scalable is used:


FWIW, git bisect points to this commit:

commit ce670e4faafb296d1f1a7828d20f8c8ba4686797
Author: Richard Biener <rguenther@suse.de>
Date:   Wed Nov 18 14:17:34 2020 +0100

    tree-optimization/97832 - handle associatable chains in SLP discovery

    This makes SLP discovery handle associatable (including mixed
    plus/minus) chains better by swapping operands across the whole
    chain.  To work this adds caching of the 'matches' lanes for
    failed SLP discovery attempts, thereby fixing a failed SLP
    discovery for the slp-pr98855.cc testcase which results in
    building an operand from scalars as expected.  Unfortunately
    this makes us trip over the cost threshold so I'm XFAILing the
    testcase for now.

    For BB vectorization all this doesn't work because we have no way
    to distinguish good from bad associations as we eventually build
    operands from scalars and thus not fail in the classical sense.

    2021-05-31  Richard Biener  <rguenther@suse.de>

            PR tree-optimization/97832
            * tree-vectorizer.h (_slp_tree::failed): New.
            * tree-vect-slp.c (_slp_tree::_slp_tree): Initialize
            failed member.
            (_slp_tree::~_slp_tree): Free failed.
            (vect_build_slp_tree): Retain failed nodes and record
            matches in them, copying that back out when running
            into a cached fail.  Dump start and end of discovery.
            (dt_sort_cmp): New.
            (vect_build_slp_tree_2): Handle associatable chains
            together doing more aggressive operand swapping.

            * gcc.dg/vect/pr97832-1.c: New testcase.
            * gcc.dg/vect/pr97832-2.c: Likewise.
            * gcc.dg/vect/pr97832-3.c: Likewise.
            * g++.dg/vect/slp-pr98855.cc: XFAIL.



Here is the stack trace in my environment:

$ g++ -c -Ofast -march=armv8.2-a+sve -msve-vector-bits=scalable -c badaboum.cpp
2>&1 | tee badaboum.log
during GIMPLE pass: vect
badaboum.cpp: In function ?int badaboum(float*, float**)?:
badaboum.cpp:20:5: internal compiler error: in duplicate_and_interleave, at
tree-vect-slp.cc:6188
   20 | int badaboum(rvec_ cm_mol, float **tc)
      |     ^~~~~~~~
0x136d3e7 duplicate_and_interleave(vec_info*, gimple**, tree_node*,
vec<tree_node*, va_heap, vl_ptr> const&, unsigned int, vec<tree_node*, va_heap,
vl_ptr>&)
        ../../../src/gcc-trunk/gcc/tree-vect-slp.cc:6188
0x136d89b vect_create_constant_vectors
        ../../../src/gcc-trunk/gcc/tree-vect-slp.cc:6409
0x136d89b vect_schedule_slp_node
        ../../../src/gcc-trunk/gcc/tree-vect-slp.cc:7114
0x137d363 vect_schedule_scc
        ../../../src/gcc-trunk/gcc/tree-vect-slp.cc:7426
0x137ddbf vect_schedule_scc
        ../../../src/gcc-trunk/gcc/tree-vect-slp.cc:7443
0x137ddbf vect_schedule_scc
        ../../../src/gcc-trunk/gcc/tree-vect-slp.cc:7443
0x137ddbf vect_schedule_scc
        ../../../src/gcc-trunk/gcc/tree-vect-slp.cc:7443
0x137ddbf vect_schedule_scc
        ../../../src/gcc-trunk/gcc/tree-vect-slp.cc:7443
0x137e60f vect_schedule_slp(vec_info*, vec<_slp_instance*, va_heap, vl_ptr>
const&)
        ../../../src/gcc-trunk/gcc/tree-vect-slp.cc:7579
0x1355bc3 vect_transform_loop(_loop_vec_info*, gimple*)
        ../../../src/gcc-trunk/gcc/tree-vect-loop.cc:9753
0x138aa2b vect_transform_loops
        ../../../src/gcc-trunk/gcc/tree-vectorizer.cc:1003
0x138aa2b try_vectorize_loop_1
        ../../../src/gcc-trunk/gcc/tree-vectorizer.cc:1133
0x138aa2b try_vectorize_loop
        ../../../src/gcc-trunk/gcc/tree-vectorizer.cc:1162
0x138b097 execute
        ../../../src/gcc-trunk/gcc/tree-vectorizer.cc:1278
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

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

* [Bug tree-optimization/104152] [12 Regression] ICE with -Ofast -march=armv8.2-a+sve
  2022-01-20 23:48 [Bug target/104152] New: ICE with -Ofast -march=armv8.2-a+sve -msve-vector-bits=scalable gilles.gouaillardet at gmail dot com
@ 2022-01-21  0:17 ` pinskia at gcc dot gnu.org
  2022-01-21  0:17 ` pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-21  0:17 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code
             Target|                            |aarch64-linux-gnu
     Ever confirmed|0                           |1
            Summary|ICE with -Ofast             |[12 Regression] ICE with
                   |-march=armv8.2-a+sve        |-Ofast -march=armv8.2-a+sve
                   |-msve-vector-bits=scalable  |
             Status|UNCONFIRMED                 |NEW
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=97832
   Target Milestone|---                         |12.0
          Component|target                      |tree-optimization
   Last reconfirmed|                            |2022-01-21

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.

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

* [Bug tree-optimization/104152] [12 Regression] ICE with -Ofast -march=armv8.2-a+sve
  2022-01-20 23:48 [Bug target/104152] New: ICE with -Ofast -march=armv8.2-a+sve -msve-vector-bits=scalable gilles.gouaillardet at gmail dot com
  2022-01-21  0:17 ` [Bug tree-optimization/104152] [12 Regression] ICE with -Ofast -march=armv8.2-a+sve pinskia at gcc dot gnu.org
@ 2022-01-21  0:17 ` pinskia at gcc dot gnu.org
  2022-01-21  8:45 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-21  0:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note -msve-vector-bits=scalable is the default :).

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

* [Bug tree-optimization/104152] [12 Regression] ICE with -Ofast -march=armv8.2-a+sve
  2022-01-20 23:48 [Bug target/104152] New: ICE with -Ofast -march=armv8.2-a+sve -msve-vector-bits=scalable gilles.gouaillardet at gmail dot com
  2022-01-21  0:17 ` [Bug tree-optimization/104152] [12 Regression] ICE with -Ofast -march=armv8.2-a+sve pinskia at gcc dot gnu.org
  2022-01-21  0:17 ` pinskia at gcc dot gnu.org
@ 2022-01-21  8:45 ` rguenth at gcc dot gnu.org
  2022-01-21 11:19 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-01-21  8:45 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org
             Status|NEW                         |ASSIGNED

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
(gdb) p debug (op_node)
t.ii:19:5: note: node (constant) 0x3c56910 (max_nunits=1, refcnt=1)
t.ii:19:5: note:        { 3.1400001049041748046875e+0,
3.1400001049041748046875e+0, 3.1400001049041748046875e+0 }

I guess vect_create_constant_vectors might miss the "optimization" to handle
uniform vectors or maybe duplicate_and_interleave does.

can_duplicate_and_interleave_p doesn't get the actual elements so it can't
do this but I also don't see duplicate_and_interleave handling such case.

We perform the can_duplicate_and_interleave_p also in
vect_get_and_check_slp_defs, but the associatable chain code simply does


              if (dt == vect_constant_def
                  || dt == vect_external_def)
                {
                  /* We can always build those.  Might want to sort last
                     or defer building.  */
                  vec<tree> ops;
                  ops.create (group_size);
                  for (lane = 0; lane < group_size; ++lane)
                    ops.quick_push (chains[lane][n].op);
                  slp_tree child = vect_create_new_slp_node (ops);
                  SLP_TREE_DEF_TYPE (child) = dt;
                  children.safe_push (child);

I'm going to add a similar check there, too.

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

* [Bug tree-optimization/104152] [12 Regression] ICE with -Ofast -march=armv8.2-a+sve
  2022-01-20 23:48 [Bug target/104152] New: ICE with -Ofast -march=armv8.2-a+sve -msve-vector-bits=scalable gilles.gouaillardet at gmail dot com
                   ` (2 preceding siblings ...)
  2022-01-21  8:45 ` rguenth at gcc dot gnu.org
@ 2022-01-21 11:19 ` cvs-commit at gcc dot gnu.org
  2022-01-21 11:19 ` rguenth at gcc dot gnu.org
  2022-04-26  8:59 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-01-21 11:19 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:1ad72811242eb84dde1bb2e97d0804d6eabeac8a

commit r12-6789-g1ad72811242eb84dde1bb2e97d0804d6eabeac8a
Author: Richard Biener <rguenther@suse.de>
Date:   Fri Jan 21 09:48:33 2022 +0100

    tree-optimization/104152 - add missing check for SLP constant build

    This adds a missing check to verify we can actually build an
    invariant vector from components when SLP vectorizing an associatable
    chain.

    2022-01-21  Richard Biener  <rguenther@suse.de>

            PR tree-optimization/104152
            * tree-vect-slp.cc (vect_build_slp_tree_2): Add missing
            can_duplicate_and_interleave_p check.

            * gcc.dg/vect/pr104152.c: New testcase.

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

* [Bug tree-optimization/104152] [12 Regression] ICE with -Ofast -march=armv8.2-a+sve
  2022-01-20 23:48 [Bug target/104152] New: ICE with -Ofast -march=armv8.2-a+sve -msve-vector-bits=scalable gilles.gouaillardet at gmail dot com
                   ` (3 preceding siblings ...)
  2022-01-21 11:19 ` cvs-commit at gcc dot gnu.org
@ 2022-01-21 11:19 ` rguenth at gcc dot gnu.org
  2022-04-26  8:59 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-01-21 11:19 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.

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

* [Bug tree-optimization/104152] [12 Regression] ICE with -Ofast -march=armv8.2-a+sve
  2022-01-20 23:48 [Bug target/104152] New: ICE with -Ofast -march=armv8.2-a+sve -msve-vector-bits=scalable gilles.gouaillardet at gmail dot com
                   ` (4 preceding siblings ...)
  2022-01-21 11:19 ` rguenth at gcc dot gnu.org
@ 2022-04-26  8:59 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-04-26  8:59 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |asolokha at gmx dot com

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
*** Bug 102890 has been marked as a duplicate of this bug. ***

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

end of thread, other threads:[~2022-04-26  8:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-20 23:48 [Bug target/104152] New: ICE with -Ofast -march=armv8.2-a+sve -msve-vector-bits=scalable gilles.gouaillardet at gmail dot com
2022-01-21  0:17 ` [Bug tree-optimization/104152] [12 Regression] ICE with -Ofast -march=armv8.2-a+sve pinskia at gcc dot gnu.org
2022-01-21  0:17 ` pinskia at gcc dot gnu.org
2022-01-21  8:45 ` rguenth at gcc dot gnu.org
2022-01-21 11:19 ` cvs-commit at gcc dot gnu.org
2022-01-21 11:19 ` rguenth at gcc dot gnu.org
2022-04-26  8:59 ` rguenth 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).