From: Tobias Burnus <Tobias_Burnus@mentor.com>
To: Jakub Jelinek <jakub@redhat.com>,
Marcel Vollweiler <marcel@codesourcery.com>
Cc: Tobias Burnus <tobias@codesourcery.com>,
<gcc-patches@gcc.gnu.org>, <fortran@gcc.gnu.org>
Subject: Re: [Patch] OpenMP, libgomp: Add new runtime routine omp_target_is_accessible.
Date: Thu, 5 May 2022 11:45:19 +0200 [thread overview]
Message-ID: <7dec977d-8ef7-e028-d1f8-2b2d21d75795@mentor.com> (raw)
In-Reply-To: <YnOZ5QE2F3EGWbt/@tucnak>
Hi,
On 05.05.22 11:33, Jakub Jelinek via Gcc-patches wrote:
> On Mon, Mar 14, 2022 at 04:42:14PM +0100, Marcel Vollweiler wrote:
>> + interface
>> + function omp_target_is_accessible (ptr, size, device_num) bind(c)
>> + use, intrinsic :: iso_c_binding, only : c_ptr, c_size_t, c_int
>> + integer(c_int) :: omp_target_is_accessible
> The function returning integer(c_int) rather than logical seems like
> a screw up in the standard, but too late to fix that :(.
I think the idea is that it can directly call the C function without
needing a wrapper. And as default-kind 'logical' != 'integer(c_int)' in
general, it cannot return logical. (In case of GCC, just claiming that
it is logical would work. But some Fortran compilers use -1 for .true.
and only flip a single bit for .not. For those,
"if(.not.omp_target_is_accessible(..)) will not work properly, if the C
function returns 1.
But I concur that requiring "/= 0" is ugly!
> OT, tried to look how libomptarget implements it and they don't at least
> on llvm-project trunk, but while looking at that, noticed that for
> omp_target_is_present they do return false from omp_target_is_present
> while we return true. It is unclear if NULL has corresponding storage
> on the device (NULL always corresponds to NULL on the device) or not.
Regarding NULL: no idea what's the best semantic – we could ask
for clarification.
Regarding target:
I think "false" from on device makes more sense in general, especially
if the device number points to a different device. It might work in some
cases – but false simply plays save. Note that the spec states:
"When called from within a target region the effect is unspecified."
Thus, either behavior is fine.
Tobias
-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955
next prev parent reply other threads:[~2022-05-05 9:45 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-11 12:30 Marcel Vollweiler
2022-03-11 14:12 ` Tobias Burnus
2022-03-14 15:42 ` Marcel Vollweiler
2022-05-05 9:33 ` Jakub Jelinek
2022-05-05 9:45 ` Tobias Burnus [this message]
2022-05-05 9:51 ` Jakub Jelinek
2022-05-06 11:14 ` Marcel Vollweiler
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=7dec977d-8ef7-e028-d1f8-2b2d21d75795@mentor.com \
--to=tobias_burnus@mentor.com \
--cc=fortran@gcc.gnu.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
--cc=marcel@codesourcery.com \
--cc=tobias@codesourcery.com \
/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).