Skip to content

Commit cb87242

Browse files
committed
[OpenMP] Adds omp_target_is_accessible routine
Adds implementation of omp_target_is_accessible routine with 5.1 behaviour, checking if a host pointer is acccessible from a device without running on the device (from the host).
1 parent bf01578 commit cb87242

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

offload/libomptarget/OpenMP/API.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,18 +220,27 @@ EXTERN int omp_target_is_accessible(const void *Ptr, size_t Size,
220220
return true;
221221
}
222222

223-
// The device number must refer to a valid device
223+
// the device number must refer to a valid device
224224
auto DeviceOrErr = PM->getDevice(DeviceNum);
225225
if (!DeviceOrErr)
226226
FATAL_MESSAGE(DeviceNum, "%s", toString(DeviceOrErr.takeError()).c_str());
227227

228-
// For OpenMP 5.1 the routine checks whether a host pointer is accessible from
228+
// TODO: Add check for openmp version compatability
229+
230+
// for OpenMP 5.1 the routine checks whether a host pointer is accessible from
229231
// the device this requires for the device to support unified shared memory
230232
if (DeviceOrErr->supportsUnifiedMemory()) {
231233
DP("Device %d supports unified memory, returning true\n", DeviceNum);
232234
return true;
233235
}
234236

237+
// TODO: Provide stubs & implementation to check whether a pointer is
238+
// accessible from a given device using hsa_amd_pointer_info for AMDGPU
239+
// implementation for OpenMP 6.x the specification is required to return true
240+
// if the accessibility of the pointer can be determined otherwise it's
241+
// allowed to return false the specification will be clarified from the
242+
// current wording
243+
235244
// functionality to check whether a device pointer is accessible from a device
236245
// (OpenMP 6.0) from the host might not be possible
237246
DP("Device %d does not support unified memory, returning false\n", DeviceNum);

0 commit comments

Comments
 (0)