public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/97000] New: [nvptx, openacc] internal compiler error: in nvptx_find_par, at config/nvptx/nvptx.c:3293
@ 2020-09-09 14:38 vries at gcc dot gnu.org
  2020-09-09 14:44 ` [Bug tree-optimization/97000] " vries at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: vries at gcc dot gnu.org @ 2020-09-09 14:38 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 97000
           Summary: [nvptx, openacc] internal compiler error: in
                    nvptx_find_par, at config/nvptx/nvptx.c:3293
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

When building an x86_64 + nvptx accelerator setup with the patch adding
libatomic for nvptx (
https://gcc.gnu.org/pipermail/gcc-patches/2020-September/553393.html ) , we run
into:
...
during RTL pass: mach
/home/vries/oacc/trunk/source-gcc/libgomp/testsuite/libgomp.oacc-fortran/asyncwait-1.f90:
In function ‘MAIN__._omp_fn.0’:
/home/vries/oacc/trunk/source-gcc/libgomp/testsuite/libgomp.oacc-fortran/asyncwait-1.f90:19:
internal compiler error: in nvptx_find_par, at config/nvptx/nvptx.c:3293
0x160c390 nvptx_find_par
        /home/vries/oacc/trunk/source-gcc/gcc/config/nvptx/nvptx.c:3293
0x160c48a nvptx_find_par
        /home/vries/oacc/trunk/source-gcc/gcc/config/nvptx/nvptx.c:3320
0x160c48a nvptx_find_par
        /home/vries/oacc/trunk/source-gcc/gcc/config/nvptx/nvptx.c:3320
0x160c48a nvptx_find_par
        /home/vries/oacc/trunk/source-gcc/gcc/config/nvptx/nvptx.c:3320
0x160c48a nvptx_find_par
        /home/vries/oacc/trunk/source-gcc/gcc/config/nvptx/nvptx.c:3320
0x160c522 nvptx_discover_pars
        /home/vries/oacc/trunk/source-gcc/gcc/config/nvptx/nvptx.c:3344
0x1611046 nvptx_reorg
        /home/vries/oacc/trunk/source-gcc/gcc/config/nvptx/nvptx.c:5055
0x1059c88 execute
        /home/vries/oacc/trunk/source-gcc/gcc/reorg.c:4028
...

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

* [Bug tree-optimization/97000] [nvptx, openacc] internal compiler error: in nvptx_find_par, at config/nvptx/nvptx.c:3293
  2020-09-09 14:38 [Bug tree-optimization/97000] New: [nvptx, openacc] internal compiler error: in nvptx_find_par, at config/nvptx/nvptx.c:3293 vries at gcc dot gnu.org
@ 2020-09-09 14:44 ` vries at gcc dot gnu.org
  2020-09-09 14:45 ` vries at gcc dot gnu.org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: vries at gcc dot gnu.org @ 2020-09-09 14:44 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
At asyncwait-1.xnvptx-none.mkoffload.179t.slsr, we have the valid:
...
  <bb 2> [local count: 87490071]:
  _14 = .UNIQUE (OACC_FORK, 0, 2);
  _75 = .GOACC_DIM_SIZE (0);
  _76 = .GOACC_DIM_POS (0);
  _77 = .GOACC_DIM_POS (2);
  _60 = _75 * 32;
  _61 = _60 + 63;
  _63 = _61 / _60;
  _44 = _63 * _76;
  _65 = _44 * 32;
  _19 = _65 + _77;
  _71 = _63 * 32;
  _72 = _19 + _71;
  _20 = MIN_EXPR <_72, 64>;
  if (_19 < _20)
    goto <bb 4>; [27.00%]
  else
    goto <bb 3>; [73.00%]


  <bb 3> [local count: 437450366]:
  .UNIQUE (OACC_JOIN, _14, 2);
  return;
...
and at asyncwait-1.xnvptx-none.mkoffload.181t.tracer, we have in addition:
...
  <bb 4> [local count: 373582614]:
  .UNIQUE (OACC_JOIN, _14, 2);
  return;
...
which causes the ICE.

There's some code in ignore_bb_p in tracer.c to stop this from happening.  But
it doesn't work, because it only checks for .UNIQUE in the last stmt in the bb,
while in bb3 the last is a return (and in bb2, the .UNIQUE is the first stmt).

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

* [Bug tree-optimization/97000] [nvptx, openacc] internal compiler error: in nvptx_find_par, at config/nvptx/nvptx.c:3293
  2020-09-09 14:38 [Bug tree-optimization/97000] New: [nvptx, openacc] internal compiler error: in nvptx_find_par, at config/nvptx/nvptx.c:3293 vries at gcc dot gnu.org
  2020-09-09 14:44 ` [Bug tree-optimization/97000] " vries at gcc dot gnu.org
