public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Thomas Schwinge <tschwinge@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-1361] Move 'libgomp/oacc-parallel.c:GOACC_declare' into 'libgomp/oacc-mem.c'
Date: Thu, 10 Jun 2021 11:12:19 +0000 (GMT)	[thread overview]
Message-ID: <20210610111219.B00C43984C21@sourceware.org> (raw)

https://gcc.gnu.org/g:0a77c7033ae4ed05a2f7e78600522610a8d82225

commit r12-1361-g0a77c7033ae4ed05a2f7e78600522610a8d82225
Author: Thomas Schwinge <thomas@codesourcery.com>
Date:   Tue Jun 8 17:15:19 2021 +0200

    Move 'libgomp/oacc-parallel.c:GOACC_declare' into 'libgomp/oacc-mem.c'
    
    This deals with data management, after all.
    
    Small fix-up for r230275 (commit 6e232ba4246ca324a663ec5ddf0ba4db5cf3fbad)
    "[OpenACC] declare directive".
    
            libgomp/
            * oacc-parallel.c (GOACC_declare): Move...
            * oacc-mem.c: ... here.
            * libgomp_g.h: Adjust.

Diff:
---
 libgomp/libgomp_g.h     |  2 +-
 libgomp/oacc-mem.c      | 54 ++++++++++++++++++++++++++++++++++++++++++++++
 libgomp/oacc-parallel.c | 57 -------------------------------------------------
 3 files changed, 55 insertions(+), 58 deletions(-)

diff --git a/libgomp/libgomp_g.h b/libgomp/libgomp_g.h
index 3cbe0a4ca89..b66b6978202 100644
--- a/libgomp/libgomp_g.h
+++ b/libgomp/libgomp_g.h
@@ -370,6 +370,7 @@ extern void GOACC_wait (int, int, ...);
 
 extern void GOACC_enter_exit_data (int, size_t, void **, size_t *,
 				   unsigned short *, int, int, ...);
+extern void GOACC_declare (int, size_t, void **, size_t *, unsigned short *);
 
 /* oacc-parallel.c */
 
@@ -384,6 +385,5 @@ extern void GOACC_update (int, size_t, void **, size_t *,
 			  unsigned short *, int, int, ...);
 extern int GOACC_get_num_threads (void);
 extern int GOACC_get_thread_num (void);
-extern void GOACC_declare (int, size_t, void **, size_t *, unsigned short *);
 
 #endif /* LIBGOMP_G_H */
diff --git a/libgomp/oacc-mem.c b/libgomp/oacc-mem.c
index 405574dfa2b..056600aca52 100644
--- a/libgomp/oacc-mem.c
+++ b/libgomp/oacc-mem.c
@@ -1461,3 +1461,57 @@ GOACC_enter_exit_data (int flags_m, size_t mapnum, void **hostaddrs,
       thr->api_info = NULL;
     }
 }
