[Openmp-commits] [PATCH] D153837: Synchronize after each GPU action in the nextgen plugin
    Kevin Sala via Phabricator via Openmp-commits 
    openmp-commits at lists.llvm.org
       
    Mon Jul 17 07:01:37 PDT 2023
    
    
  
kevinsala added inline comments.
================
Comment at: openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.cpp:218
+  // synchronize regardless of the local async info.
+  if (ForceSynchronize || AsyncInfoPtr == &LocalAsyncInfo && AsyncInfoPtr->Queue && !Err)
     Err = Device.synchronize(&LocalAsyncInfo);
----------------
I believe the parenthesis in my snippet above are necessary. As the code is now, it would synchronize inconditionally when the new envar is set. However, when there is no queue (stream) or there was a previous error (`Err`), we shouldn't synchronize. I think the condition should be:
```
if ((ForceSynchronization || AsyncInfoPtr == &LocalAsyncInfo) && AsyncInfoPtr->Queue && !Err)
```
Also, the `sycnhronize` call should be changed to the code below. Otherwise, we will always synchronize with the local async info.
```
Err = Device.synchronize(AsyncInfoPtr);
```
CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D153837/new/
https://reviews.llvm.org/D153837
    
    
More information about the Openmp-commits
mailing list