@ 2020-09-09 14:45 ` vries at gcc dot gnu.org
  2020-09-09 15:52 ` vries at gcc dot gnu.org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: vries at gcc dot gnu.org @ 2020-09-09 14:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
Tentative patch:
...
diff --git a/gcc/tracer.c b/gcc/tracer.c
index 82ede722534..ec97eb51538 100644
--- a/gcc/tracer.c
+++ b/gcc/tracer.c
@@ -99,6 +99,12 @@ ignore_bb_p (const_basic_block bb)
         must be duplicated in its entirety or not at all.  */
       if (gimple_code (g) == GIMPLE_TRANSACTION)
        return true;
+    }
+
+  for (gimple_stmt_iterator gsi = gsi_start_bb (CONST_CAST_BB (bb));
+       !gsi_end_p (gsi); gsi_next (&gsi))
+    {
+      gimple *g = gsi_stmt (gsi);

       /* An IFN_UNIQUE call must be duplicated as part of its group,
         or not at all.  */
...

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

* [Bug tree-optimization/97000] [nvptx, openacc] internal compiler error: in nvptx_find_par, at config/nvptx/nvptx.c:3293
  2020-09-09 14:38 [Bug tree-optimization/97000] New: [nvptx, openacc] internal compiler error: in nvptx_find_par, at config/nvptx/nvptx.c:3293 vries at gcc dot gnu.org
  2020-09-09 14:44 ` [Bug tree-optimization/97000] " vries at gcc dot gnu.org
  2020-09-09 14:45 ` vries at gcc dot gnu.org
@ 2020-09-09 15:52 ` vries at gcc dot gnu.org
  2020-09-09 16:10 ` [Bug tree-optimization/97000] [11 Regression][nvptx, " burnus at gcc dot gnu.org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: vries at gcc dot gnu.org @ 2020-09-09 15:52 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #2)
> Tentative patch:

That fixes all the new libgomp FAILs.

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

* [Bug tree-optimization/97000] [11 Regression][nvptx, openacc] internal compiler error: in nvptx_find_par, at config/nvptx/nvptx.c:3293
  2020-09-09 14:38 [Bug tree-optimization/97000] New: [nvptx, openacc] internal compiler error: in nvptx_find_par, at config/nvptx/nvptx.c:3293 vries at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2020-09-09 15:52 ` vries at gcc dot gnu.org
@ 2020-09-09 16:10 ` burnus at gcc dot gnu.org
  2020-09-09 16:15 ` vries at gcc dot gnu.org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: burnus at gcc dot gnu.org @ 2020-09-09 16:10 UTC (permalink / raw)
  To: gcc-bugs

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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2020-09-09
            Summary|[nvptx, openacc] internal   |[11 Regression][nvptx,
                   |compiler error: in          |openacc] internal compiler
                   |nvptx_find_par, at          |error: in nvptx_find_par,
                   |config/nvptx/nvptx.c:3293   |at
                   |                            |config/nvptx/nvptx.c:3293
             Status|UNCONFIRMED                 |NEW
           Keywords|                            |ice-on-valid-code
            Version|unknown                     |11.0
   Target Milestone|---                         |11.0
                 CC|                            |burnus at gcc dot gnu.org,
                   |                            |rguenth at gcc dot gnu.org

--- Comment #4 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Bisecting points to r11-3009-gfab77644842869adc8871e133e4c3f4c35b2b245
PR tree-optimization/96931 - clear ctrl-altering flag more aggressively

    2020-09-04  Richard Biener  <rguenther@suse.de>

            PR tree-optimization/96931
            * tree-cfgcleanup.c (cleanup_call_ctrl_altering_flag): If
            there's a fallthru edge and no abnormal edge the call is
            no longer control-altering.
            (cleanup_control_flow_bb): Pass down the BB to
            cleanup_call_ctrl_altering_flag.

@Richard: See also tentative patch in comment 2

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

* [Bug tree-optimization/97000] [11 Regression][nvptx, openacc] internal compiler error: in nvptx_find_par, at config/nvptx/nvptx.c:3293
  2020-09-09 14:38 [Bug tree-optimization/97000] New: [nvptx, openacc] internal compiler error: in nvptx_find_par, at config/nvptx/nvptx.c:3293 vries at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2020-09-09 16:10 ` [Bug tree-optimization/97000] [11 Regression][nvptx, " burnus at gcc dot gnu.org
@ 2020-09-09 16:15 ` vries at gcc dot gnu.org
  2020-09-09 16:32 ` vries at gcc dot gnu.org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: vries at gcc dot gnu.org @ 2020-09-09 16:15 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Tom de Vries <vries at gcc dot gnu.org> ---
Right, I just found this:
...
      /* IFN_UNIQUE should be the last insn, to make checking for it            
         as cheap as possible.  */
      || (gimple_call_internal_p (stmt)
          && gimple_call_internal_unique_p (stmt)))
    gimple_call_set_ctrl_altering (stmt, true);
...

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

* [Bug tree-optimization/97000] [11 Regression][nvptx, openacc] internal compiler error: in nvptx_find_par, at config/nvptx/nvptx.c:3293
  2020-09-09 14:38 [Bug tree-optimization/97000] New: [nvptx, openacc] internal compiler error: in nvptx_find_par, at config/nvptx/nvptx.c:3293 vries at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2020-09-09 16:15 ` vries at gcc dot gnu.org
@ 2020-09-09 16:32 ` vries at gcc dot gnu.org
  2020-09-09 16:53 ` vries at gcc dot gnu.org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: vries at gcc dot gnu.org @ 2020-09-09 16:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Tom de Vries <vries at gcc dot gnu.org> ---
I wonder if this will work:
...
diff --git a/gcc/tree-cfgcleanup.c b/gcc/tree-cfgcleanup.c
index f8169eef781..79f716b9dbe 100644
--- a/gcc/tree-cfgcleanup.c
+++ b/gcc/tree-cfgcleanup.c
@@ -212,7 +212,9 @@ static void
 cleanup_call_ctrl_altering_flag (basic_block bb, gimple *bb_end)
 {
   if (!is_gimple_call (bb_end)
-      || !gimple_call_ctrl_altering_p (bb_end))
+      || !gimple_call_ctrl_altering_p (bb_end)
+      || (gimple_call_internal_p (bb_end)
+         && gimple_call_internal_unique_p (bb_end)))
     return;

   int flags = gimple_call_flags (bb_end);
...

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

* [Bug tree-optimization/97000] [11 Regression][nvptx, openacc] internal compiler error: in nvptx_find_par, at config/nvptx/nvptx.c:3293
  2020-09-09 14:38 [Bug tree-optimization/97000] New: [nvptx, openacc] internal compiler error: in nvptx_find_par, at config/nvptx/nvptx.c:3293 vries at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2020-09-09 16:32 ` vries at gcc dot gnu.org
@ 2020-09-09 16:53 ` vries at gcc dot gnu.org
  2020-09-09 17:43 ` vries at gcc dot gnu.org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: vries at gcc dot gnu.org @ 2020-09-09 16:53 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #6)
> I wonder if this will work:
> ...
> diff --git a/gcc/tree-cfgcleanup.c b/gcc/tree-cfgcleanup.c
> index f8169eef781..79f716b9dbe 100644
> --- a/gcc/tree-cfgcleanup.c
> +++ b/gcc/tree-cfgcleanup.c
> @@ -212,7 +212,9 @@ static void
>  cleanup_call_ctrl_altering_flag (basic_block bb, gimple *bb_end)
>  {
>    if (!is_gimple_call (bb_end)
> -      || !gimple_call_ctrl_altering_p (bb_end))
> +      || !gimple_call_ctrl_altering_p (bb_end)
> +      || (gimple_call_internal_p (bb_end)
> +         && gimple_call_internal_unique_p (bb_end)))
>      return;
>  
>    int flags = gimple_call_flags (bb_end);
> ...

Yep, that seems to do the trick.

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

* [Bug tree-optimization/97000] [11 Regression][nvptx, openacc] internal compiler error: in nvptx_find_par, at config/nvptx/nvptx.c:3293
  2020-09-09 14:38 [Bug tree-optimization/97000] New: [nvptx, openacc] internal compiler error: in nvptx_find_par, at config/nvptx/nvptx.c:3293 vries at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2020-09-09 16:53 ` vries at gcc dot gnu.org
@ 2020-09-09 17:43 ` vries at gcc dot gnu.org
  2020-09-10  6:43 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: vries at gcc dot gnu.org @ 2020-09-09 17:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Tom de Vries <vries at gcc dot gnu.org> ---
This detects the problem earlier, in the host compiler:
...
diff --git a/gcc/omp-offload.c b/gcc/omp-offload.c
index 32c2485abd4..fce01af7682 100644
--- a/gcc/omp-offload.c
+++ b/gcc/omp-offload.c
@@ -1148,6 +1148,7 @@ oacc_loop_discover_walk (oacc_loop *loop, basic_block bb)
          break;

        case IFN_UNIQUE:
+         gcc_assert (stmt == last_stmt (CONST_CAST_BB (bb)));
          enum ifn_unique_kind kind
            = (enum ifn_unique_kind) (TREE_INT_CST_LOW
                                      (gimple_call_arg (call, 0)));
...

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

* [Bug tree-optimization/97000] [11 Regression][nvptx, openacc] internal compiler error: in nvptx_find_par, at config/nvptx/nvptx.c:3293
  2020-09-09 14:38 [Bug tree-optimization/97000] New: [nvptx, openacc] internal compiler error: in nvptx_find_par, at config/nvptx/nvptx.c:3293 vries at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2020-09-09 17:43 ` vries at gcc dot gnu.org
@ 2020-09-10  6:43 ` rguenth at gcc dot gnu.org
  2020-09-10 11:11 ` vries at gcc dot gnu.org
  2020-09-10 11:12 ` vries at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-09-10  6:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> ---
Meh, this way of forcing UNIQUE last to speedup lookup is a hack ... but yes,
your patch from comment#7 looks OK if you add

      /* IFN_UNIQUE should be the last insn, to make checking for it
         as cheap as possible.  */

before the new check to say what this is about.  Note this will re-introduce
the issue that passes cannot insert on loop entry edge without creating new BBs
even if we forced preheaders to be created.  For some very special case, when
UNIQUE is involved.  Thus we'll likely have even more hard to trigger latent
bugs (before it was also former setjmp calls).

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

* [Bug tree-optimization/97000] [11 Regression][nvptx, openacc] internal compiler error: in nvptx_find_par, at config/nvptx/nvptx.c:3293
  2020-09-09 14:38 [Bug tree-optimization/97000] New: [nvptx, openacc] internal compiler error: in nvptx_find_par, at config/nvptx/nvptx.c:3293 vries at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2020-09-10  6:43 ` rguenth at gcc dot gnu.org
@ 2020-09-10 11:11 ` vries at gcc dot gnu.org
  2020-09-10 11:12 ` vries at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: vries at gcc dot gnu.org @ 2020-09-10 11:11 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #9)
> Meh, this way of forcing UNIQUE last to speedup lookup is a hack ... but
> yes, your patch from comment#7 looks OK if you add
> 
>       /* IFN_UNIQUE should be the last insn, to make checking for it
>          as cheap as possible.  */
> 
> before the new check to say what this is about.  Note this will re-introduce
> the issue that passes cannot insert on loop entry edge without creating new
> BBs
> even if we forced preheaders to be created.  For some very special case, when
> UNIQUE is involved.  Thus we'll likely have even more hard to trigger latent
> bugs (before it was also former setjmp calls).

Filed PR97008 - "[openacc] Remove invariant that IFN_UNIQUE is last stmt in bb"

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

* [Bug tree-optimization/97000] [11 Regression][nvptx, openacc] internal compiler error: in nvptx_find_par, at config/nvptx/nvptx.c:3293
  2020-09-09 14:38 [Bug tree-optimization/97000] New: [nvptx, openacc] internal compiler error: in nvptx_find_par, at config/nvptx/nvptx.c:3293 vries at gcc dot gnu.org
                   ` (9 preceding siblings ...)
  2020-09-10 11:11 ` vries at gcc dot gnu.org
@ 2020-09-10 11:12 ` vries at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: vries at gcc dot gnu.org @ 2020-09-10 11:12 UTC (permalink / raw)
  To: gcc-bugs

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

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
           Keywords|                            |openacc

--- Comment #11 from Tom de Vries <vries at gcc dot gnu.org> ---
Patch committed (
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=f96b6328fa7162111e4440c5901ef313ed3e6c9a
), no test-case required.

Marking resolved-fixed.

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

end of thread, other threads:[~2020-09-10 11:12 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-09 14:38 [Bug tree-optimization/97000] New: [nvptx, openacc] internal compiler error: in nvptx_find_par, at config/nvptx/nvptx.c:3293 vries at gcc dot gnu.org
2020-09-09 14:44 ` [Bug tree-optimization/97000] " vries at gcc dot gnu.org
2020-09-09 14:45 ` vries at gcc dot gnu.org
2020-09-09 15:52 ` vries at gcc dot gnu.org
2020-09-09 16:10 ` [Bug tree-optimization/97000] [11 Regression][nvptx, " burnus at gcc dot gnu.org
2020-09-09 16:15 ` vries at gcc dot gnu.org
2020-09-09 16:32 ` vries at gcc dot gnu.org
2020-09-09 16:53 ` vries at gcc dot gnu.org
2020-09-09 17:43 ` vries at gcc dot gnu.org
2020-09-10  6:43 ` rguenth at gcc dot gnu.org
2020-09-10 11:11 ` vries at gcc dot gnu.org
2020-09-10 11:12 ` vries 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).