diff options
author | Jakub Jelinek <jakub@redhat.com> | 2019-08-08 08:39:02 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2019-08-08 08:39:02 +0200 |
commit | 8860d2706d9bd21da3885f980f313733fdc525d1 (patch) | |
tree | 2420aa40b9b451dd4e3b7251149b6c8a5f7ce9c1 /libgomp/target.c | |
parent | 34f3ec07575f80964c9885874cb186ae3a913fcb (diff) | |
download | gcc-8860d2706d9bd21da3885f980f313733fdc525d1.zip gcc-8860d2706d9bd21da3885f980f313733fdc525d1.tar.gz gcc-8860d2706d9bd21da3885f980f313733fdc525d1.tar.bz2 |
gimplify.c (omp_add_variable): Use GOVD_PRIVATE | GOVD_EXPLICIT for VLA helper variables on target data even if...
* gimplify.c (omp_add_variable): Use GOVD_PRIVATE | GOVD_EXPLICIT
for VLA helper variables on target data even if not GOVD_FIRSTPRIVATE.
(gimplify_scan_omp_clauses): For OMP_CLAUSE_USE_DEVICE_* use just
GOVD_EXPLICIT flags.
(gimplify_omp_workshare): For OMP_TARGET_DATA move all
OMP_CLAUSE_USE_DEVICE_* clauses to the end of clauses chain.
* omp-low.c (scan_sharing_clauses): For OMP_CLAUSE_USE_DEVICE_*
call install_var_field with mask 11 instead of 3.
(lower_omp_target): For OMP_CLAUSE_USE_DEVICE_* use pass
(splay_tree_key) &DECL_UID (var) to build_sender_ref instead of var.
gcc/c/
* c-typeck.c (c_finish_omp_clauses): For C_ORT_OMP
OMP_CLAUSE_USE_DEVICE_* clauses use oacc_reduction_head bitmap
instead of generic_head to track duplicates.
gcc/cp/
* semantics.c (finish_omp_clauses): For C_ORT_OMP
OMP_CLAUSE_USE_DEVICE_* clauses use oacc_reduction_head bitmap
instead of generic_head to track duplicates.
libgomp/
* target.c (gomp_map_vars_internal): For GOMP_MAP_USE_DEVICE_PTR
perform the lookup in the first loop only if !not_found_cnt, otherwise
perform lookups for it in the second loop guarded with
if (not_found_cnt || has_firstprivate).
* testsuite/libgomp.c/target-37.c: New test.
* testsuite/libgomp.c++/target-22.C: New test.
From-SVN: r274206
Diffstat (limited to 'libgomp/target.c')
-rw-r--r-- | libgomp/target.c | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/libgomp/target.c b/libgomp/target.c index 9416401..1c9ca68 100644 --- a/libgomp/target.c +++ b/libgomp/target.c @@ -580,20 +580,12 @@ gomp_map_vars_internal (struct gomp_device_descr *devicep, } else if ((kind & typemask) == GOMP_MAP_USE_DEVICE_PTR) { - cur_node.host_start = (uintptr_t) hostaddrs[i]; - cur_node.host_end = cur_node.host_start; - splay_tree_key n = gomp_map_lookup (mem_map, &cur_node); - if (n == NULL) + tgt->list[i].key = NULL; + if (!not_found_cnt) { - gomp_mutex_unlock (&devicep->lock); - gomp_fatal ("use_device_ptr pointer wasn't mapped"); } - cur_node.host_start -= n->host_start; - hostaddrs[i] - = (void *) (n->tgt->tgt_start + n->tgt_offset - + cur_node.host_start); - tgt->list[i].key = NULL; - tgt->list[i].offset = ~(uintptr_t) 0; + else + tgt->list[i].offset = 0; continue; } else if ((kind & typemask) == GOMP_MAP_STRUCT) @@ -791,9 +783,26 @@ gomp_map_vars_internal (struct gomp_device_descr *devicep, tgt_size += len; continue; case GOMP_MAP_FIRSTPRIVATE_INT: - case GOMP_MAP_USE_DEVICE_PTR: case GOMP_MAP_ZERO_LEN_ARRAY_SECTION: continue; + case GOMP_MAP_USE_DEVICE_PTR: + if (tgt->list[i].offset == 0) + { + cur_node.host_start = (uintptr_t) hostaddrs[i]; + cur_node.host_end = cur_node.host_start; + n = gomp_map_lookup (mem_map, &cur_node); + if (n == NULL) + { + gomp_mutex_unlock (&devicep->lock); + gomp_fatal ("use_device_ptr pointer wasn't mapped"); + } + cur_node.host_start -= n->host_start; + hostaddrs[i] + = (void *) (n->tgt->tgt_start + n->tgt_offset + + cur_node.host_start); + tgt->list[i].offset = ~(uintptr_t) 0; + } + continue; case GOMP_MAP_STRUCT: first = i + 1; last = i + sizes[i]; |