public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/108608] New: [12/13 Regression] AArch64 vectorizer ICE in vect_transform_reduction
@ 2023-01-30 21:49 jakub at gcc dot gnu.org
  2023-01-30 21:50 ` [Bug tree-optimization/108608] " jakub at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-01-30 21:49 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108608
           Summary: [12/13 Regression] AArch64 vectorizer ICE in
                    vect_transform_reduction
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
  Target Milestone: ---

int
foo ()
{
  double m = 0;
  for (int i = 0; i < 256; i++)
    m = __builtin_fmax (i, m);
  return m;
}

ICEs with -O3 on aarch64-linux, both in current GCC 12 branch and on the trunk.
r12-3732 doesn't ICE, don't have any newer aarch64 cross snapshots except
latest 12 branch or trunk though. Also tried godbolt and 11.3 is ok, 12.1
already ICEs.

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

* [Bug tree-optimization/108608] [12/13 Regression] AArch64 vectorizer ICE in vect_transform_reduction
  2023-01-30 21:49 [Bug tree-optimization/108608] New: [12/13 Regression] AArch64 vectorizer ICE in vect_transform_reduction jakub at gcc dot gnu.org
@ 2023-01-30 21:50 ` jakub at gcc dot gnu.org
  2023-01-30 21:55 ` [Bug tree-optimization/108608] [12/13 Regression] AArch64 vectorizer ICE in vect_transform_reduction and __builtin_fmax jakub at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-01-30 21:50 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |12.3
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
                 CC|                            |rsandifo at gcc dot gnu.org
   Last reconfirmed|                            |2023-01-30
           Priority|P3                          |P2

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
during GIMPLE pass: vect
rh2164522.ii: In function ‘foo’:
rh2164522.ii:2:1: internal compiler error: in vect_transform_reduction, at
tree-vect-loop.cc:7758
    2 | foo ()
      | ^~~
0x19243a1 vect_transform_reduction(_loop_vec_info*, _stmt_vec_info*,
gimple_stmt_iterator*, gimple**, _slp_tree*)
        ../../gcc/tree-vect-loop.cc:7758
0x2a0f09b vect_transform_stmt(vec_info*, _stmt_vec_info*,
gimple_stmt_iterator*, _slp_tree*, _slp_instance*)
        ../../gcc/tree-vect-stmts.cc:11418
0x192e5cf vect_transform_loop_stmt
        ../../gcc/tree-vect-loop.cc:10562
0x192fd54 vect_transform_loop(_loop_vec_info*, gimple*)
        ../../gcc/tree-vect-loop.cc:11000
0x1988ece vect_transform_loops
        ../../gcc/tree-vectorizer.cc:1007
0x1989639 try_vectorize_loop_1
        ../../gcc/tree-vectorizer.cc:1153
0x1989772 try_vectorize_loop
        ../../gcc/tree-vectorizer.cc:1183
0x1989a05 execute
        ../../gcc/tree-vectorizer.cc:1299
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

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

* [Bug tree-optimization/108608] [12/13 Regression] AArch64 vectorizer ICE in vect_transform_reduction and __builtin_fmax
  2023-01-30 21:49 [Bug tree-optimization/108608] New: [12/13 Regression] AArch64 vectorizer ICE in vect_transform_reduction jakub at gcc dot gnu.org
  2023-01-30 21:50 ` [Bug tree-optimization/108608] " jakub at gcc dot gnu.org
@ 2023-01-30 21:55 ` jakub at gcc dot gnu.org
  2023-01-30 21:59 ` pinskia at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-01-30 21:55 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The ICE is on:
7755      gimple_match_op op;
7756      if (!gimple_extract_op (stmt_info->stmt, &op))
7757        gcc_unreachable ();
7758      gcc_assert (op.code.is_tree_code ());
7759      auto code = tree_code (op.code);
where op.code.rep is -232, i.e. -CFN_BUILT_IN_FMAX, so it isn't a tree code.

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

* [Bug tree-optimization/108608] [12/13 Regression] AArch64 vectorizer ICE in vect_transform_reduction and __builtin_fmax
  2023-01-30 21:49 [Bug tree-optimization/108608] New: [12/13 Regression] AArch64 vectorizer ICE in vect_transform_reduction jakub at gcc dot gnu.org
  2023-01-30 21:50 ` [Bug tree-optimization/108608] " jakub at gcc dot gnu.org
  2023-01-30 21:55 ` [Bug tree-optimization/108608] [12/13 Regression] AArch64 vectorizer ICE in vect_transform_reduction and __builtin_fmax jakub at gcc dot gnu.org
@ 2023-01-30 21:59 ` pinskia at gcc dot gnu.org
  2023-01-30 22:03 ` pinskia at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-01-30 21:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #2)
> The ICE is on:
> 7755	  gimple_match_op op;
> 7756	  if (!gimple_extract_op (stmt_info->stmt, &op))
> 7757	    gcc_unreachable ();
> 7758	  gcc_assert (op.code.is_tree_code ());
> 7759	  auto code = tree_code (op.code);
> where op.code.rep is -232, i.e. -CFN_BUILT_IN_FMAX, so it isn't a tree code.

