[Openmp-commits] [openmp] 83c3d07 - [OpenMP] Refactored the function `DeviceTy::data_exchange`
Shilei Tian via Openmp-commits
openmp-commits at lists.llvm.org
Wed Aug 19 13:08:20 PDT 2020
Author: Shilei Tian
Date: 2020-08-19T16:08:14-04:00
New Revision: 83c3d07994c4cd24b9548362d03290af2a9483b0
URL: https://github.com/llvm/llvm-project/commit/83c3d07994c4cd24b9548362d03290af2a9483b0
DIFF: https://github.com/llvm/llvm-project/commit/83c3d07994c4cd24b9548362d03290af2a9483b0.diff
LOG: [OpenMP] Refactored the function `DeviceTy::data_exchange`
This patch contains the following changes:
1. Renamed the function `DeviceTy::data_exchange` to `DeviceTy::dataExchange`;
2. Changed the second argument `DeviceTy DstDev` to `DeviceTy &DstDev`;
3. Renamed the last argument.
Reviewed By: ye-luo
Differential Revision: https://reviews.llvm.org/D86238
Added:
Modified:
openmp/libomptarget/src/api.cpp
openmp/libomptarget/src/device.cpp
openmp/libomptarget/src/device.h
Removed:
################################################################################
diff --git a/openmp/libomptarget/src/api.cpp b/openmp/libomptarget/src/api.cpp
index d0f7324347c0..2c5d7b5ceba7 100644
--- a/openmp/libomptarget/src/api.cpp
+++ b/openmp/libomptarget/src/api.cpp
@@ -171,7 +171,7 @@ EXTERN int omp_target_memcpy(void *dst, void *src, size_t length,
// 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;
}
diff --git a/openmp/libomptarget/src/device.cpp b/openmp/libomptarget/src/device.cpp
index 5a01257f132d..f848e67a5033 100644
--- a/openmp/libomptarget/src/device.cpp
+++ b/openmp/libomptarget/src/device.cpp
@@ -390,15 +390,15 @@ int32_t DeviceTy::retrieveData(void *HstPtrBegin, void *TgtPtrBegin,
}
// 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
diff --git a/openmp/libomptarget/src/device.h b/openmp/libomptarget/src/device.h
index 655cf96d8f6f..098bad0d3875 100644
--- a/openmp/libomptarget/src/device.h
+++ b/openmp/libomptarget/src/device.h
@@ -214,8 +214,8 @@ struct DeviceTy {
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, ptr
diff _t *TgtOffsets,
int32_t TgtVarsSize, __tgt_async_info *AsyncInfoPtr);
More information about the Openmp-commits
mailing list