+
+void
+GOACC_declare (int flags_m, size_t mapnum,
+	       void **hostaddrs, size_t *sizes, unsigned short *kinds)
+{
+  for (size_t i = 0; i < mapnum; i++)
+    {
+      unsigned char kind = kinds[i] & 0xff;
+
+      if (kind == GOMP_MAP_POINTER || kind == GOMP_MAP_TO_PSET)
+	continue;
+
+      switch (kind)
+	{
+	case GOMP_MAP_FORCE_ALLOC:
+	case GOMP_MAP_FORCE_FROM:
+	case GOMP_MAP_FORCE_TO:
+	case GOMP_MAP_RELEASE:
+	case GOMP_MAP_DELETE:
+	  GOACC_enter_exit_data (flags_m, 1, &hostaddrs[i], &sizes[i],
+				 &kinds[i], GOMP_ASYNC_SYNC, 0);
+	  break;
+
+	case GOMP_MAP_FORCE_DEVICEPTR:
+	  break;
+
+	case GOMP_MAP_ALLOC:
+	  if (!acc_is_present (hostaddrs[i], sizes[i]))
+	    GOACC_enter_exit_data (flags_m, 1, &hostaddrs[i], &sizes[i],
+				   &kinds[i], GOMP_ASYNC_SYNC, 0);
+	  break;
+
+	case GOMP_MAP_TO:
+	  GOACC_enter_exit_data (flags_m, 1, &hostaddrs[i], &sizes[i],
+				 &kinds[i], GOMP_ASYNC_SYNC, 0);
+	  break;
+
+	case GOMP_MAP_FROM:
+	  GOACC_enter_exit_data (flags_m, 1, &hostaddrs[i], &sizes[i],
+				 &kinds[i], GOMP_ASYNC_SYNC, 0);
+	  break;
+
+	case GOMP_MAP_FORCE_PRESENT:
+	  if (!acc_is_present (hostaddrs[i], sizes[i]))
+	    gomp_fatal ("[%p,%ld] is not mapped", hostaddrs[i],
+			(unsigned long) sizes[i]);
+	  break;
+
+	default:
+	  assert (0);
+	  break;
+	}
+    }
+}
diff --git a/libgomp/oacc-parallel.c b/libgomp/oacc-parallel.c
index d05b3d87097..939e09f2b0c 100644
--- a/libgomp/oacc-parallel.c
+++ b/libgomp/oacc-parallel.c
@@ -728,60 +728,3 @@ GOACC_get_thread_num (void)
 {
   return 0;
 }
-
-void
-GOACC_declare (int flags_m, size_t mapnum,
-	       void **hostaddrs, size_t *sizes, unsigned short *kinds)
-{
-  int i;
-
-  for (i = 0; i < mapnum; i++)
-    {
-      unsigned char kind = kinds[i] & 0xff;
-
-      if (kind == GOMP_MAP_POINTER || kind == GOMP_MAP_TO_PSET)
-	continue;
-
-      switch (kind)
-	{
-	  case GOMP_MAP_FORCE_ALLOC:
-	  case GOMP_MAP_FORCE_FROM:
-	  case GOMP_MAP_FORCE_TO:
-	  case GOMP_MAP_RELEASE:
-	  case GOMP_MAP_DELETE:
-	    GOACC_enter_exit_data (flags_m, 1, &hostaddrs[i], &sizes[i],
-				   &kinds[i], GOMP_ASYNC_SYNC, 0);
-	    break;
-
-	  case GOMP_MAP_FORCE_DEVICEPTR:
-	    break;
-
-	  case GOMP_MAP_ALLOC:
-	    if (!acc_is_present (hostaddrs[i], sizes[i]))
-	      GOACC_enter_exit_data (flags_m, 1, &hostaddrs[i], &sizes[i],
-				     &kinds[i], GOMP_ASYNC_SYNC, 0);
-	    break;
-
-	  case GOMP_MAP_TO:
-	    GOACC_enter_exit_data (flags_m, 1, &hostaddrs[i], &sizes[i],
-				   &kinds[i], GOMP_ASYNC_SYNC, 0);
-
-	    break;
-
-	  case GOMP_MAP_FROM:
-	    GOACC_enter_exit_data (flags_m, 1, &hostaddrs[i], &sizes[i],
-				   &kinds[i], GOMP_ASYNC_SYNC, 0);
-	    break;
-
-	  case GOMP_MAP_FORCE_PRESENT:
-	    if (!acc_is_present (hostaddrs[i], sizes[i]))
-	      gomp_fatal ("[%p,%ld] is not mapped", hostaddrs[i],
-			  (unsigned long) sizes[i]);
-	    break;
-
-	  default:
-	    assert (0);
-	    break;
-	}
-    }
-}


                 reply	other threads:[~2021-06-10 11:12 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=20210610111219.B00C43984C21@sourceware.org \
    --to=tschwinge@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).