public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Julian Brown <julian@codesourcery.com>
To: <gcc-patches@gcc.gnu.org>
Cc: Thomas Schwinge <thomas@codesourcery.com>, <fortran@gcc.gnu.org>,
	Jakub Jelinek <jakub@redhat.com>,
	Tobias Burnus <tobias@codesourcery.com>,
	"Moore, Catherine" <Catherine_Moore@mentor.com>
Subject: [PATCH 2/9] [OpenACC] GOMP_MAP_ATTACH handling in find_group_last
Date: Tue, 16 Jun 2020 15:38:32 -0700	[thread overview]
Message-ID: <037fa9b35dfbe459776be8ef7b01eca95e3dc7a3.1592343756.git.julian@codesourcery.com> (raw)
In-Reply-To: <cover.1592343756.git.julian@codesourcery.com>

Later patches in this series assume that GOMP_MAP_ATTACH will be grouped
together with a preceding GOMP_MAP_TO_PSET or other "to" data movement
clause, except in cases where an explicit "attach" clause is used.
This patch arranges for that to be so.

OK?

Julian

ChangeLog

	libgomp/
	* oacc-mem.c (find_group_last): Group data-movement clauses
	(GOMP_MAP_TO_PSET, GOMP_MAP_TO, etc.) together with a subsequent
	GOMP_MAP_ATTACH.  Allow standalone GOMP_MAP_ATTACH also.
---
 libgomp/oacc-mem.c | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/libgomp/oacc-mem.c b/libgomp/oacc-mem.c
index 936ae649dd9..be7f8d600eb 100644
--- a/libgomp/oacc-mem.c
+++ b/libgomp/oacc-mem.c
@@ -985,9 +985,15 @@ find_group_last (int pos, size_t mapnum, size_t *sizes, unsigned short *kinds)
   switch (kind0)
     {
     case GOMP_MAP_TO_PSET:
-      while (pos + 1 < mapnum && (kinds[pos + 1] & 0xff) == GOMP_MAP_POINTER)
+      if (pos + 1 < mapnum
+	  && (kinds[pos + 1] & 0xff) == GOMP_MAP_ATTACH)
+	return pos + 1;
+
+      while (pos + 1 < mapnum
+	     && (kinds[pos + 1] & 0xff) == GOMP_MAP_POINTER)
 	pos++;
-      /* We expect at least one GOMP_MAP_POINTER after a GOMP_MAP_TO_PSET.  */
+      /* We expect at least one GOMP_MAP_POINTER (if not a single
+	 GOMP_MAP_ATTACH) after a GOMP_MAP_TO_PSET.  */
       assert (pos > first_pos);
       break;
 
@@ -1002,6 +1008,9 @@ find_group_last (int pos, size_t mapnum, size_t *sizes, unsigned short *kinds)
       gomp_fatal ("unexpected mapping");
       break;
 
+    case GOMP_MAP_ATTACH:
+      return pos;
+
     default:
       /* GOMP_MAP_ALWAYS_POINTER can only appear directly after some other
 	 mapping.  */
@@ -1012,9 +1021,16 @@ find_group_last (int pos, size_t mapnum, size_t *sizes, unsigned short *kinds)
 	    return pos + 1;
 	}
 
+      /* We can have a single GOMP_MAP_ATTACH mapping after a to/from
+	 mapping.  */
+      if (pos + 1 < mapnum
+	  && (kinds[pos + 1] & 0xff) == GOMP_MAP_ATTACH)
+	return pos + 1;
+
       /* We can have zero or more GOMP_MAP_POINTER mappings after a to/from
 	 (etc.) mapping.  */
-      while (pos + 1 < mapnum && (kinds[pos + 1] & 0xff) == GOMP_MAP_POINTER)
+      while (pos + 1 < mapnum
+	     && (kinds[pos + 1] & 0xff) == GOMP_MAP_POINTER)
 	pos++;
     }
 
-- 
2.23.0


  parent reply	other threads:[~2020-06-16 22:38 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-16 22:38 [PATCH 0/9] [OpenACC] Refcounting and manual deep copy improvements Julian Brown
2020-06-16 22:38 ` [PATCH 1/9] [OpenACC] Fortran derived-type mapping fix Julian Brown
2020-06-16 22:38 ` Julian Brown [this message]
2020-06-30 12:42   ` [PATCH 2/9] [OpenACC] GOMP_MAP_ATTACH handling in find_group_last Thomas Schwinge
2020-06-16 22:38 ` [PATCH 3/9] [OpenACC] Adjust dynamic reference count semantics Julian Brown
2020-06-30 13:51   ` Thomas Schwinge
2020-07-03 15:41     ` Thomas Schwinge
2020-07-10 12:08       ` Julian Brown
2020-06-16 22:38 ` [PATCH 4/9] [OpenACC] Don't pass kind array via pointer to goacc_enter_datum Julian Brown
2020-06-16 22:39 ` [PATCH 5/9] [OpenACC] Fix incompatible copyout for acc_map_data (PR92843) Julian Brown
2020-06-16 22:39 ` [PATCH 6/9] [OpenACC] Set bias to zero for explicit attach/detach clauses in C and C++ Julian Brown
2020-06-25 11:36   ` Thomas Schwinge
2020-07-09 21:06     ` Thomas Schwinge
2020-07-09 21:32       ` Julian Brown
2020-06-16 22:39 ` [PATCH 7/9] [OpenACC] Do not strip GOMP_MAP_TO_PSET/GOMP_MAP_POINTER for enter/exit data directives Julian Brown
2020-07-06 16:19   ` Thomas Schwinge
2020-06-16 22:39 ` [PATCH 8/9] [OpenACC] Fix standalone attach for Fortran assumed-shape array pointers Julian Brown
2020-07-14 11:43   ` Thomas Schwinge
2020-07-15 10:28     ` Thomas Schwinge
2020-07-17 11:16       ` Thomas Schwinge
2020-07-27 14:33         ` Julian Brown
2020-07-30  9:53           ` Thomas Schwinge
2020-07-30 20:15             ` Julian Brown
2020-06-16 22:39 ` [PATCH 9/9] [OpenACC] Don't detach for no-op exit data with zero dynamic refcount Julian Brown
2020-07-24 14:18   ` Thomas Schwinge
2020-07-24 22:53     ` Julian Brown

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=037fa9b35dfbe459776be8ef7b01eca95e3dc7a3.1592343756.git.julian@codesourcery.com \
    --to=julian@codesourcery.com \
    --cc=Catherine_Moore@mentor.com \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=thomas@codesourcery.com \
    --cc=tobias@codesourcery.com \
    /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).