This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: OpenACC 2.5 default (present) clause


Hi!

On Wed, 10 May 2017 17:48:36 +0200, Jakub Jelinek <jakub@redhat.com> wrote:
> On Fri, Apr 07, 2017 at 05:08:55PM +0200, Thomas Schwinge wrote:
> > OpenACC 2.5 added a default (present) clause, which "causes all arrays or
> > variables of aggregate data type used in the compute construct that have
> > implicitly determined data attributes to be treated as if they appeared
> > in a present clause".  Preceded by the following cleanup patch (see
> > <https://gcc.gnu.org/ml/gcc-patches/2017-04/msg00377.html> for its
> > origin), OK for trunk in next stage 1?

> >     Clarify gcc/gimplify.c:oacc_default_clause

> [...] LGTM.

As posted, committed to trunk in r248279:

commit f7c10d53cac5a46d06d23177526aa36c021e135c
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Fri May 19 13:32:30 2017 +0000

    Clarify gcc/gimplify.c:oacc_default_clause
    
            gcc/
            * gimplify.c (oacc_default_clause): Clarify.
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@248279 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/ChangeLog  |  4 ++++
 gcc/gimplify.c | 40 ++++++++++++++++++++++------------------
 2 files changed, 26 insertions(+), 18 deletions(-)

diff --git gcc/ChangeLog gcc/ChangeLog
index 44ff617..8f63902 100644
--- gcc/ChangeLog
+++ gcc/ChangeLog
@@ -1,3 +1,7 @@
+2017-05-19  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* gimplify.c (oacc_default_clause): Clarify.
+
 2017-05-19  Nathan Sidwell  <nathan@acm.org>
 
 	LANG_HOOK_REGISTER_DUMPS
diff --git gcc/gimplify.c gcc/gimplify.c
index acaab8b..0c02ee4 100644
--- gcc/gimplify.c
+++ gcc/gimplify.c
@@ -6952,30 +6952,34 @@ oacc_default_clause (struct gimplify_omp_ctx *ctx, tree decl, unsigned flags)
 
   switch (ctx->region_type)
     {
-    default:
-      gcc_unreachable ();
-
     case ORT_ACC_KERNELS:
-      /* Scalars are default 'copy' under kernels, non-scalars are default
-	 'present_or_copy'.  */
-      flags |= GOVD_MAP;
-      if (!AGGREGATE_TYPE_P (type))
-	flags |= GOVD_MAP_FORCE;
-
       rkind = "kernels";
+
+      if (AGGREGATE_TYPE_P (type))
+	/* Aggregates default to 'present_or_copy'.  */
+	flags |= GOVD_MAP;
+      else
+	/* Scalars default to 'copy'.  */
+	flags |= GOVD_MAP | GOVD_MAP_FORCE;
+
       break;
 
     case ORT_ACC_PARALLEL:
-      {
-	if (on_device || AGGREGATE_TYPE_P (type) || declared)
-	  /* Aggregates default to 'present_or_copy'.  */
-	  flags |= GOVD_MAP;
-	else
-	  /* Scalars default to 'firstprivate'.  */
-	  flags |= GOVD_FIRSTPRIVATE;
-	rkind = "parallel";
-      }
+      rkind = "parallel";
+
+      if (on_device || declared)
+	flags |= GOVD_MAP;
+      else if (AGGREGATE_TYPE_P (type))
+	/* Aggregates default to 'present_or_copy'.  */
+	flags |= GOVD_MAP;
+      else
+	/* Scalars default to 'firstprivate'.  */
+	flags |= GOVD_FIRSTPRIVATE;
+
       break;
+
+    default:
+      gcc_unreachable ();
     }
 
   if (DECL_ARTIFICIAL (decl))


Grüße
 Thomas


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]