public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/101267] New: [12 Regression] ICE in vect_is_simple_use when building 521.wrf_r with -Ofast -march=znver2
@ 2021-06-30  9:37 rguenth at gcc dot gnu.org
  2021-06-30  9:37 ` [Bug tree-optimization/101267] " rguenth at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-06-30  9:37 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 101267
           Summary: [12 Regression] ICE in vect_is_simple_use when
                    building 521.wrf_r with -Ofast -march=znver2
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rguenth at gcc dot gnu.org
  Target Milestone: ---

gfortran -c -o module_fdda_psufddagd.fppized.o -I. -I./netcdf/include -I./inc
-Ofast -march=znver2 -fdump-statistics-stats -std=legacy -fconvert=big-endian
-fno-openmp -g0 module_fdda_psufddagd.fppized.f90
during GIMPLE pass: slp
module_fdda_psufddagd.fppized.f90:553:21:

  553 |    SUBROUTINE sfddagd(itimestep,dx,dt,xtime,  &
      |                     ^
internal compiler error: in vect_is_simple_use, at tree-vect-stmts.c:11422
0x75f7e4 vect_is_simple_use(tree_node*, vec_info*, vect_def_type*, tree_node**,
_stmt_vec_info**, gimple**)
        /home/rguenther/src/trunk/gcc/tree-vect-stmts.c:11422
0x110c3a7 vect_check_scalar_mask
        /home/rguenther/src/trunk/gcc/tree-vect-stmts.c:2470
0x110ed97 vectorizable_load
        /home/rguenther/src/trunk/gcc/tree-vect-stmts.c:8500
0x111d53a vect_analyze_stmt(vec_info*, _stmt_vec_info*, bool*, _slp_tree*,
_slp_instance*, vec<stmt_info_for_cost, va_heap, vl_ptr>*)
        /home/rguenther/src/trunk/gcc/tree-vect-stmts.c:10836
0x115a60b vect_slp_analyze_node_operations_1
        /home/rguenther/src/trunk/gcc/tree-vect-slp.c:4430
0x115a60b vect_slp_analyze_node_operations
        /home/rguenther/src/trunk/gcc/tree-vect-slp.c:4589
0x115c818 vect_slp_analyze_operations(vec_info*)
        /home/rguenther/src/trunk/gcc/tree-vect-slp.c:4824
0x1160470 vect_slp_analyze_bb_1
        /home/rguenther/src/trunk/gcc/tree-vect-slp.c:5702
0x1160470 vect_slp_region
        /home/rguenther/src/trunk/gcc/tree-vect-slp.c:5748
0x11619b8 vect_slp_bbs
        /home/rguenther/src/trunk/gcc/tree-vect-slp.c:5898
0x1161db4 vect_slp_function(function*)
        /home/rguenther/src/trunk/gcc/tree-vect-slp.c:5984
0x1167e02 execute
        /home/rguenther/src/trunk/gcc/tree-vectorizer.c:1445
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] 9+ messages in thread

* [Bug tree-optimization/101267] [12 Regression] ICE in vect_is_simple_use when building 521.wrf_r with -Ofast -march=znver2
  2021-06-30  9:37 [Bug tree-optimization/101267] New: [12 Regression] ICE in vect_is_simple_use when building 521.wrf_r with -Ofast -march=znver2 rguenth at gcc dot gnu.org
@ 2021-06-30  9:37 ` rguenth at gcc dot gnu.org
  2021-06-30  9:41 ` rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-06-30  9:37 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-06-30
     Ever confirmed|0                           |1
   Target Milestone|---                         |12.0
             Status|UNCONFIRMED                 |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
I'm reducing a testcase right now.

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

* [Bug tree-optimization/101267] [12 Regression] ICE in vect_is_simple_use when building 521.wrf_r with -Ofast -march=znver2
  2021-06-30  9:37 [Bug tree-optimization/101267] New: [12 Regression] ICE in vect_is_simple_use when building 521.wrf_r with -Ofast -march=znver2 rguenth at gcc dot gnu.org
  2021-06-30  9:37 ` [Bug tree-optimization/101267] " rguenth at gcc dot gnu.org
