aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Schwinge <thomas@codesourcery.com>2025-04-12 17:58:05 +0000
committerSandra Loosemore <sloosemore@baylibre.com>2025-05-15 20:25:44 +0000
commit1f60b10dd70e20a87213dfa74108419743413bce (patch)
tree373ae1df9834b8549da1d811f6a017b57fecdd50
parent27cfb2b1363eeb4716dcdc58a070d36e68ece766 (diff)
downloadgcc-1f60b10dd70e20a87213dfa74108419743413bce.zip
gcc-1f60b10dd70e20a87213dfa74108419743413bce.tar.gz
gcc-1f60b10dd70e20a87213dfa74108419743413bce.tar.bz2
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". libgomp/ChangeLog 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.
-rw-r--r--libgomp/oacc-int.h3
-rw-r--r--libgomp/oacc-parallel.c5
-rw-r--r--libgomp/target.c5
3 files changed, 7 insertions, 6 deletions
diff --git a/libgomp/oacc-int.h b/libgomp/oacc-int.h
index 1d11240..a24de9d 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 6b60705..1d17a79 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 d4d4a4c..5837b43 100644
--- a/libgomp/target.c
+++ b/libgomp/target.c
@@ -1995,8 +1995,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)