public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Marcel Vollweiler <marcel@codesourcery.com>
To: Thomas Schwinge <thomas@codesourcery.com>,
	Chung-Lin Tang <cltang@codesourcery.com>
Cc: <gcc-patches@gcc.gnu.org>, Jakub Jelinek <jakub@redhat.com>,
	Tom de Vries <tdevries@suse.de>,
	Andrew Stubbs <ams@codesourcery.com>,
	Julian Brown <julian@codesourcery.com>,
	Tobias Burnus <tobias@codesourcery.com>
Subject: Re: [PATCH] libgomp, OpenMP: Fix issue for omp_get_device_num on gfx targets.
Date: Tue, 18 Jan 2022 15:31:52 +0100	[thread overview]
Message-ID: <53521b17-79d1-6298-fcbf-e77398239422@codesourcery.com> (raw)
In-Reply-To: <87bl09cjtl.fsf@euler.schwinge.homeip.net>

Hi Thomas,

Am 18.01.2022 um 13:25 schrieb Thomas Schwinge:
> Hi!
>
> Maybe I'm just totally confused -- as so often ;-) -- but things seem
> strange here:
>
> On 2022-01-12T10:43:05+0100, Marcel Vollweiler <marcel@codesourcery.com> wrote:
>> Currently omp_get_device_num does not work on gcn targets with more than
>> one offload device. The reason is that GOMP_DEVICE_NUM_VAR
>
> I understand the 'GOMP_DEVICE_NUM_VAR' "macro indirection" is so that we
> define the actual symbol name ('__gomp_device_num') in one place
> ('libgomp/libgomp-plugin.h'), and then use it (via macro expansion) in
> several places, right?

Yes, as far as I understood.

>
>> is static in
>> icv-device.c and thus "__gomp_device_num" is not visible in the offload
>> image.
>
> That behavior seems correct -- but undesired indeed?

Good question. In contrast to nvptx I observed that __gomp_device_num is
not part of the offload image which we read out in
GOMP_OFFLOAD_load_image ("if (status != HSA_STATUS_SUCCESS)" in
libgomp/plugin/plugin-gcn.c returns false). I validated it with some
additional output in the if-branches.

>
>> This patch removes "static" such that "__gomp_device_num" is now part of
>> the offload image and can now be found in GOMP_OFFLOAD_load_image in the
>> plugin.
>
> That seems correct?
>
> Or, is there a reason to have it 'static', say, so that several such
> local variables can co-exist, instead of just one global one?
>
>> This is not an issue for nvptx. There, "__gomp_device_num" is in the
>> offload image even with "static".
>
> That's unexpected then, and should be looked into?

Actually, I don't see the reason for the different behaviour for nvptx.
I just tested that for nvptx the correct device number is returned by
omp_get_device_num on the device - also if we have more than one device.

>
> Still, should 'static' be removed here, too?

I wouldn't suggest unless it is really necessary? I mean, there we don't
have any issue. Although I aggree with Andrew that we could combine both
icv-device.c files into one common file.

Marcel
-----------------
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

  parent reply	other threads:[~2022-01-18 14:32 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-23 10:21 [PATCH, libgomp, OpenMP 5.0] Implement omp_get_device_num Chung-Lin Tang
2021-07-23 10:39 ` Jakub Jelinek
2021-08-02 13:10   ` [PATCH, v2, " Chung-Lin Tang
2021-08-03 11:08     ` Jakub Jelinek
2021-08-03 12:07     ` Thomas Schwinge
2021-08-05 15:30       ` [PATCH, v3, libgomp, OpenMP 5.0, committed] " Chung-Lin Tang
2021-08-09  7:16         ` [PATCH, libgomp, OpenMP 5.0, OG11, " Chung-Lin Tang
2021-08-09  9:30           ` Julian Brown
2021-08-09  9:30             ` Julian Brown
2021-08-03 12:22     ` [PATCH, v2, libgomp, OpenMP 5.0] " Thomas Schwinge
2021-08-05  8:34       ` Chung-Lin Tang
2021-07-23 11:01 ` [PATCH, " Tobias Burnus
2021-08-02 13:09   ` Chung-Lin Tang
2022-01-04  9:28 ` [PATCH, OpenMP, libgomp, committed] Fix GOMP_DEVICE_NUM_VAR stringification error Chung-Lin Tang
2022-01-04 14:12   ` [committed] libgomp/testsuite: Improve omp_get_device_num() tests (was: Re: [PATCH, OpenMP, libgomp, committed] Fix GOMP_DEVICE_NUM_VAR stringification error) Tobias Burnus
2022-01-13 12:22     ` [committed] libgomp/testsuite: Improve omp_get_device_num() tests Thomas Schwinge
2022-01-12  9:43 ` [PATCH] libgomp, OpenMP: Fix issue for omp_get_device_num on gfx targets Marcel Vollweiler
2022-01-18 12:25   ` Thomas Schwinge
2022-01-18 13:55     ` Andrew Stubbs
2022-01-18 14:31     ` Marcel Vollweiler [this message]
2022-01-18 13:47   ` Andrew Stubbs

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=53521b17-79d1-6298-fcbf-e77398239422@codesourcery.com \
    --to=marcel@codesourcery.com \
    --cc=ams@codesourcery.com \
    --cc=cltang@codesourcery.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=julian@codesourcery.com \
    --cc=tdevries@suse.de \
    --cc=thomas@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).