Changeset View
Changeset View
Standalone View
Standalone View
openmp/libomptarget/src/api.cpp
Show First 20 Lines • Show All 101 Lines • ▼ Show 20 Lines | if (DevicesSize <= (size_t)device_num) { | ||||
DP("Call to omp_target_is_present with invalid device ID, returning " | DP("Call to omp_target_is_present with invalid device ID, returning " | ||||
"false\n"); | "false\n"); | ||||
return false; | return false; | ||||
} | } | ||||
DeviceTy &Device = *PM->Devices[device_num]; | DeviceTy &Device = *PM->Devices[device_num]; | ||||
bool IsLast; // not used | bool IsLast; // not used | ||||
bool IsHostPtr; | bool IsHostPtr; | ||||
void *TgtPtr = Device.getTgtPtrBegin(const_cast<void *>(ptr), 0, IsLast, | TargetPointerResultTy TPR = | ||||
Device.getTgtPtrBegin(const_cast<void *>(ptr), 0, IsLast, | |||||
/*UpdateRefCount=*/false, | /*UpdateRefCount=*/false, | ||||
/*UseHoldRefCount=*/false, IsHostPtr); | /*UseHoldRefCount=*/false, IsHostPtr); | ||||
int rc = (TgtPtr != NULL); | int rc = (TPR.TargetPointer != NULL); | ||||
// Under unified memory the host pointer can be returned by the | // Under unified memory the host pointer can be returned by the | ||||
// getTgtPtrBegin() function which means that there is no device | // getTgtPtrBegin() function which means that there is no device | ||||
// corresponding point for ptr. This function should return false | // corresponding point for ptr. This function should return false | ||||
// in that situation. | // in that situation. | ||||
if (PM->RTLs.RequiresFlags & OMP_REQ_UNIFIED_SHARED_MEMORY) | if (PM->RTLs.RequiresFlags & OMP_REQ_UNIFIED_SHARED_MEMORY) | ||||
rc = !IsHostPtr; | rc = !IsHostPtr; | ||||
DP("Call to omp_target_is_present returns %d\n", rc); | DP("Call to omp_target_is_present returns %d\n", rc); | ||||
return rc; | return rc; | ||||
▲ Show 20 Lines • Show All 199 Lines • Show Last 20 Lines |