public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Thomas Schwinge <thomas@codesourcery.com>
To: Chung-Lin Tang <cltang@codesourcery.com>, <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH, OpenACC, v3] Non-contiguous array support for OpenACC data clauses
Date: Fri, 10 Mar 2023 14:24:53 +0100	[thread overview]
Message-ID: <87pm9gbuxm.fsf@euler.schwinge.homeip.net> (raw)
In-Reply-To: <6b17767f-9b7d-50a7-c52f-e80bf1be991e@mentor.com>

[-- Attachment #1: Type: text/plain, Size: 2587 bytes --]

Hi!

On 2019-11-26T22:49:21+0800, Chung-Lin Tang <chunglin_tang@mentor.com> wrote:
> this is a reorg of the last non-contiguous arrays patch.

(Sorry, this is still not the master branch integration email...)


Just a small clean-up, to simplify other changes that I'm working on:

> (4) Along the way, I've added a 'gomp_map_vars_openacc' for specializing our
> uses, which should shave off quite some code through inlining.

> --- libgomp/libgomp.h (revision 278656)
> +++ libgomp/libgomp.h (working copy)
> @@ -1167,6 +1167,10 @@ extern struct target_mem_desc *gomp_map_vars_async
>                                                   size_t, void **, void **,
>                                                   size_t *, void *, bool,
>                                                   enum gomp_map_vars_kind);
> +extern struct target_mem_desc *gomp_map_vars_openacc (struct gomp_device_descr *,
> +                                                   struct goacc_asyncqueue *,
> +                                                   size_t, void **, size_t *,
> +                                                   unsigned short *, void *);
>  extern void gomp_unmap_tgt (struct target_mem_desc *);
>  extern void gomp_unmap_vars (struct target_mem_desc *, bool);
>  extern void gomp_unmap_vars_async (struct target_mem_desc *, bool,

> --- libgomp/target.c  (revision 278656)
> +++ libgomp/target.c  (working copy)

> @@ -1086,12 +1248,25 @@ gomp_map_vars_internal (struct gomp_device_descr *
>  }
>
>  attribute_hidden struct target_mem_desc *
> +gomp_map_vars_openacc (struct gomp_device_descr *devicep,
> +                    struct goacc_asyncqueue *aq, size_t mapnum,
> +                    void **hostaddrs, size_t *sizes, unsigned short *kinds,
> +                    void *nca_info)
> +{
> +  return gomp_map_vars_internal (devicep, aq, mapnum, hostaddrs, NULL,
> +                              sizes, (void *) kinds,
> +                              (struct goacc_ncarray_info *) nca_info,
> +                              true, GOMP_MAP_VARS_OPENACC);
> +}

Pushed to devel/omp/gcc-12 branch
commit 5ea330fdc918e6731c5b706715a18470909247bf
"libgomp: Merge 'gomp_map_vars_openacc' into 'goacc_map_vars' [PR76739]",
see attached.


Grüße
 Thomas


-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-libgomp-Merge-gomp_map_vars_openacc-into-goacc_map_v.patch --]
[-- Type: text/x-diff, Size: 7495 bytes --]

From 5ea330fdc918e6731c5b706715a18470909247bf Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <thomas@codesourcery.com>
Date: Thu, 2 Mar 2023 18:36:47 +0100
Subject: [PATCH] libgomp: Merge 'gomp_map_vars_openacc' into 'goacc_map_vars'
 [PR76739]

