public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Marcel Vollweiler <marcel@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc/devel/omp/gcc-12] openacc: Revert erroneous gang reduction changes
Date: Thu, 27 Oct 2022 13:50:47 +0000 (GMT)	[thread overview]
Message-ID: <20221027135047.D1A8A3851517@sourceware.org> (raw)

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 "

                 reply	other threads:[~2022-10-27 13:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221027135047.D1A8A3851517@sourceware.org \
    --to=marcel@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).