[Openmp-commits] [openmp] [OpenMP][OMPT] Add OMPT callback for device data exchange 'Device-to-Device' (PR #81991)
via Openmp-commits
openmp-commits at lists.llvm.org
Tue Feb 20 10:36:27 PST 2024
================
@@ -185,6 +185,17 @@ int32_t DeviceTy::retrieveData(void *HstPtrBegin, void *TgtPtrBegin,
// Copy data from current device to destination device directly
int32_t DeviceTy::dataExchange(void *SrcPtr, DeviceTy &DstDev, void *DstPtr,
int64_t Size, AsyncInfoTy &AsyncInfo) {
+ /// RAII to establish tool anchors before and after data exchange
+ /// Note: Despite the fact that this is a data exchange, we use 'from_device'
+ /// operation enum (w.r.t. ompt_target_data_op_t) as there is currently
+ /// no better alternative. It is still possible to distinguish this
+ /// scenario from a real data retrieve by checking if both involved
+ /// device numbers are less than omp_get_num_devices().
+ OMPT_IF_BUILT(
+ InterfaceRAII TargetDataExchangeRAII(
+ RegionInterface.getCallbacks<ompt_target_data_transfer_from_device>(),
+ DeviceID, SrcPtr, DstDev.RTLDeviceID, DstPtr, Size,
----------------
dhruvachak wrote:
Use RTLDeviceID instead of DeviceID in the callback since that's what is used in the actual RTL->data_exchange invocation?
https://github.com/llvm/llvm-project/pull/81991
More information about the Openmp-commits
mailing list