public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/omp/gcc-12] OpenACC: Pass pre-allocated 'ptrblock' to 'goacc_noncontig_array_create_ptrblock' [PR76739]
@ 2023-04-03 14:38 Thomas Schwinge
  0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2023-04-03 14:38 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:c58b28cb650995a41e1ab0166169799f3991bdd6

commit c58b28cb650995a41e1ab0166169799f3991bdd6
Author: Thomas Schwinge <thomas@codesourcery.com>
Date:   Wed Mar 15 14:32:12 2023 +0100

    OpenACC: Pass pre-allocated 'ptrblock' to 'goacc_noncontig_array_create_ptrblock' [PR76739]
    
    ... to simplify later changes.  No functional change.
    
    Follow-up for og12 commit 15d0f61a7fecdc8fd12857c40879ea3730f6d99f
    "Merge non-contiguous array support patches".
    
            PR other/76739
            libgomp/
            * target.c (gomp_map_vars_internal): Pass pre-allocated 'ptrblock'
            to 'goacc_noncontig_array_create_ptrblock'.
            * oacc-parallel.c (goacc_noncontig_array_create_ptrblock): Adjust.
            * oacc-int.h (goacc_noncontig_array_create_ptrblock): Adjust.

Diff:
---
 libgomp/ChangeLog.omp   | 6 ++++++
 libgomp/oacc-int.h      | 3 ++-
 libgomp/oacc-parallel.c | 5 ++---
 libgomp/target.c        | 5 +++--
 4 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/libgomp/ChangeLog.omp b/libgomp/ChangeLog.omp
index d8a7e476090..7afb5f43c04 100644
--- a/libgomp/ChangeLog.omp
+++ b/libgomp/ChangeLog.omp
@@ -1,5 +1,11 @@
 2023-04-03  Thomas Schwinge  <thomas@codesourcery.com>
 
+	PR other/76739
+	* target.c (gomp_map_vars_internal): Pass pre-allocated 'ptrblock'
+	to 'goacc_noncontig_array_create_ptrblock'.
+	* oacc-parallel.c (goacc_noncontig_array_create_ptrblock): Adjust.
+	* oacc-int.h (goacc_noncontig_array_create_ptrblock): Adjust.
+
 	* libgomp.texi (AMD Radeon, nvptx): Document OpenMP 'pinned'
 	memory.
 
diff --git a/libgomp/oacc-int.h b/libgomp/oacc-int.h
index d86aeb82dfa..28a6118873a 100644
--- a/libgomp/oacc-int.h
+++ b/libgomp/oacc-int.h
@@ -213,7 +213,8 @@ struct goacc_ncarray_info
   struct goacc_ncarray ncarray[];
 };
 
-extern void *goacc_noncontig_array_create_ptrblock (struct goacc_ncarray *, void *);
+extern void goacc_noncontig_array_create_ptrblock (struct goacc_ncarray *,
+						   void *, void *);
 
 
 #ifdef HAVE_ATTRIBUTE_VISIBILITY
diff --git a/libgomp/oacc-parallel.c b/libgomp/oacc-parallel.c
index 136702d6e61..8d1c2cce836 100644
--- a/libgomp/oacc-parallel.c
+++ b/libgomp/oacc-parallel.c
@@ -165,13 +165,13 @@ goacc_process_noncontiguous_arrays (size_t mapnum, void **hostaddrs,
   return nca_info;
 }
 
-void *
+void
 goacc_noncontig_array_create_ptrblock (struct goacc_ncarray *nca,
+				       void *ptrblock,
 				       void *tgt_ptrblock_addr)
 {
   struct goacc_ncarray_descr_type *descr = nca->descr;
   void **tgt_data_rows = nca->tgt_data_rows;
-  void *ptrblock = gomp_malloc (nca->ptrblock_size);
   void **curr_dim_ptrblock = (void **) ptrblock;
   size_t n = 1;
 
@@ -210,7 +210,6 @@ goacc_noncontig_array_create_ptrblock (struct goacc_ncarray *nca,
       curr_dim_ptrblock = next_dim_ptrblock;
     }
   assert (n == nca->data_row_num);
-  return ptrblock;
 }
 
 /* Handle the mapping pair that are presented when a
diff --git a/libgomp/target.c b/libgomp/target.c
index de3facb6428..b88b1ebaa13 100644
--- a/libgomp/target.c
+++ b/libgomp/target.c
@@ -1939,8 +1939,9 @@ gomp_map_vars_internal (struct gomp_device_descr *devicep,
 		 accelerator side ptrblock and copy it in.  */
 	      if (nca->ptrblock_size)
 		{
-		  void *ptrblock = goacc_noncontig_array_create_ptrblock
-		    (nca, target_ptrblock);
+		  void *ptrblock = gomp_malloc (nca->ptrblock_size);
+		  goacc_noncontig_array_create_ptrblock
+		    (nca, ptrblock, target_ptrblock);
 		  gomp_copy_host2dev (devicep, aq, target_ptrblock, ptrblock,
 				      nca->ptrblock_size, false, cbufp);
 		  if (aq)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-04-03 14:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-03 14:38 [gcc/devel/omp/gcc-12] OpenACC: Pass pre-allocated 'ptrblock' to 'goacc_noncontig_array_create_ptrblock' [PR76739] Thomas Schwinge

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).