public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-5619] [OpenACC] Allow gang reductions inside serial constructs
@ 2021-11-30 12:00 Thomas Schwinge
  0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2021-11-30 12:00 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:f1a58ab0db20c0862e8b5039bd448fc8c9799cac

commit r12-5619-gf1a58ab0db20c0862e8b5039bd448fc8c9799cac
Author: Kwok Cheung Yeung <kcy@codesourcery.com>
Date:   Fri Mar 13 11:13:49 2020 -0700

    [OpenACC] Allow gang reductions inside serial constructs
    
    ... fixing a regression introduced in the preceding
    commit 2b7dac2c0dcb087da9e4018943c023c0678234a3
    "Make OpenACC orphan gang reductions errors".
    
            gcc/fortran/
            * openmp.c (oacc_is_serial, oacc_is_parallel_or_serial): New.
            (resolve_oacc_loop_blocks): Use oacc_is_parallel_or_serial instead of
            oacc_is_parallel.
            libgomp/
            * testsuite/libgomp.oacc-fortran/parallel-dims.f90: Remove
            temporary skip.
    
    Co-Authored-By: Thomas Schwinge <thomas@codesourcery.com>

Diff:
---
 gcc/fortran/openmp.c                                     | 14 +++++++++++++-
 libgomp/testsuite/libgomp.oacc-fortran/parallel-dims.f90 |  1 -
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c
index 4fa38691c01..b4100577e51 100644
--- a/gcc/fortran/openmp.c
+++ b/gcc/fortran/openmp.c
@@ -8334,6 +8334,18 @@ oacc_is_kernels (gfc_code *code)
   return code->op == EXEC_OACC_KERNELS || code->op == EXEC_OACC_KERNELS_LOOP;
 }
 
+static bool
+oacc_is_serial (gfc_code *code)
+{
+  return code->op == EXEC_OACC_SERIAL || code->op == EXEC_OACC_SERIAL_LOOP;
+}
+
+static bool
+oacc_is_parallel_or_serial (gfc_code *code)
+{
+  return oacc_is_parallel (code) || oacc_is_serial (code);
+}
+
 static gfc_statement
 omp_code_to_statement (gfc_code *code)
 {
@@ -8644,7 +8656,7 @@ resolve_oacc_loop_blocks (gfc_code *code)
       for (c = omp_current_ctx; c; c = c->previous)
 	if (!oacc_is_loop (c->code))
 	  break;
-      if (c == NULL || !(oacc_is_parallel (c->code)
+      if (c == NULL || !(oacc_is_parallel_or_serial (c->code)
 			 || oacc_is_kernels (c->code)))
 	gfc_error ("gang reduction on an orphan loop at %L", &code->loc);
     }
diff --git a/libgomp/testsuite/libgomp.oacc-fortran/parallel-dims.f90 b/libgomp/testsuite/libgomp.oacc-fortran/parallel-dims.f90
index 80d64030414..fad3d9d6a80 100644
--- a/libgomp/testsuite/libgomp.oacc-fortran/parallel-dims.f90
+++ b/libgomp/testsuite/libgomp.oacc-fortran/parallel-dims.f90
@@ -3,7 +3,6 @@
 
 ! { dg-additional-sources parallel-dims-aux.c }
 ! { dg-do run }
-  ! { dg-skip-if TODO { *-*-* } }
 ! { dg-prune-output "command-line option '-fintrinsic-modules-path=.*' is valid for Fortran but not for C" }
 
 ! { dg-additional-options "-fopt-info-note-omp" }


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-11-30 12:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-30 12:00 [gcc r12-5619] [OpenACC] Allow gang reductions inside serial constructs Thomas Schwinge

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