https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113216
--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> ---
The to-do list assumes that the about to land patch for PR121813 has been
committed, fixing that PR and PR 113213 (nullptr/size=0), i.e.only the
following remains.
* * *
Still to be done (TODO):
* Currently, it is assumed that all memory is host accessible.
This implies:
- For the host, the memory is assumed to be always accessible
- For nonhost devices, it is assumes that pointer is always
accessible (at least of the runtime of the current device
doesn't know the pointer).
For the host - but also for devices, esp. if mixing two different
device runtimes (like ROCm + CUDA), this is not the case if the
memory is allocated for a specific device by, e.g., 'omp_target_alloc'.
Thus, for a nohost device:
- check whether the device knows that mem is accessible → if so, return true
- check whether the device knows that mem is inaccessible → return false
- If host memory is inaccessible → return false
- Otherwise, continue with the following
For the host device:
- Assume that all memory is host accessible, unless it is known to be
inaccessible. Thus:
for all non-host devices (but the device in question):
if it is known mem is not accessible by the host
(owned by this device) -> return false
otherwise → return true
The assumption that host memory is accessible, is currently made in:
- OMP_OFFLOAD_is_accessible_ptr
- omp_target_is_accessible
- in the documentation (libgomp.texi)
* The check for USM is currently based on the capability flag, which
is only checked for with 'omp requires unified_shared_memory/self_maps',
but it might be also accessible otherwise.
For AMD GPUs, besides checking SYSTEM_INFO_SVM_ACCESSIBLE_BY_DEFAULT,
also a check whether a GPU is an APU to permit systems where not all
devices support GPUs.
(The USM assumption is likewise in target.c and in the plugin + in the .texi)
* omp_target_is_accessible is now required to be available on the device;
we need to have at least a stub version that return false (0) / unknown for
all values – but it needs to be available.
TO DO: There might be other routines that lost some wording regarding
device use, i.e. some more stubs might be required.