@ 2021-06-30  9:41 ` rguenth at gcc dot gnu.org
  2021-06-30  9:44 ` marxin at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-06-30  9:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
   SUBROUTINE sfddagd( regime, znt,ite ,jte )
   REAL, DIMENSION( ime, IN) :: regime, znt
   REAL, DIMENSION( ite, jte) :: wndcor_u 
   LOGICAL wrf_dm_on_monitor
   IF( int4 == 1 ) THEN
     DO j=jts,jtf
      DO i=itsu,itf
       reg =   regime(i,  j) 
       IF( reg > 10.0 ) THEN
         znt0 = znt(i-1,  j) + znt(i,  j) 
         IF( znt0 <= 0.2) THEN
           wndcor_u(i,j) = 0.2
         ENDIF
       ENDIF
      ENDDO
     ENDDO
     IF ( wrf_dm_on_monitor()) THEN
     ENDIF
   ENDIF
   END

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

* [Bug tree-optimization/101267] [12 Regression] ICE in vect_is_simple_use when building 521.wrf_r with -Ofast -march=znver2
  2021-06-30  9:37 [Bug tree-optimization/101267] New: [12 Regression] ICE in vect_is_simple_use when building 521.wrf_r with -Ofast -march=znver2 rguenth at gcc dot gnu.org
  2021-06-30  9:37 ` [Bug tree-optimization/101267] " rguenth at gcc dot gnu.org
  2021-06-30  9:41 ` rguenth at gcc dot gnu.org
@ 2021-06-30  9:44 ` marxin at gcc dot gnu.org
  2021-06-30 10:03 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-06-30  9:44 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r12-1551-g3dfa4fe9f1a089b2.

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

* [Bug tree-optimization/101267] [12 Regression] ICE in vect_is_simple_use when building 521.wrf_r with -Ofast -march=znver2
  2021-06-30  9:37 [Bug tree-optimization/101267] New: [12 Regression] ICE in vect_is_simple_use when building 521.wrf_r with -Ofast -march=znver2 rguenth at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-06-30  9:44 ` marxin at gcc dot gnu.org
@ 2021-06-30 10:03 ` rguenth at gcc dot gnu.org
  2021-06-30 10:36 ` rsandifo at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-06-30 10:03 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rsandifo at gcc dot gnu.org

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
So we're having

(gdb) p debug (slp_node)
t.f90:1:21: note: node 0x39fbbc0 (max_nunits=2, refcnt=1)
t.f90:1:21: note: op template: _144 = .MASK_LOAD (_143, 32B, _142);
t.f90:1:21: note:       stmt 0 _144 = .MASK_LOAD (_143, 32B, _142);
t.f90:1:21: note:       stmt 1 _146 = .MASK_LOAD (_145, 32B, _142);
t.f90:1:21: note:       children 0x39fbc48

where vectorizable_load invokes

8500              if (!vect_check_scalar_mask (vinfo, stmt_info, mask,
&mask_dt,
8501                                           &mask_vectype))
8502                return false;

but the SLP child is

(gdb) p debug ((slp_tree)0x39fbc48)
t.f90:1:21: note: node (external) 0x39fbc48 (max_nunits=1, refcnt=1)
t.f90:1:21: note:       { _142, _142 }

so it won't have a vector type set.  In fact vect_check_scalar_mask doesn't
seem to be prepared for SLP at all - we're lucky it "works" but then most
definitely it won't for externals.  You'll note that the SLP variant for
vect_is_simple_use won't be applicable here since we only have SLP
representations for the mask operand which isn't even the first one.

The SLP "support" for masked loads was added by Alejandro Martinez it seems,
CCing other ARM folks.

A possible fix is to simply give up for external SLP defs above, the internal
def case was probably working by chance.  I'm testing such a fix.

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

