diff options
author | Thomas Schwinge <thomas@codesourcery.com> | 2025-04-12 17:54:45 +0000 |
---|---|---|
committer | Sandra Loosemore <sloosemore@baylibre.com> | 2025-05-15 20:25:44 +0000 |
commit | 27cfb2b1363eeb4716dcdc58a070d36e68ece766 (patch) | |
tree | 9eb4f2c02fae5b5bd2d127498f2742fe19107ab8 | |
parent | 130451de0f379ff2097f1f4cbacd5dc2152baf84 (diff) | |
download | gcc-27cfb2b1363eeb4716dcdc58a070d36e68ece766.zip gcc-27cfb2b1363eeb4716dcdc58a070d36e68ece766.tar.gz gcc-27cfb2b1363eeb4716dcdc58a070d36e68ece766.tar.bz2 |
Given OpenACC 'async', defer 'free' of non-contiguous array support data structures [PR76739]
Fix-up for og12 commit 15d0f61a7fecdc8fd12857c40879ea3730f6d99f
"Merge non-contiguous array support patches".
libgomp/ChangeLog
PR other/76739
* oacc-parallel.c (GOACC_parallel_keyed): Given OpenACC 'async',
defer 'free' of non-contiguous array support data structures.
* target.c (gomp_map_vars_internal): Likewise.
-rw-r--r-- | libgomp/oacc-parallel.c | 5 | ||||
-rw-r--r-- | libgomp/target.c | 6 |
2 files changed, 9 insertions, 2 deletions
diff --git a/libgomp/oacc-parallel.c b/libgomp/oacc-parallel.c index ca6e40b..6b60705 100644 --- a/libgomp/oacc-parallel.c +++ b/libgomp/oacc-parallel.c @@ -470,7 +470,10 @@ GOACC_parallel_keyed (int flags_m, void (*fn) (void *), struct target_mem_desc *tgt = goacc_map_vars (acc_dev, aq, mapnum, hostaddrs, NULL, sizes, kinds, nca_info, true, GOMP_MAP_VARS_TARGET); - free (nca_info); + if (aq == NULL) + free (nca_info); + else + acc_dev->openacc.async.queue_callback_func (aq, free, nca_info); if (profiling_p) { diff --git a/libgomp/target.c b/libgomp/target.c index 9a16c2a..d4d4a4c 100644 --- a/libgomp/target.c +++ b/libgomp/target.c @@ -1999,7 +1999,11 @@ gomp_map_vars_internal (struct gomp_device_descr *devicep, (nca, target_ptrblock); gomp_copy_host2dev (devicep, aq, target_ptrblock, ptrblock, nca->ptrblock_size, false, cbufp); - free (ptrblock); + if (aq) + /* Free once the transfer has completed. */ + devicep->openacc.async.queue_callback_func (aq, free, ptrblock); + else + free (ptrblock); } } } |