[Openmp-commits] [PATCH] D96438: [OpenMP] Move synchronization into `__tgt_async_info`

Johannes Doerfert via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Wed Feb 10 15:03:39 PST 2021


jdoerfert added inline comments.


================
Comment at: openmp/libomptarget/include/omptarget.h:136
+/// The libomptarget wrapper around a __tgt_async_info object directly
+/// associated with a libomptarget layer device. RAII semantics to avoid
+/// mistakes.
----------------
tianshilei1992 wrote:
> Not sure the wrapper has a bonus to fix issues mentioned in D96431.
I don't understand.


================
Comment at: openmp/libomptarget/include/omptarget.h:128
 /// operations for device-dependent optimization and potential synchronization
 struct __tgt_async_info {
+  /// Synchronize the queue with \p Device, if necessary, and resets it to
----------------
tianshilei1992 wrote:
> I suggest we wrap this info into another class, and bind the device object such that we will make sure that the async info object will not be synced by a wrong device.
> ```
> class AsyncInfo {
>   __tgt_async_info TheInfo;
>   DeviceTy &Device;
> public:
>   int synchronize();
> };
> ```
> Then `__tgt_async_info` is only used when we're communicating with plugin. `AsyncInfo` is used across the whole `libomptarget`.
That's what is happening after this patch and a second to replace the remaining uses of __tgt_async_info in the libomptarget layer. Already with this patch `synchronize` will work on the right device.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D96438/new/

https://reviews.llvm.org/D96438



More information about the Openmp-commits mailing list