llvm-project/openmp/libomptarget/include
Johannes Doerfert b316126887 [OpenMP][FIX] Avoid races in the handling of to be deleted mapping entries
If we decided to delete a mapping entry we did not act on it right away
but first issued and waited for memory copies. In the meantime some
other thread might reuse the entry. While there was some logic to avoid
colliding on the actual "deletion" part, there were two races happening:

1) The data transfer back of the thread deleting the entry and
   the data transfer back of the thread taking over the entry raced.
2) The update to the shadow map happened regardless if the entry was
   actually reused by another thread which left the shadow map in a
   inconsistent state.

To fix both issues we will now update the shadow map and delete the
entry only if we are sure the thread is responsible for deletion, hence
no other thread took over the entry and reused it. We also wait for a
potential former data transfer from the device to finish before we issue
another one that would race with it.

Fixes https://github.com/llvm/llvm-project/issues/54216

Differential Revision: https://reviews.llvm.org/D121058
2022-03-28 22:33:18 -05:00
..
Debug.h [OpenMP] Add an information flag for device data transfers 2021-06-08 20:23:27 -04:00
DeviceEnvironment.h [libomptarget] Move device environment to shared header, remove divergence 2021-10-07 12:03:48 +01:00
ExclusiveAccess.h [OpenMP][FIX] Repair ExclusiveAccess move semantic snafu 2022-03-25 16:00:53 -05:00
SourceInfo.h [OpenMP] Add source location information to the libomptarget profile 2021-01-25 22:43:43 -06:00
device.h [OpenMP][FIX] Avoid races in the handling of to be deleted mapping entries 2022-03-28 22:33:18 -05:00
dlwrap.h [nfc][openmp] Swap arguments to remove noise from upcoming diff 2022-03-11 23:08:37 +00:00
interop.h Runtime for Interop directive 2022-01-27 15:16:24 -05:00
omptarget.h Runtime for Interop directive 2022-01-27 15:16:24 -05:00
omptargetplugin.h [OpenMP] Allow to explicitly deinitialize device resources 2022-03-07 23:43:04 -06:00
rtl.h [OpenMP] Allow to explicitly deinitialize device resources 2022-03-07 23:43:04 -06:00