This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP][libomptarget] Delay restore of shadow pointers in structs to after H2D memory copies are completed
ClosedPublic

Authored by carlo.bertolli on Feb 16 2022, 12:42 PM.

Details

Summary

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).

Diff Detail

Event Timeline

carlo.bertolli requested review of this revision.Feb 16 2022, 12:42 PM
jdoerfert added inline comments.Feb 16 2022, 1:00 PM
openmp/libomptarget/src/omptarget.cpp
897

Why don't we do this above as well. Seems much simpler and the delay we buy us with the complexity is minimal anyway.

carlo.bertolli added inline comments.Feb 16 2022, 1:01 PM
openmp/libomptarget/src/omptarget.cpp
897

Agreed: good short term solution and keeps complexity down. I will update the patch asap.

Replace list of shadow pointer to be restored with simple synchronization.

carlo.bertolli marked an inline comment as done.Feb 16 2022, 6:48 PM
jdoerfert accepted this revision.Feb 17 2022, 2:13 PM

Nits: Wait (capital W) and "." at the end. Both comments should be proper sentences.

LG

This revision is now accepted and ready to land.Feb 17 2022, 2:13 PM
This revision was landed with ongoing or failed builds.Feb 18 2022, 8:09 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptFeb 18 2022, 8:09 AM