[Libomptarget] Implement OpenMP 5.2 semantics for device pointers
authorJoseph Huber <jhuber6@vols.utk.edu>
Wed, 7 Sep 2022 18:37:26 +0000 (13:37 -0500)
committerJoseph Huber <jhuber6@vols.utk.edu>
Wed, 7 Sep 2022 22:01:14 +0000 (17:01 -0500)
commit6e8d93e5c2351efcf3f6fd658af642b027da3bc4
tree8b160d82486ffd2aaa745e6a514ca1e32a04e286
parentc37acb642660d83b83390d768ad7a12573a876ae
[Libomptarget] Implement OpenMP 5.2 semantics for device pointers

In OpenMP 5.2, ยง5.8.6, page 160 line 32-33, when a device pointer
allocated by omp_target_alloc has implicitly been included on a target
construct as a zero-length array, the pointer initialisation should not
find a matching mapped list item, and so should retain its value as a
firstprivate variable. Previously, we would return a null pointer if the
list item was not found. This patch updates the map handling to the
OpenMP 5.2 semantics.

Reviewed By: jdoerfert, ye-luo

Differential Revision: https://reviews.llvm.org/D133447
openmp/libomptarget/include/device.h
openmp/libomptarget/src/api.cpp
openmp/libomptarget/src/device.cpp
openmp/libomptarget/src/omptarget.cpp
openmp/libomptarget/test/mapping/implicit_device_ptr.c [new file with mode: 0644]