Upstream has 'goacc_map_vars'; merge the new 'gomp_map_vars_openacc' into it.
(Maybe the latter didn't exist yet when the former was originally added?)
No functional change.

Clean-up for og12 commit 15d0f61a7fecdc8fd12857c40879ea3730f6d99f
"Merge non-contiguous array support patches".

	PR other/76739
	libgomp/
	* libgomp.h (goacc_map_vars): Add 'struct goacc_ncarray_info *'
	formal parameter.
	(gomp_map_vars_openacc): Remove.
	* target.c (goacc_map_vars): Adjust.
	(gomp_map_vars_openacc): Remove.
	* oacc-mem.c (acc_map_data, goacc_enter_datum)
	(goacc_enter_data_internal): Adjust.
	* oacc-parallel.c (GOACC_parallel_keyed, GOACC_data_start):
	Adjust.
---
 libgomp/ChangeLog.omp   | 11 +++++++++++
 libgomp/libgomp.h       |  9 ++++-----
 libgomp/oacc-mem.c      |  8 ++++----
 libgomp/oacc-parallel.c | 10 +++++-----
 libgomp/target.c        | 17 +++--------------
 5 files changed, 27 insertions(+), 28 deletions(-)

diff --git a/libgomp/ChangeLog.omp b/libgomp/ChangeLog.omp
index 0e984754bb0..be21ec39428 100644
--- a/libgomp/ChangeLog.omp
+++ b/libgomp/ChangeLog.omp
@@ -1,5 +1,16 @@
 2023-03-10  Thomas Schwinge  <thomas@codesourcery.com>
 
+	PR other/76739
+	* libgomp.h (goacc_map_vars): Add 'struct goacc_ncarray_info *'
+	formal parameter.
+	(gomp_map_vars_openacc): Remove.
+	* target.c (goacc_map_vars): Adjust.
+	(gomp_map_vars_openacc): Remove.
+	* oacc-mem.c (acc_map_data, goacc_enter_datum)
+	(goacc_enter_data_internal): Adjust.
+	* oacc-parallel.c (GOACC_parallel_keyed, GOACC_data_start):
+	Adjust.
+
 	* oacc-host.c: Revert
 	"OpenACC profiling-interface fixes for asynchronous operations"
 	changes.
diff --git a/libgomp/libgomp.h b/libgomp/libgomp.h
index ba12d558465..92f6f14960f 100644
--- a/libgomp/libgomp.h
+++ b/libgomp/libgomp.h
@@ -1445,15 +1445,14 @@ extern void gomp_attach_pointer (struct gomp_device_descr *,
 extern void gomp_detach_pointer (struct gomp_device_descr *,
 				 struct goacc_asyncqueue *, splay_tree_key,
 				 uintptr_t, bool, struct gomp_coalesce_buf *);
+struct goacc_ncarray_info;
 extern struct target_mem_desc *goacc_map_vars (struct gomp_device_descr *,
 					       struct goacc_asyncqueue *,
 					       size_t, void **, void **,
-					       size_t *, void *, bool,
+					       size_t *, void *,
+					       struct goacc_ncarray_info *,
+					       bool,
 					       enum gomp_map_vars_kind);
-extern struct target_mem_desc *gomp_map_vars_openacc (struct gomp_device_descr *,
-						      struct goacc_asyncqueue *,
-						      size_t, void **, size_t *,
-						      unsigned short *, void *);
 extern void goacc_unmap_vars (struct target_mem_desc *, bool,
 			      struct goacc_asyncqueue *);
 extern void gomp_init_device (struct gomp_device_descr *);
diff --git a/libgomp/oacc-mem.c b/libgomp/oacc-mem.c
index 6fb8be98542..bd82beefcdb 100644
--- a/libgomp/oacc-mem.c
+++ b/libgomp/oacc-mem.c
@@ -403,7 +403,7 @@ acc_map_data (void *h, void *d, size_t s)
 
       struct target_mem_desc *tgt
 	= goacc_map_vars (acc_dev, NULL, mapnum, &hostaddrs, &devaddrs, &sizes,
-			  &kinds, true, GOMP_MAP_VARS_ENTER_DATA);
+			  &kinds, NULL, true, GOMP_MAP_VARS_ENTER_DATA);
       assert (tgt);
       assert (tgt->list_count == 1);
       splay_tree_key n = tgt->list[0].key;
@@ -572,7 +572,7 @@ goacc_enter_datum (void **hostaddrs, size_t *sizes, void *kinds, int async)
 
       struct target_mem_desc *tgt
 	= goacc_map_vars (acc_dev, aq, mapnum, hostaddrs, NULL, sizes,
-			  kinds, true, GOMP_MAP_VARS_ENTER_DATA);
+			  kinds, NULL, true, GOMP_MAP_VARS_ENTER_DATA);
       assert (tgt);
       assert (tgt->list_count == 1);
       n = tgt->list[0].key;
