public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Marcel Vollweiler <marcel@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc/devel/omp/gcc-11] libgomp, OpenMP: Fix issue for omp_get_device_num on gcn targets.
Date: Wed, 19 Jan 2022 13:59:14 +0000 (GMT)	[thread overview]
Message-ID: <20220119135914.822CB3858C27@sourceware.org> (raw)

https://gcc.gnu.org/g:9ee542ed40259d830ff0e8944266d74c715b2ec8

commit 9ee542ed40259d830ff0e8944266d74c715b2ec8
Author: Marcel Vollweiler <marcel@codesourcery.com>
Date:   Wed Jan 19 05:57:54 2022 -0800

    libgomp, OpenMP: Fix issue for omp_get_device_num on gcn targets.
    
    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 is static in
    icv-device.c and thus "__gomp_device_num" is not visible in the offload image.
    
    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.
    
    This is not an issue for nvptx. There, "__gomp_device_num" is in the offload
    image even with "static".
    
    libgomp/ChangeLog:
    
            * config/gcn/icv-device.c: Make GOMP_DEVICE_NUM_VAR public (remove
            "static") to make the device num available in the offload image.
    
    (cherry picked from commit 0bd247bbbe4cf396173f09eeec37e116e98f8471)

Diff:
---
 gcc/ChangeLog.omp               | 6 ++++++
 libgomp/config/gcn/icv-device.c | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/gcc/ChangeLog.omp b/gcc/ChangeLog.omp
index 88826ce2944..568ffb839cf 100644
--- a/gcc/ChangeLog.omp
+++ b/gcc/ChangeLog.omp
@@ -1,3 +1,9 @@
+2022-01-19  Marcel Vollweiler  <marcel@codesourcery.com>
+
+	Backport from master:
+	* config/gcn/icv-device.c: Make GOMP_DEVICE_NUM_VAR public (remove
+	"static") to make the device num available in the offload image.
+
 2021-12-22  Andrew Stubbs  <ams@codesourcery.com>
 
 	Backport from master:
diff --git a/libgomp/config/gcn/icv-device.c b/libgomp/config/gcn/icv-device.c
index 34e0f8346f2..9676427e28b 100644
--- a/libgomp/config/gcn/icv-device.c
+++ b/libgomp/config/gcn/icv-device.c
@@ -72,7 +72,7 @@ omp_is_initial_device (void)
 
 /* This is set to the device number of current GPU during device initialization,
    when the offload image containing this libgomp portion is loaded.  */
-static volatile int GOMP_DEVICE_NUM_VAR;
+volatile int GOMP_DEVICE_NUM_VAR;
 
 int
 omp_get_device_num (void)


                 reply	other threads:[~2022-01-19 13:59 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20220119135914.822CB3858C27@sourceware.org \
    --to=marcel@gcc.gnu.org \
    --cc=gcc-cvs@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).