[OpenMP][libomptarget] Delay restore of shadow pointers in structs to after H2D memor...
authorCarlo Bertolli <carlo.bertolli@amd.com>
Fri, 18 Feb 2022 15:55:49 +0000 (09:55 -0600)
committerCarlo Bertolli <carlo.bertolli@amd.com>
Fri, 18 Feb 2022 16:09:10 +0000 (10:09 -0600)
commit7b731f4d0bfbbac74210f59b782624662a3c7546
treed3224415f6312a12d348f36633476ff0ec3761e7
parent670aeece51ae0e4029d078fe3a5f06b50d42f15c
[OpenMP][libomptarget] Delay restore of shadow pointers in structs to after H2D memory copies are completed

When using asynchronous plugin calls, shadow pointer restore could happen before the D2H copy for the entire struct has completed, effectively leaving a device pointer in a host struct.
This patch fixes the problem by delaying restore's to after a synchronization happens (target regions) and by calling early synchronization (target update).

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D119968
openmp/libomptarget/src/omptarget.cpp