@@ -1247,7 +1247,7 @@ goacc_enter_data_internal (struct gomp_device_descr *acc_dev, size_t mapnum,
 	      gomp_mutex_unlock (&acc_dev->lock);
 	      struct target_mem_desc *tgt_
 		= goacc_map_vars (acc_dev, aq, groupnum, &hostaddrs[i], NULL,
-				  &sizes[i], &kinds[i], true,
+				  &sizes[i], &kinds[i], NULL, true,
 				  GOMP_MAP_VARS_ENTER_DATA);
 	      assert (tgt_ == NULL);
 	      gomp_mutex_lock (&acc_dev->lock);
@@ -1297,7 +1297,7 @@ goacc_enter_data_internal (struct gomp_device_descr *acc_dev, size_t mapnum,
 
 	  struct target_mem_desc *tgt
 	    = goacc_map_vars (acc_dev, aq, groupnum, &hostaddrs[i], NULL,
-			      &sizes[i], &kinds[i], true,
+			      &sizes[i], &kinds[i], NULL, true,
 			      GOMP_MAP_VARS_ENTER_DATA);
 	  assert (tgt);
 
diff --git a/libgomp/oacc-parallel.c b/libgomp/oacc-parallel.c
index d66bc882a5f..9c1db402c82 100644
--- a/libgomp/oacc-parallel.c
+++ b/libgomp/oacc-parallel.c
@@ -468,8 +468,8 @@ GOACC_parallel_keyed (int flags_m, void (*fn) (void *),
 
   goacc_aq aq = get_goacc_asyncqueue (async);
 
-  tgt = gomp_map_vars_openacc (acc_dev, aq, mapnum, hostaddrs, sizes, kinds,
-			       nca_info);
+  tgt = goacc_map_vars (acc_dev, aq, mapnum, hostaddrs, NULL, sizes, kinds,
+			nca_info, true, 0);
   free (nca_info);
 
   if (profiling_p)
@@ -635,7 +635,7 @@ GOACC_data_start (int flags_m, size_t mapnum,
     {
       prof_info.device_type = acc_device_host;
       api_info.device_type = prof_info.device_type;
-      tgt = gomp_map_vars_openacc (NULL, NULL, 0, NULL, NULL, NULL, NULL);
+      tgt = goacc_map_vars (NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, true, 0);
       tgt->prev = thr->mapped_data;
       thr->mapped_data = tgt;
 
@@ -652,8 +652,8 @@ GOACC_data_start (int flags_m, size_t mapnum,
     }
 
   gomp_debug (0, "  %s: prepare mappings\n", __FUNCTION__);
-  tgt = gomp_map_vars_openacc (acc_dev, NULL, mapnum, hostaddrs, sizes, kinds,
-			       nca_info);
+  tgt = goacc_map_vars (acc_dev, NULL, mapnum, hostaddrs, NULL, sizes, kinds,
+			nca_info, true, 0);
   free (nca_info);
   gomp_debug (0, "  %s: mappings prepared\n", __FUNCTION__);
   tgt->prev = thr->mapped_data;
diff --git a/libgomp/target.c b/libgomp/target.c
index fcc5b9dabca..e4fc7da6f07 100644
--- a/libgomp/target.c
+++ b/libgomp/target.c
@@ -1986,18 +1986,6 @@ gomp_map_vars_internal (struct gomp_device_descr *devicep,
   return tgt;
 }
 
-attribute_hidden struct target_mem_desc *
-gomp_map_vars_openacc (struct gomp_device_descr *devicep,
-		       struct goacc_asyncqueue *aq, size_t mapnum,
-		       void **hostaddrs, size_t *sizes, unsigned short *kinds,
-		       void *nca_info)
-{
-  return gomp_map_vars_internal (devicep, aq, mapnum, hostaddrs, NULL,
-				 sizes, (void *) kinds,
-				 (struct goacc_ncarray_info *) nca_info,
-				 true, NULL, GOMP_MAP_VARS_OPENACC);
-}
-
 static struct target_mem_desc *
 gomp_map_vars (struct gomp_device_descr *devicep, size_t mapnum,
 	       void **hostaddrs, void **devaddrs, size_t *sizes, void *kinds,
@@ -2027,11 +2015,12 @@ attribute_hidden struct target_mem_desc *
 goacc_map_vars (struct gomp_device_descr *devicep,
 		struct goacc_asyncqueue *aq, size_t mapnum,
 		void **hostaddrs, void **devaddrs, size_t *sizes,
-		void *kinds, bool short_mapkind,
+		void *kinds, struct goacc_ncarray_info *nca_info,
+		bool short_mapkind,
 		enum gomp_map_vars_kind pragma_kind)
 {
   return gomp_map_vars_internal (devicep, aq, mapnum, hostaddrs, devaddrs,
-				 sizes, kinds, NULL, short_mapkind, NULL,
+				 sizes, kinds, nca_info, short_mapkind, NULL,
 				 GOMP_MAP_VARS_OPENACC | pragma_kind);
 }
 
-- 
2.25.1


  parent reply	other threads:[~2023-03-10 13:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-26 14:57 Chung-Lin Tang
2020-04-07 13:50 ` (v4 update) " Chung-Lin Tang
2023-03-10 13:24 ` Thomas Schwinge [this message]
2023-03-15 14:47 ` Thomas Schwinge
2023-03-24 15:17   ` Thomas Schwinge
2023-04-03 14:39 ` [og12] OpenACC: Pass pre-allocated 'ptrblock' to 'goacc_noncontig_array_create_ptrblock' [PR76739] (was: [PATCH, OpenACC, v3] Non-contiguous array support for OpenACC data clauses) Thomas Schwinge

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=87pm9gbuxm.fsf@euler.schwinge.homeip.net \
    --to=thomas@codesourcery.com \
    --cc=cltang@codesourcery.com \
    --cc=gcc-patches@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).