[Openmp-commits] [PATCH] D86238: [OpenMP] Refactored the function `DeviceTy::data_exchange`

Shilei Tian via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Wed Aug 19 13:08:32 PDT 2020


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG83c3d07994c4: [OpenMP] Refactored the function `DeviceTy::data_exchange` (authored by tianshilei1992).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86238

Files:
  openmp/libomptarget/src/api.cpp
  openmp/libomptarget/src/device.cpp
  openmp/libomptarget/src/device.h


Index: openmp/libomptarget/src/device.h
===================================================================
--- openmp/libomptarget/src/device.h
+++ openmp/libomptarget/src/device.h
@@ -214,8 +214,8 @@
   int32_t retrieveData(void *HstPtrBegin, void *TgtPtrBegin, int64_t Size,
                        __tgt_async_info *AsyncInfoPtr);
   // Copy data from current device to destination device directly
-  int32_t data_exchange(void *SrcPtr, DeviceTy DstDev, void *DstPtr,
-                        int64_t Size, __tgt_async_info *AsyncInfoPtr);
+  int32_t dataExchange(void *SrcPtr, DeviceTy &DstDev, void *DstPtr,
+                       int64_t Size, __tgt_async_info *AsyncInfo);
 
   int32_t runRegion(void *TgtEntryPtr, void **TgtVarsPtr, ptrdiff_t *TgtOffsets,
                     int32_t TgtVarsSize, __tgt_async_info *AsyncInfoPtr);
Index: openmp/libomptarget/src/device.cpp
===================================================================
--- openmp/libomptarget/src/device.cpp
+++ openmp/libomptarget/src/device.cpp
@@ -390,15 +390,15 @@
 }
 
 // Copy data from current device to destination device directly
-int32_t DeviceTy::data_exchange(void *SrcPtr, DeviceTy DstDev, void *DstPtr,
-                                int64_t Size, __tgt_async_info *AsyncInfoPtr) {
-  if (!AsyncInfoPtr || !RTL->data_exchange_async || !RTL->synchronize) {
+int32_t DeviceTy::dataExchange(void *SrcPtr, DeviceTy &DstDev, void *DstPtr,
+                               int64_t Size, __tgt_async_info *AsyncInfo) {
+  if (!AsyncInfo || !RTL->data_exchange_async || !RTL->synchronize) {
     assert(RTL->data_exchange && "RTL->data_exchange is nullptr");
     return RTL->data_exchange(RTLDeviceID, SrcPtr, DstDev.RTLDeviceID, DstPtr,
                               Size);
   } else
     return RTL->data_exchange_async(RTLDeviceID, SrcPtr, DstDev.RTLDeviceID,
-                                    DstPtr, Size, AsyncInfoPtr);
+                                    DstPtr, Size, AsyncInfo);
 }
 
 // Run region on device
Index: openmp/libomptarget/src/api.cpp
===================================================================
--- openmp/libomptarget/src/api.cpp
+++ openmp/libomptarget/src/api.cpp
@@ -171,7 +171,7 @@
     // First try to use D2D memcpy which is more efficient. If fails, fall back
     // to unefficient way.
     if (SrcDev.isDataExchangable(DstDev)) {
-      rc = SrcDev.data_exchange(srcAddr, DstDev, dstAddr, length, nullptr);
+      rc = SrcDev.dataExchange(srcAddr, DstDev, dstAddr, length, nullptr);
       if (rc == OFFLOAD_SUCCESS)
         return OFFLOAD_SUCCESS;
     }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86238.286643.patch
Type: text/x-patch
Size: 2593 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20200819/80961ca0/attachment.bin>


More information about the Openmp-commits mailing list