public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/omp/gcc-11] Allow gang-level reductions in OpenACC routines with gang-level parallelism
@ 2021-05-13 16:14 Kwok Yeung
0 siblings, 0 replies; only message in thread
From: Kwok Yeung @ 2021-05-13 16:14 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:ec9998a4c3f31dafe2406064fa236f59972170c0
commit ec9998a4c3f31dafe2406064fa236f59972170c0
Author: Kwok Cheung Yeung <kcy@codesourcery.com>
Date: Thu Mar 19 09:44:18 2020 -0700
Allow gang-level reductions in OpenACC routines with gang-level parallelism
2020-03-19 Kwok Cheung Yeung <kcy@codesourcery.com>
gcc/
* omp-offload.c (oacc_loop_auto_partitions): Check for 'omp declare
target' attributes with a gang clause attached.
Diff:
---
gcc/ChangeLog.omp | 5 +++++
gcc/omp-offload.c | 24 +++++++++++++++++++++---
2 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/gcc/ChangeLog.omp b/gcc/ChangeLog.omp
index bd5d7de4cd7..301a9ece91b 100644
--- a/gcc/ChangeLog.omp
+++ b/gcc/ChangeLog.omp
@@ -1,3 +1,8 @@
+2020-03-19 Kwok Cheung Yeung <kcy@codesourcery.com>
+
+ * omp-offload.c (oacc_loop_auto_partitions): Check for 'omp declare
+ target' attributes with a gang clause attached.
+
2020-03-16 Tobias Burnus <tobias@codesourcery.com>
* omp-oacc-kernels-decompose.cc (maybe_build_inner_data_region):
diff --git a/gcc/omp-offload.c b/gcc/omp-offload.c
index b10047b96d2..21e9b923443 100644
--- a/gcc/omp-offload.c
+++ b/gcc/omp-offload.c
@@ -1620,10 +1620,28 @@ oacc_loop_auto_partitions (oacc_loop *loop, unsigned outer_mask,
/* Orphan reductions cannot have gang partitioning. */
if ((loop->flags & OLF_REDUCTION)
- && oacc_get_fn_attrib (current_function_decl)
- && !lookup_attribute ("omp target entrypoint",
+ && oacc_get_fn_attrib (current_function_decl))
+ {
+ bool gang_p = false;
+ tree attr
+ = lookup_attribute ("omp declare target",
+ DECL_ATTRIBUTES (current_function_decl));
+
+ if (attr)
+ for (tree c = TREE_VALUE (attr); c; c = OMP_CLAUSE_CHAIN (c))
+ if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_GANG)
+ {
+ gang_p = true;
+ break;
+ }
+
+ if (lookup_attribute ("omp target entrypoint",
DECL_ATTRIBUTES (current_function_decl)))
- this_mask = GOMP_DIM_MASK (GOMP_DIM_WORKER);
+ gang_p = true;
+
+ if (!gang_p)
+ this_mask = GOMP_DIM_MASK (GOMP_DIM_WORKER);
+ }
/* Find the first outermost available partition. */
while (this_mask <= outer_mask)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-05-13 16:14 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-13 16:14 [gcc/devel/omp/gcc-11] Allow gang-level reductions in OpenACC routines with gang-level parallelism Kwok Yeung
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).