[Openmp-commits] [PATCH] D84381: [OpenMP] Fixed an issue that memory free might be called inappropriately when the kernel is still running

Shilei Tian via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Wed Jul 22 19:39:27 PDT 2020


tianshilei1992 updated this revision to Diff 280008.
tianshilei1992 added a comment.

Updated based on comments


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84381

Files:
  openmp/libomptarget/src/omptarget.cpp


Index: openmp/libomptarget/src/omptarget.cpp
===================================================================
--- openmp/libomptarget/src/omptarget.cpp
+++ openmp/libomptarget/src/omptarget.cpp
@@ -927,6 +927,14 @@
     return OFFLOAD_FAIL;
   }
 
+  if (Device.RTL->synchronize) {
+    rc = Device.RTL->synchronize(device_id, &AsyncInfo);
+    if (rc != OFFLOAD_SUCCESS) {
+      DP("Failed to synchronize.\n");
+      return OFFLOAD_FAIL;
+    }
+  }
+
   // Deallocate (first-)private arrays
   for (auto it : fpArrays) {
     int rt = Device.RTL->data_delete(Device.RTLDeviceID, it);
@@ -944,8 +952,5 @@
     return OFFLOAD_FAIL;
   }
 
-  if (Device.RTL->synchronize)
-    return Device.RTL->synchronize(device_id, &AsyncInfo);
-
   return OFFLOAD_SUCCESS;
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84381.280008.patch
Type: text/x-patch
Size: 768 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20200723/2bd9cf30/attachment.bin>


More information about the Openmp-commits mailing list