That assert was added with r12-5601-g30213ae9a2eb53 .

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

* [Bug tree-optimization/108608] [12/13 Regression] AArch64 vectorizer ICE in vect_transform_reduction and __builtin_fmax
  2023-01-30 21:49 [Bug tree-optimization/108608] New: [12/13 Regression] AArch64 vectorizer ICE in vect_transform_reduction jakub at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2023-01-30 21:59 ` pinskia at gcc dot gnu.org
@ 2023-01-30 22:03 ` pinskia at gcc dot gnu.org
  2023-01-30 22:09 ` jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-01-30 22:03 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #3)
> (In reply to Jakub Jelinek from comment #2)
> > The ICE is on:
> > 7755	  gimple_match_op op;
> > 7756	  if (!gimple_extract_op (stmt_info->stmt, &op))
> > 7757	    gcc_unreachable ();
> > 7758	  gcc_assert (op.code.is_tree_code ());
> > 7759	  auto code = tree_code (op.code);
> > where op.code.rep is -232, i.e. -CFN_BUILT_IN_FMAX, so it isn't a tree code.
> 
> That assert was added with r12-5601-g30213ae9a2eb53 .

But fmax/fmin support was added with r12-5602-ge32b9eb32d7cd2 .

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

* [Bug tree-optimization/108608] [12/13 Regression] AArch64 vectorizer ICE in vect_transform_reduction and __builtin_fmax
  2023-01-30 21:49 [Bug tree-optimization/108608] New: [12/13 Regression] AArch64 vectorizer ICE in vect_transform_reduction jakub at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2023-01-30 22:03 ` pinskia at gcc dot gnu.org
@ 2023-01-30 22:09 ` jakub at gcc dot gnu.org
  2023-01-30 22:14 ` jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-01-30 22:09 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The original code in kokkos had roughly:
  Real max_rel_err = -1;
  const Real rel_tol = std::numeric_limits<Real>::epsilon();


  for (int n = 0; n < N; n++) {
    for (int k = 0; k < N; k++) {
      for (int j = 0; j < N; j++) {
        for (int i = 1; i < N - 1; i++) {
          const Real analytic = 2.0 * (i + 1) * pow((j + 2) * (k + 3) * (n +
4), 2.0);
          const Real err = host_du(n, k, j, i - 1) - analytic;

          max_rel_err = fmax(fabs(err / analytic), max_rel_err);
        }
      }
    }
  }

  return max_rel_err < rel_tol;
where Real is double, and host_du is some hard to decipher C++ object.

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

* [Bug tree-optimization/108608] [12/13 Regression] AArch64 vectorizer ICE in vect_transform_reduction and __builtin_fmax
  2023-01-30 21:49 [Bug tree-optimization/108608] New: [12/13 Regression] AArch64 vectorizer ICE in vect_transform_reduction jakub at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2023-01-30 22:09 ` jakub at gcc dot gnu.org
@ 2023-01-30 22:14 ` jakub at gcc dot gnu.org
  2023-01-30 22:51 ` rsandifo at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-01-30 22:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
#define N 64
extern double host_du[N][N][N][N];

int
foo (void)
{
  double max_rel_err = -1;
  const double rel_tol = __DBL_EPSILON__;
  for (int n = 0; n < N; n++)
    for (int k = 0; k < N; k++)
      for (int j = 0; j < N; j++)
        for (int i = 1; i < N - 1; i++) {
          const double analytic = 2.0 * (i + 1) * __builtin_pow((j + 2) * (k +
3) * (n + 4), 2.0);
          const double err = host_du[n][k][j][i - 1] - analytic;
          max_rel_err = __builtin_fmax(__builtin_fabs(err / analytic),
max_rel_err);
        }
  return max_rel_err < rel_tol;
}

ICEs too at -O3.

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

* [Bug tree-optimization/108608] [12/13 Regression] AArch64 vectorizer ICE in vect_transform_reduction and __builtin_fmax
  2023-01-30 21:49 [Bug tree-optimization/108608] New: [12/13 Regression] AArch64 vectorizer ICE in vect_transform_reduction jakub at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2023-01-30 22:14 ` jakub at gcc dot gnu.org
@ 2023-01-30 22:51 ` rsandifo at gcc dot gnu.org
  2023-01-31 15:03 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rsandifo at gcc dot gnu.org @ 2023-01-30 22:51 UTC (permalink / raw)
  To: gcc-bugs

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

rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> changed:

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

--- Comment #7 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> ---
Testing a patch.

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

* [Bug tree-optimization/108608] [12/13 Regression] AArch64 vectorizer ICE in vect_transform_reduction and __builtin_fmax
  2023-01-30 21:49 [Bug tree-optimization/108608] New: [12/13 Regression] AArch64 vectorizer ICE in vect_transform_reduction jakub at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2023-01-30 22:51 ` rsandifo at gcc dot gnu.org
