public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Andrew Stubbs <ams@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc/devel/omp/gcc-11] libgomp amdgcn: Fix issues with dynamic OpenMP thread scaling Date: Wed, 4 Aug 2021 14:33:57 +0000 (GMT) [thread overview] Message-ID: <20210804143357.66C5738515E7@sourceware.org> (raw) https://gcc.gnu.org/g:64855d67f0bef461d11da03380de587cca5850e7 commit 64855d67f0bef461d11da03380de587cca5850e7 Author: Andrew Stubbs <ams@codesourcery.com> Date: Tue Aug 3 13:45:35 2021 +0100 libgomp amdgcn: Fix issues with dynamic OpenMP thread scaling libgomp/ChangeLog: * config/gcn/bar.h (gomp_barrier_init): Limit thread count to the actual physical number. * config/gcn/team.c (gomp_team_start): Don't attempt to set up threads that do not exist. Diff: --- libgomp/config/gcn/bar.h | 3 +++ libgomp/config/gcn/team.c | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/libgomp/config/gcn/bar.h b/libgomp/config/gcn/bar.h index bbd3141837f..63e803bd72b 100644 --- a/libgomp/config/gcn/bar.h +++ b/libgomp/config/gcn/bar.h @@ -55,6 +55,9 @@ typedef unsigned int gomp_barrier_state_t; static inline void gomp_barrier_init (gomp_barrier_t *bar, unsigned count) { + unsigned actual_thread_count = __builtin_gcn_dim_size (1); + if (count > actual_thread_count) + count = actual_thread_count; bar->total = count; bar->awaited = count; bar->awaited_final = count; diff --git a/libgomp/config/gcn/team.c b/libgomp/config/gcn/team.c index 627210ea407..6aa74744315 100644 --- a/libgomp/config/gcn/team.c +++ b/libgomp/config/gcn/team.c @@ -187,6 +187,10 @@ gomp_team_start (void (*fn) (void *), void *data, unsigned nthreads, if (nthreads == 1) return; + unsigned actual_thread_count = __builtin_gcn_dim_size (1); + if (nthreads > actual_thread_count) + nthreads = actual_thread_count; + /* Release existing idle threads. */ for (unsigned i = 1; i < nthreads; ++i) {
reply other threads:[~2021-08-04 14:33 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=20210804143357.66C5738515E7@sourceware.org \ --to=ams@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: linkBe 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).