public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/omp/gcc-12] openacc: Revert erroneous gang reduction changes
@ 2022-10-27 13:50 Marcel Vollweiler
  0 siblings, 0 replies; only message in thread
From: Marcel Vollweiler @ 2022-10-27 13:50 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:5eb6cbcf3eb3d44f7329850452d268929d3ad8d8

commit 5eb6cbcf3eb3d44f7329850452d268929d3ad8d8
Author: Marcel Vollweiler <marcel@codesourcery.com>
Date:   Thu Oct 27 12:43:00 2022 +0000

    openacc: Revert erroneous gang reduction changes
    
    This patch reverts some changes related to "gang reduction on an orphan loop"
    of commit 3a5e525489f2f808093ae1f12b5d2b406f571ec7 "Various OpenACC reduction
    enhancements - FE change" similar to the mainline commit
    77d24d43644909852998043335b5a0e09d1e8f02.
    
    gcc/c/ChangeLog:
    
            * c-typeck.cc (c_finish_omp_clauses): Remove "gang reduction on an
            orphan loop" checking.
    
    gcc/cp/ChangeLog:
    
            * semantics.cc (finish_omp_clauses): Remove "gang reduction on an
            orphan loop" checking.
    
    gcc/fortran/ChangeLog:
    
            * openmp.cc (oacc_is_parallel): Remove.
            (resolve_oacc_loop_blocks): Remove "gang reduction on an orphan loop"
            checking.

Diff:
---
 gcc/c/ChangeLog.omp       |  5 +++++
 gcc/c/c-typeck.cc         | 17 ++---------------
 gcc/cp/ChangeLog.omp      |  5 +++++
 gcc/cp/semantics.cc       | 15 +--------------
 gcc/fortran/ChangeLog.omp |  6 ++++++
 gcc/fortran/openmp.cc     | 17 -----------------
 6 files changed, 19 insertions(+), 46 deletions(-)

diff --git a/gcc/c/ChangeLog.omp b/gcc/c/ChangeLog.omp
index 33fec846593..1deeb6bb5b3 100644
--- a/gcc/c/ChangeLog.omp
+++ b/gcc/c/ChangeLog.omp
@@ -1,3 +1,8 @@
+2022-10-27  Marcel Vollweiler  <marcel@codesourcery.com>
+
+	* c-typeck.cc (c_finish_omp_clauses): Remove "gang reduction on an
+	orphan loop" checking.
+
 2022-10-04  Tobias Burnus  <tobias@codesourcery.com>
 
 	Backport from mainline:
diff --git a/gcc/c/c-typeck.cc b/gcc/c/c-typeck.cc
index 0dd3a444bb0..87bc97f9433 100644
--- a/gcc/c/c-typeck.cc
+++ b/gcc/c/c-typeck.cc
@@ -14204,7 +14204,6 @@ c_finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
   bool allocate_seen = false;
   bool implicit_moved = false;
   bool target_in_reduction_seen = false;
-  bool oacc_gang_seen = false;
 
   bitmap_obstack_initialize (NULL);
   bitmap_initialize (&generic_head, &bitmap_default_obstack);
@@ -14222,15 +14221,10 @@ c_finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
 
   if (ort & C_ORT_ACC)
     for (c = clauses; c; c = OMP_CLAUSE_CHAIN (c))
-      switch (OMP_CLAUSE_CODE (c))
-        {
-	case OMP_CLAUSE_ASYNC:
+      if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_ASYNC)
+	{
 	  oacc_async = true;
 	  break;
-	case OMP_CLAUSE_GANG:
-	  oacc_gang_seen = true;
-	  break;
-	default:;
 	}
 
   for (pc = &clauses, c = clauses; c ; c = *pc)
@@ -14251,13 +14245,6 @@ c_finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
 	  goto check_dup_generic;
 
 	case OMP_CLAUSE_REDUCTION:
