diff options
author | Thomas Schwinge <thomas@codesourcery.com> | 2023-02-27 15:56:18 +0100 |
---|---|---|
committer | Thomas Schwinge <thomas@codesourcery.com> | 2023-03-10 18:05:27 +0100 |
commit | f8332e52a498df480f72303de32ad0751ad899fe (patch) | |
tree | 78eb3ca7cb7351b8eb5cc74f338b4bd9b6d4ec69 /libgomp/target.c | |
parent | 14f5e56a8a766c6f48c2a07b301fce2db1a19a3c (diff) | |
download | gcc-f8332e52a498df480f72303de32ad0751ad899fe.zip gcc-f8332e52a498df480f72303de32ad0751ad899fe.tar.gz gcc-f8332e52a498df480f72303de32ad0751ad899fe.tar.bz2 |
Use 'GOMP_MAP_VARS_TARGET' for OpenACC compute constructs [PR90596]
Thereby considerably simplify the device plugins' 'GOMP_OFFLOAD_openacc_exec',
'GOMP_OFFLOAD_openacc_async_exec' functions: in terms of lines of code, but in
particular conceptually: no more device memory allocation, host to device data
copying, device memory deallocation -- 'GOMP_MAP_VARS_TARGET' does all that for
us.
This depends on commit 2b2340e236c0bba8aaca358ea25a5accd8249fbd
"Allow libgomp 'cbuf' buffering with OpenACC 'async' for 'ephemeral' data",
where I said that "a use will emerge later", which is this one here.
PR libgomp/90596
libgomp/
* target.c (gomp_map_vars_internal): Allow for
'param_kind == GOMP_MAP_VARS_OPENACC | GOMP_MAP_VARS_TARGET'.
* oacc-parallel.c (GOACC_parallel_keyed): Pass
'GOMP_MAP_VARS_TARGET' to 'goacc_map_vars'.
* plugin/plugin-gcn.c (alloc_by_agent, gcn_exec)
(GOMP_OFFLOAD_openacc_exec, GOMP_OFFLOAD_openacc_async_exec):
Adjust, simplify.
(gomp_offload_free): Remove.
* plugin/plugin-nvptx.c (nvptx_exec, GOMP_OFFLOAD_openacc_exec)
(GOMP_OFFLOAD_openacc_async_exec): Adjust, simplify.
(cuda_free_argmem): Remove.
* testsuite/libgomp.oacc-c-c++-common/acc_prof-parallel-1.c:
Adjust.
Diffstat (limited to 'libgomp/target.c')
-rw-r--r-- | libgomp/target.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/libgomp/target.c b/libgomp/target.c index 074caa6..90b4204 100644 --- a/libgomp/target.c +++ b/libgomp/target.c @@ -983,13 +983,13 @@ gomp_map_vars_internal (struct gomp_device_descr *devicep, cbuf.chunk_cnt = -1; cbuf.use_cnt = 0; cbuf.buf = NULL; - if (mapnum > 1 || pragma_kind == GOMP_MAP_VARS_TARGET) + if (mapnum > 1 || (pragma_kind & GOMP_MAP_VARS_TARGET)) { size_t chunks_size = (mapnum + 1) * sizeof (struct gomp_coalesce_chunk); cbuf.chunks = (struct gomp_coalesce_chunk *) gomp_alloca (chunks_size); cbuf.chunk_cnt = 0; } - if (pragma_kind == GOMP_MAP_VARS_TARGET) + if (pragma_kind & GOMP_MAP_VARS_TARGET) { size_t align = 4 * sizeof (void *); tgt_align = align; @@ -1262,7 +1262,7 @@ gomp_map_vars_internal (struct gomp_device_descr *devicep, tgt->tgt_start = (uintptr_t) tgt->to_free; tgt->tgt_end = tgt->tgt_start + sizes[0]; } - else if (not_found_cnt || pragma_kind == GOMP_MAP_VARS_TARGET) + else if (not_found_cnt || (pragma_kind & GOMP_MAP_VARS_TARGET)) { /* Allocate tgt_align aligned tgt_size block of memory. */ /* FIXME: Perhaps change interface to allocate properly aligned @@ -1300,7 +1300,7 @@ gomp_map_vars_internal (struct gomp_device_descr *devicep, } tgt_size = 0; - if (pragma_kind == GOMP_MAP_VARS_TARGET) + if (pragma_kind & GOMP_MAP_VARS_TARGET) tgt_size = mapnum * sizeof (void *); tgt->array = NULL; @@ -1738,7 +1738,7 @@ gomp_map_vars_internal (struct gomp_device_descr *devicep, } } - if (pragma_kind == GOMP_MAP_VARS_TARGET) + if (pragma_kind & GOMP_MAP_VARS_TARGET) { for (i = 0; i < mapnum; i++) { |