public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libgomp/113216] New: [OpenMP] Improve omp_target_is_accessible
@ 2024-01-03 12:00 burnus at gcc dot gnu.org
  0 siblings, 0 replies; only message in thread
From: burnus at gcc dot gnu.org @ 2024-01-03 12:00 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113216

            Bug ID: 113216
           Summary: [OpenMP] Improve omp_target_is_accessible
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: openmp
          Severity: normal
          Priority: P3
         Component: libgomp
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
                CC: jakub at gcc dot gnu.org
  Target Milestone: ---

For omp_target_is_accessible + unified address:

* it is not 100% correct to assume that any address is accessible on the host,
  it might be a device-only address

(For handling NULL, see also PR 113213)

Likewise for the nonhost device:

* memory might be accessible even if only unified address

* * *

The host case is a bit trickier as no generic documentation seems to be
available albeit some ranges like 0x7F...... seem to denote device addresses +
a superset has to be formed.

* * *

For the device side, an API function might be available to check for it.

* * 

In case of nvptx / CUDA, the following function seems to be suitable:

CUresult cuMemGetAccess ( unsigned long long* flags,
                          const CUmemLocation* location, CUdeviceptr ptr )

checking for flags == CU_MEM_ACCESS_FLAGS_PROT_READWRITE, if I understand it
correctly.

typedef enum CUmemAccess_flags_enum {
 CU_MEM_ACCESS_FLAGS_PROT_NONE   = 0x0,  /**< Default, make the address range
not accessible */
  CU_MEM_ACCESS_FLAGS_PROT_READ  = 0x1,  /**< Make the address range read
accessible */
  CU_MEM_ACCESS_FLAGS_PROT_READWRITE = 0x3,  /**< Make the address range
read-write accessible */
  CU_MEM_ACCESS_FLAGS_PROT_MAX   = 0x7FFFFFFF
} CUmemAccess_flags;

* *

In case of HSA/ROCm, I bet there is also some function.

For instance, hipPointerGetAttribute{,s} + hipDrvPointerGetAttributes permit to
query some pointer data.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-01-03 12:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-03 12:00 [Bug libgomp/113216] New: [OpenMP] Improve omp_target_is_accessible burnus at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).