public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "burnus at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libgomp/109837] [OpenMP] despite 'requires unified_address' there is segfault when 'is_device_ptr' is not used
Date: Mon, 15 May 2023 09:31:08 +0000	[thread overview]
Message-ID: <bug-109837-4-Eqz5Jsyiyi@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-109837-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Minor correction/clarification:

  (B) omp_target_is_accessible - will properly work for such pointers.

While it might be useful to handle also (C/C++) code like:
  ptr = omp_target_alloc (...);
  ...
  is_accessible = omp_target_is_accessible(ptr, ...);

The OpenMP spec only requires:
"The *omp_target_is_accessible* routine tests whether host memory is accessible
from a given device."

And "ptr" is a device pointer. Thus, returning FALSE for all such pointers,
unless in shared memory, is OK.

→ Still, we might consider to add checking for memory that is both host and
device accessible - or is a device pointer in the unified-address case.
(Quality of Implementation Feature).

* * *

Besides 'is_device_ptr', the same is required for has_device_addr like in
(Fortran):

  c_ptr = omp_alloc(...)
  call c_f_pointer (c_ptr, fptr)
  !$omp target
    fptr = ...

[That has_device_addr is not mentioned for 'requires unified_addr' is the
OpenMP Spec Issue #3606.]

  reply	other threads:[~2023-05-15  9:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-12 23:08 [Bug libgomp/109837] New: " burnus at gcc dot gnu.org
2023-05-15  9:31 ` burnus at gcc dot gnu.org [this message]
2023-06-06 13:25 ` [Bug libgomp/109837] " burnus at gcc dot gnu.org
2023-06-06 16:28 ` burnus at gcc dot gnu.org
2023-06-13  9:29 ` cvs-commit at gcc dot gnu.org
2023-06-13  9:38 ` burnus at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-109837-4-Eqz5Jsyiyi@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).