public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/omp/gcc-11] Allow gang reductions inside serial constructs
@ 2021-05-13 16:13 Kwok Yeung
0 siblings, 0 replies; only message in thread
From: Kwok Yeung @ 2021-05-13 16:13 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:cd75dfe029ca229d30fa9242f44d9ca85f415209
commit cd75dfe029ca229d30fa9242f44d9ca85f415209
Author: Kwok Cheung Yeung <kcy@codesourcery.com>
Date: Fri Mar 13 11:13:49 2020 -0700
Allow gang reductions inside serial constructs
2020-03-13 Kwok Cheung Yeung <kcy@codesourcery.com>
gcc/fortran/
* openmp.c (oacc_is_serial, oacc_is_parallel_or_serial): New.
(resolve_oacc_loop_blocks): Use oacc_is_parallel_or_serial instead of
oacc_is_parallel.
Diff:
---
gcc/fortran/ChangeLog.omp | 6 ++++++
gcc/fortran/openmp.c | 14 +++++++++++++-
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/gcc/fortran/ChangeLog.omp b/gcc/fortran/ChangeLog.omp
index 4a64c0955a9..ee4f76d28de 100644
--- a/gcc/fortran/ChangeLog.omp
+++ b/gcc/fortran/ChangeLog.omp
@@ -1,3 +1,9 @@
+2020-03-13 Kwok Cheung Yeung <kcy@codesourcery.com>
+
+ * openmp.c (oacc_is_serial, oacc_is_parallel_or_serial): New.
+ (resolve_oacc_loop_blocks): Use oacc_is_parallel_or_serial instead of
+ oacc_is_parallel.
+
2020-02-19 Julian Brown <julian@codesourcery.com>
* trans-openmp.c (gfc_omp_check_optional_argument): Handle non-decl
diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c
index b7e446d64d7..e3a8df7cfe2 100644
--- a/gcc/fortran/openmp.c
+++ b/gcc/fortran/openmp.c
@@ -6692,6 +6692,18 @@ oacc_is_parallel (gfc_code *code)
return code->op == EXEC_OACC_PARALLEL || code->op == EXEC_OACC_PARALLEL_LOOP;
}
+static bool
+oacc_is_serial (gfc_code *code)
+{
+ return code->op == EXEC_OACC_SERIAL || code->op == EXEC_OACC_SERIAL_LOOP;
+}
+
+static bool
+oacc_is_parallel_or_serial (gfc_code *code)
+{
+ return oacc_is_parallel (code) || oacc_is_serial (code);
+}
+
static gfc_statement
omp_code_to_statement (gfc_code *code)
{
@@ -6965,7 +6977,7 @@ resolve_oacc_loop_blocks (gfc_code *code)
for (c = omp_current_ctx; c; c = c->previous)
if (!oacc_is_loop (c->code))
break;
- if (c == NULL || !oacc_is_parallel (c->code))
+ if (c == NULL || !oacc_is_parallel_or_serial (c->code))
gfc_error ("gang reduction on an orphan loop at %L", &code->loc);
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-05-13 16:13 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:13 [gcc/devel/omp/gcc-11] Allow gang reductions inside serial constructs 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).