@ 2023-01-31 15:03 ` cvs-commit at gcc dot gnu.org
  2023-04-03  8:58 ` [Bug tree-optimization/108608] [12 " cvs-commit at gcc dot gnu.org
  2023-04-03  9:03 ` rsandifo at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-01-31 15:03 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Richard Sandiford <rsandifo@gcc.gnu.org>:

https://gcc.gnu.org/g:2bb444787ed17a9e786f544cdf51ee2ac6779ab2

commit r13-5580-g2bb444787ed17a9e786f544cdf51ee2ac6779ab2
Author: Richard Sandiford <richard.sandiford@arm.com>
Date:   Tue Jan 31 15:03:43 2023 +0000

    vect: Fix single def-use cycle for ifn reductions [PR108608]

    The patch that added support for fmin/fmax reductions didn't
    handle single def-use cycles.  In some ways, this seems like
    going out of our way to make things slower, but that's a
    discussion for another day.

    gcc/
            PR tree-optimization/108608
            * tree-vect-loop.cc (vect_transform_reduction): Handle single
            def-use cycles that involve function calls rather than tree codes.

    gcc/testsuite/
            PR tree-optimization/108608
            * gcc.dg/vect/pr108608.c: New test.
            * gcc.target/aarch64/sve/pr108608-1.c: Likewise.

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

* [Bug tree-optimization/108608] [12 Regression] AArch64 vectorizer ICE in vect_transform_reduction and __builtin_fmax
  2023-01-30 21:49 [Bug tree-optimization/108608] New: [12/13 Regression] AArch64 vectorizer ICE in vect_transform_reduction jakub at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2023-01-31 15:03 ` cvs-commit at gcc dot gnu.org
@ 2023-04-03  8:58 ` cvs-commit at gcc dot gnu.org
  2023-04-03  9:03 ` rsandifo at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-04-03  8:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Richard Sandiford
<rsandifo@gcc.gnu.org>:

https://gcc.gnu.org/g:65216cd44b8c89640ad987b6227ea1d748456a41

commit r12-9381-g65216cd44b8c89640ad987b6227ea1d748456a41
Author: Richard Sandiford <richard.sandiford@arm.com>
Date:   Mon Apr 3 09:57:07 2023 +0100

    vect: Fix single def-use cycle for ifn reductions [PR108608]

    The patch that added support for fmin/fmax reductions didn't
    handle single def-use cycles.  In some ways, this seems like
    going out of our way to make things slower, but that's a
    discussion for another day.

    gcc/
            PR tree-optimization/108608
            * tree-vect-loop.cc (vect_transform_reduction): Handle single
            def-use cycles that involve function calls rather than tree codes.

    gcc/testsuite/
            PR tree-optimization/108608
            * gcc.dg/vect/pr108608.c: New test.
            * gcc.target/aarch64/sve/pr108608-1.c: Likewise.

    (cherry picked from commit 2bb444787ed17a9e786f544cdf51ee2ac6779ab2)

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

* [Bug tree-optimization/108608] [12 Regression] AArch64 vectorizer ICE in vect_transform_reduction and __builtin_fmax
  2023-01-30 21:49 [Bug tree-optimization/108608] New: [12/13 Regression] AArch64 vectorizer ICE in vect_transform_reduction jakub at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2023-04-03  8:58 ` [Bug tree-optimization/108608] [12 " cvs-commit at gcc dot gnu.org
@ 2023-04-03  9:03 ` rsandifo at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: rsandifo at gcc dot gnu.org @ 2023-04-03  9:03 UTC (permalink / raw)
  To: gcc-bugs

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

rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> changed:

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

--- Comment #10 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> ---
FIxed.

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

end of thread, other threads:[~2023-04-03  9:03 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-30 21:49 [Bug tree-optimization/108608] New: [12/13 Regression] AArch64 vectorizer ICE in vect_transform_reduction jakub at gcc dot gnu.org
2023-01-30 21:50 ` [Bug tree-optimization/108608] " jakub at gcc dot gnu.org
2023-01-30 21:55 ` [Bug tree-optimization/108608] [12/13 Regression] AArch64 vectorizer ICE in vect_transform_reduction and __builtin_fmax jakub at gcc dot gnu.org
2023-01-30 21:59 ` pinskia at gcc dot gnu.org
2023-01-30 22:03 ` pinskia at gcc dot gnu.org
2023-01-30 22:09 ` jakub at gcc dot gnu.org
2023-01-30 22:14 ` jakub at gcc dot gnu.org
2023-01-30 22:51 ` rsandifo at gcc dot gnu.org
2023-01-31 15:03 ` cvs-commit at gcc dot gnu.org
2023-04-03  8:58 ` [Bug tree-optimization/108608] [12 " cvs-commit at gcc dot gnu.org
2023-04-03  9:03 ` rsandifo 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).