[Openmp-commits] [PATCH] D123446: [OpenMP][FIX] Remove shadow pointer map and introduce consistent locking

Johannes Doerfert via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Fri Apr 8 22:16:18 PDT 2022


jdoerfert created this revision.
jdoerfert added reviewers: ye-luo, JonChesterfield, jhuber6, tianshilei1992, RaviNarayanaswamy.
Herald added subscribers: guansong, bollu, yaxunl.
Herald added a project: All.
jdoerfert requested review of this revision.
Herald added a subscriber: sstefan1.
Herald added a project: OpenMP.

The shadow pointer map was problematic as we scanned an entire list if
an entry had shadow pointers. The new scheme stores the shadow pointers
inside the entries. This allows easy access without any search. It also
helps us, but also makes it necessary, to define a consistent locking
scheme. The implicit locking of entries via TargetPointerResultTy makes
this pretty effortless, however one has to:

1. Lock HDTTMap before locking an entry.
2. Do not lock HDTTMap while holding an entry lock.
3. Hold the entry lock to read or modify an entry.

The changes to submitData and retrieveData have been made to ensure 2
when the LIBOMPTARGET_INFO flag is used. Most everything else happens by
itself as TargetPointerResultTy acts as a lock_guard for the entry. It
is a little complicated when we deal with multiple entries, especially
as they can be equal. However, one can still follow the rules with
reasonable effort.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D123446

Files:
  openmp/libomptarget/include/device.h
  openmp/libomptarget/src/device.cpp
  openmp/libomptarget/src/omptarget.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123446.421689.patch
Type: text/x-patch
Size: 30259 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20220409/75b4aa82/attachment-0001.bin>


More information about the Openmp-commits mailing list