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

            Bug ID: 111707
           Summary: omp_target_alloc and omp_target_is_present - corner
                    case handling & spec conformance
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: documentation, wrong-code
          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: ---

To be checked / updated.

Besides fixing the code, also libgomp.texi needs to be updated.

omp_target_alloc:
  For size == 0, the spec meanwhile requires that NULL is returned.

  However, we call 'malloc' on the host which might return a
  a non-NULL pointer that can be passed to 'free'.
  And on the device side, an GOMP_error diagnostic is printed
  to stderr for nvptx and gcn if the allocation fails.
  Both the HSA and CUDA documentation imply that size==0 is
  an error.

omp_target_is_present
  OpenMP states that this functions checks whether the pointer is
  mapped.
  In GCC, we also return 'true' for shared memory systems and
  for the device_num being the host.
  The question is whether that's OK or not.
  Does a SELF MAP qualify or not?
  (self map - A mapping operation that, when corresponding storage is not
   already present, results in corresponding storage that is the same as
   its original storage.)

  [The current behavior is about to be documented, but we can
   change it.]

Reply via email to