-	  if (oacc_gang_seen && oacc_get_fn_attrib (current_function_decl))
-	    {
-	      error_at (OMP_CLAUSE_LOCATION (c),
-			"gang reduction on an orphan loop");
-	      remove = true;
-	      break;
-	    }
 	  if (reduction_seen == 0)
 	    reduction_seen = OMP_CLAUSE_REDUCTION_INSCAN (c) ? -1 : 1;
 	  else if (reduction_seen != -2
diff --git a/gcc/cp/ChangeLog.omp b/gcc/cp/ChangeLog.omp
index f0668ab3063..7c1fde00075 100644
--- a/gcc/cp/ChangeLog.omp
+++ b/gcc/cp/ChangeLog.omp
@@ -1,3 +1,8 @@
+2022-10-27  Marcel Vollweiler  <marcel@codesourcery.com>
+
+	* semantics.cc (finish_omp_clauses): Remove "gang reduction on an orphan
+	 loop" checking.
+
 2022-10-04  Tobias Burnus  <tobias@codesourcery.com>
 
 	Backport from mainline:
diff --git a/gcc/cp/semantics.cc b/gcc/cp/semantics.cc
index 81368b4faaa..d423f3d9659 100644
--- a/gcc/cp/semantics.cc
+++ b/gcc/cp/semantics.cc
@@ -6794,7 +6794,6 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
   bool mergeable_seen = false;
   bool implicit_moved = false;
   bool target_in_reduction_seen = false;
-  bool oacc_gang_seen = false;
 
   bitmap_obstack_initialize (NULL);
   bitmap_initialize (&generic_head, &bitmap_default_obstack);
@@ -6812,15 +6811,10 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
 
   if (ort & C_ORT_ACC)
     for (c = clauses; c; c = OMP_CLAUSE_CHAIN (c))
-      switch (OMP_CLAUSE_CODE (c))
+      if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_ASYNC)
         {
-	case OMP_CLAUSE_ASYNC:
 	  oacc_async = true;
 	  break;
-	case OMP_CLAUSE_GANG:
-	  oacc_gang_seen = true;
-	  break;
-	default:;
 	}
 
   for (pc = &clauses, c = clauses; c ; c = *pc)
@@ -6837,13 +6831,6 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
 	  field_ok = ((ort & C_ORT_OMP_DECLARE_SIMD) == C_ORT_OMP);
 	  goto check_dup_generic;
 	case OMP_CLAUSE_REDUCTION:
-	  if (oacc_gang_seen && oacc_get_fn_attrib (current_function_decl))
-	    {
-	      error_at (OMP_CLAUSE_LOCATION (c),
-			"gang reduction on an orphan loop");
-	      remove = true;
-	      break;
-	    }
 	  if (reduction_seen == 0)
 	    reduction_seen = OMP_CLAUSE_REDUCTION_INSCAN (c) ? -1 : 1;
 	  else if (reduction_seen != -2
diff --git a/gcc/fortran/ChangeLog.omp b/gcc/fortran/ChangeLog.omp
index 189431df4eb..7504a837265 100644
--- a/gcc/fortran/ChangeLog.omp
+++ b/gcc/fortran/ChangeLog.omp
@@ -1,3 +1,9 @@
+2022-10-27  Marcel Vollweiler  <marcel@codesourcery.com>
+
+	* openmp.cc (oacc_is_parallel): Remove.
+	(resolve_oacc_loop_blocks): Remove "gang reduction on an orphan loop"
+	checking.
+
 2022-10-19  Tobias Burnus  <tobias@codesourcery.com>
 
 	* trans-array.cc (non_negative_strides_array_p): Fix handling
diff --git a/gcc/fortran/openmp.cc b/gcc/fortran/openmp.cc
index ab9db4e3a65..ed21f52bdb2 100644
--- a/gcc/fortran/openmp.cc
+++ b/gcc/fortran/openmp.cc
@@ -10248,11 +10248,6 @@ resolve_omp_do (gfc_code *code)
     }
 }
 
-static bool
-oacc_is_parallel (gfc_code *code)
-{
-  return code->op == EXEC_OACC_PARALLEL || code->op == EXEC_OACC_PARALLEL_LOOP;
-}
 
 static gfc_statement
 omp_code_to_statement (gfc_code *code)
@@ -10573,18 +10568,6 @@ resolve_oacc_loop_blocks (gfc_code *code)
   if (!oacc_is_loop (code))
     return;
 
-  if (code->op == EXEC_OACC_LOOP
-      && code->ext.omp_clauses->lists[OMP_LIST_REDUCTION]
-      && code->ext.omp_clauses->gang)
-    {
-      fortran_omp_context *c;
-      for (c = omp_current_ctx; c; c = c->previous)
-	if (!oacc_is_loop (c->code))
-	  break;
-      if (c == NULL || !oacc_is_parallel (c->code))
-	gfc_error ("gang reduction on an orphan loop at %L", &code->loc);
-    }
-
   if (code->ext.omp_clauses->tile_list && code->ext.omp_clauses->gang
       && code->ext.omp_clauses->worker && code->ext.omp_clauses->vector)
     gfc_error ("Tiled loop cannot be parallelized across gangs, workers and "

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

only message in thread, other threads:[~2022-10-27 13:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-27 13:50 [gcc/devel/omp/gcc-12] openacc: Revert erroneous gang reduction changes Marcel Vollweiler

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