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/109875] [OpenMP] nteams-var / OMP_NUM_TEAMS → ICV not passed to the device / default value
Date: Wed, 17 May 2023 10:11:44 +0000	[thread overview]
Message-ID: <bug-109875-4-BS9Jg6SmEJ@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-109875-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> ---
The host-fallback explicitly sets the number of teams to the lower_bound,
if available, and otherwise to 1 - which is fine.

Regarding changing the default from 0 to the actually used number,
the problem is on the device side it is only known at runtime
→ issue with OMP_DISPLAY_ENV.
BTW, the "[host] OMP_NUM_TEAMS = '0'" should be "[all] OMP_NUM_TEAMS = '0'
for the default.

For the device side, I think we need (untested):

--- a/libgomp/config/gcn/target.c
+++ b/libgomp/config/gcn/target.c
@@ -51 +51,3 @@ GOMP_teams4 (unsigned int num_teams_lower, unsigned int -   
num_teams_upper = num_workgroups;
+    num_teams_upper = ((GOMP_ADDITIONAL_ICVS.nteams > 0
+                       && num_workgroups > GOMP_ADDITIONAL_ICVS.nteams)
+                      ? GOMP_ADDITIONAL_ICVS.nteams : num_workgroups);
diff --git a/libgomp/config/nvptx/target.c b/libgomp/config/nvptx/target.c
index f102d7d02d9..125d92a2ea9 100644
--- a/libgomp/config/nvptx/target.c
+++ b/libgomp/config/nvptx/target.c
@@ -58 +58,3 @@ GOMP_teams4 (unsigned int num_teams_lower, unsigned int 
-    num_teams_upper = num_blocks;
+    num_teams_upper = ((GOMP_ADDITIONAL_ICVS.nteams > 0
+                       && num_blocks > GOMP_ADDITIONAL_ICVS.nteams)
+                      ? GOMP_ADDITIONAL_ICVS.nteams : num_blocks);

  parent reply	other threads:[~2023-05-17 10:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-16 17:39 [Bug libgomp/109875] New: " burnus at gcc dot gnu.org
2023-05-17  9:47 ` [Bug libgomp/109875] " burnus at gcc dot gnu.org
2023-05-17 10:11 ` burnus at gcc dot gnu.org [this message]
2023-05-21 18:44 ` cvs-commit at gcc dot gnu.org
2023-05-21 18:56 ` 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-109875-4-BS9Jg6SmEJ@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).