* [Bug tree-optimization/101267] [12 Regression] ICE in vect_is_simple_use when building 521.wrf_r with -Ofast -march=znver2
  2021-06-30  9:37 [Bug tree-optimization/101267] New: [12 Regression] ICE in vect_is_simple_use when building 521.wrf_r with -Ofast -march=znver2 rguenth at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2021-06-30 10:03 ` rguenth at gcc dot gnu.org
@ 2021-06-30 10:36 ` rsandifo at gcc dot gnu.org
  2021-06-30 11:30 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rsandifo at gcc dot gnu.org @ 2021-06-30 10:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #4)
> So we're having
> 
> (gdb) p debug (slp_node)
> t.f90:1:21: note: node 0x39fbbc0 (max_nunits=2, refcnt=1)
> t.f90:1:21: note: op template: _144 = .MASK_LOAD (_143, 32B, _142);
> t.f90:1:21: note:       stmt 0 _144 = .MASK_LOAD (_143, 32B, _142);
> t.f90:1:21: note:       stmt 1 _146 = .MASK_LOAD (_145, 32B, _142);
> t.f90:1:21: note:       children 0x39fbc48
> 
> where vectorizable_load invokes
> 
> 8500              if (!vect_check_scalar_mask (vinfo, stmt_info, mask,
> &mask_dt,
> 8501                                           &mask_vectype))
> 8502                return false;
> 
> but the SLP child is
> 
> (gdb) p debug ((slp_tree)0x39fbc48)
> t.f90:1:21: note: node (external) 0x39fbc48 (max_nunits=1, refcnt=1)
> t.f90:1:21: note:       { _142, _142 }
> 
> so it won't have a vector type set.  In fact vect_check_scalar_mask doesn't
> seem to be prepared for SLP at all - we're lucky it "works" but then most
> definitely it won't for externals.  You'll note that the SLP variant for
> vect_is_simple_use won't be applicable here since we only have SLP
> representations for the mask operand which isn't even the first one.
Seems like we should have a way of representing this kind of situation
though.  It doesn't seem unreasonable to have some operands (and especially
call arguments) that don't need to be vectorised.

Maybe a “fix” for now might be to pass separate SLP and non-SLP operand
numbers to vect_is_simple_use.

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

* [Bug tree-optimization/101267] [12 Regression] ICE in vect_is_simple_use when building 521.wrf_r with -Ofast -march=znver2
  2021-06-30  9:37 [Bug tree-optimization/101267] New: [12 Regression] ICE in vect_is_simple_use when building 521.wrf_r with -Ofast -march=znver2 rguenth at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2021-06-30 10:36 ` rsandifo at gcc dot gnu.org
@ 2021-06-30 11:30 ` rguenth at gcc dot gnu.org
  2021-06-30 14:40 ` cvs-commit at gcc dot gnu.org
  2021-06-30 14:40 ` rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-06-30 11:30 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to rsandifo@gcc.gnu.org from comment #5)
> (In reply to Richard Biener from comment #4)
> > So we're having
> > 
> > (gdb) p debug (slp_node)
> > t.f90:1:21: note: node 0x39fbbc0 (max_nunits=2, refcnt=1)
> > t.f90:1:21: note: op template: _144 = .MASK_LOAD (_143, 32B, _142);
> > t.f90:1:21: note:       stmt 0 _144 = .MASK_LOAD (_143, 32B, _142);
> > t.f90:1:21: note:       stmt 1 _146 = .MASK_LOAD (_145, 32B, _142);
> > t.f90:1:21: note:       children 0x39fbc48
> > 
> > where vectorizable_load invokes
> > 
> > 8500              if (!vect_check_scalar_mask (vinfo, stmt_info, mask,
> > &mask_dt,
> > 8501                                           &mask_vectype))
> > 8502                return false;
> > 
> > but the SLP child is
> > 
> > (gdb) p debug ((slp_tree)0x39fbc48)
> > t.f90:1:21: note: node (external) 0x39fbc48 (max_nunits=1, refcnt=1)
> > t.f90:1:21: note:       { _142, _142 }
> > 
> > so it won't have a vector type set.  In fact vect_check_scalar_mask doesn't
> > seem to be prepared for SLP at all - we're lucky it "works" but then most
> > definitely it won't for externals.  You'll note that the SLP variant for
> > vect_is_simple_use won't be applicable here since we only have SLP
> > representations for the mask operand which isn't even the first one.
> Seems like we should have a way of representing this kind of situation
> though.  It doesn't seem unreasonable to have some operands (and especially
> call arguments) that don't need to be vectorised.
> 
> Maybe a “fix” for now might be to pass separate SLP and non-SLP operand
> numbers to vect_is_simple_use.

