aboutsummaryrefslogtreecommitdiff
path: root/libgomp
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2019-10-09 09:33:02 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2019-10-09 09:33:02 +0200
commit7d48e14fc64b6662108822ab4dbe7754e324702d (patch)
treee73989f3545bbec409f2070b12dbe538b8b1f407 /libgomp
parentf78347996e02a8a767a525bfb764e769afe29d67 (diff)
downloadgcc-7d48e14fc64b6662108822ab4dbe7754e324702d.zip
gcc-7d48e14fc64b6662108822ab4dbe7754e324702d.tar.gz
gcc-7d48e14fc64b6662108822ab4dbe7754e324702d.tar.bz2
re PR libgomp/92028 (OpenACC 'host_data' execution test regressions with nvptx offloading)
PR libgomp/92028 * target.c (gomp_map_vars_internal): Readd the previous GOMP_MAP_USE_DEVICE_PTR handling code in the first loop, though do that just in the !not_found_cnt case. From-SVN: r276753
Diffstat (limited to 'libgomp')
-rw-r--r--libgomp/ChangeLog7
-rw-r--r--libgomp/target.c24
2 files changed, 31 insertions, 0 deletions
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index 67d5737..dcd57cf 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,3 +1,10 @@
+2019-10-09 Jakub Jelinek <jakub@redhat.com>
+
+ PR libgomp/92028
+ * target.c (gomp_map_vars_internal): Readd the previous
+ GOMP_MAP_USE_DEVICE_PTR handling code in the first loop,
+ though do that just in the !not_found_cnt case.
+
2019-10-08 Tobias Burnus <tobias@codesourcery.com>
* gfortran.dg/gomp/target-simd.f90: New.
diff --git a/libgomp/target.c b/libgomp/target.c
index a83cb48..84d6daa 100644
--- a/libgomp/target.c
+++ b/libgomp/target.c
@@ -593,6 +593,30 @@ gomp_map_vars_internal (struct gomp_device_descr *devicep,
tgt->list[i].key = NULL;
if (!not_found_cnt)
{
+ /* In OpenMP < 5.0 and OpenACC the mapping has to be done
+ on a separate construct prior to using use_device_{addr,ptr}.
+ In OpenMP 5.0, map directives need to be ordered by the
+ middle-end before the use_device_* clauses. If
+ !not_found_cnt, all mappings requested (if any) are already
+ mapped, so use_device_{addr,ptr} can be resolved right away.
+ Otherwise, if not_found_cnt, gomp_map_lookup might fail
+ now but would succeed after performing the mappings in the
+ following loop. We can't defer this always to the second
+ loop, because it is not even invoked when !not_found_cnt
+ after the first loop. */
+ 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)
+ {
+ 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;
}
else
tgt->list[i].offset = 0;