Yes, I'm doing that for the single localized place where it should matter now,
see the patch posted.  There's always the possibility to fill SLP operands
with NULL (as we do for PHIs in some cases).  But then we do likely expect
the "missing" operands to be code-generated.

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

* [Bug tree-optimization/101267] [12 Regression] ICE in vect_is_simple_use when building 521.wrf_r with -Ofast -march=znver2
  2021-06-30  9:37 [Bug tree-optimization/101267] New: [12 Regression] ICE in vect_is_simple_use when building 521.wrf_r with -Ofast -march=znver2 rguenth at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2021-06-30 11:30 ` rguenth at gcc dot gnu.org
@ 2021-06-30 14:40 ` cvs-commit at gcc dot gnu.org
  2021-06-30 14:40 ` rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-06-30 14:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 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:a075350ee7bffa6c90d9d233de78515f498b5149

commit r12-1932-ga075350ee7bffa6c90d9d233de78515f498b5149
Author: Richard Biener <rguenther@suse.de>
Date:   Wed Jun 30 12:35:45 2021 +0200

    tree-optimization/101267 - fix SLP vect with masked operations

    This fixes the missed handling of external/constant mask SLP
    operations, for the testcase in particular masked loads.  The
    patch adjusts the vect_check_scalar_mask API to reflect the
    required vect_is_simple_use SLP compatible API plus adjusts
    for the special handling of masked loads in SLP discovery.

    The issue is likely latent.

    2021-06-30  Richard Biener  <rguenther@suse.de>

            PR tree-optimization/101267
            * tree-vect-stmts.c (vect_check_scalar_mask): Adjust
            API and use SLP compatible interface of vect_is_simple_use.
            Reject not vectorized SLP defs for callers that do not support
            that.
            (vect_check_store_rhs): Handle masked stores and pass down
            the appropriate operator index.
            (vectorizable_call): Adjust.
            (vectorizable_store): Likewise.
            (vectorizable_load): Likewise.  Handle SLP pecularity of
            masked loads.
            (vect_is_simple_use): Remove special-casing of masked stores.

            * gfortran.dg/pr101267.f90: New testcase.

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

* [Bug tree-optimization/101267] [12 Regression] ICE in vect_is_simple_use when building 521.wrf_r with -Ofast -march=znver2
  2021-06-30  9:37 [Bug tree-optimization/101267] New: [12 Regression] ICE in vect_is_simple_use when building 521.wrf_r with -Ofast -march=znver2 rguenth at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2021-06-30 14:40 ` cvs-commit at gcc dot gnu.org
@ 2021-06-30 14:40 ` rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-06-30 14:40 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

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

end of thread, other threads:[~2021-06-30 14:40 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-30  9:37 [Bug tree-optimization/101267] New: [12 Regression] ICE in vect_is_simple_use when building 521.wrf_r with -Ofast -march=znver2 rguenth at gcc dot gnu.org
2021-06-30  9:37 ` [Bug tree-optimization/101267] " rguenth at gcc dot gnu.org
2021-06-30  9:41 ` rguenth at gcc dot gnu.org
2021-06-30  9:44 ` marxin at gcc dot gnu.org
2021-06-30 10:03 ` rguenth at gcc dot gnu.org
2021-06-30 10:36 ` rsandifo at gcc dot gnu.org
2021-06-30 11:30 ` rguenth at gcc dot gnu.org
2021-06-30 14:40 ` cvs-commit at gcc dot gnu.org
2021-06-30 14:40 ` 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).