Discussion:
[committed] Support multiple OpenACC wait clauses
Thomas Schwinge
2018-11-30 20:47:10 UTC
Permalink
Hi!

I ran into this while working on something else, and it turned into a
prerequisite. Committed to trunk in r266684:

commit ba688147af7632d7e1c420c98f2d301f7b9e427c
Author: tschwinge <***@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Fri Nov 30 20:39:08 2018 +0000

Support multiple OpenACC wait clauses

Support for this is not explicitly called for in OpenACC 2.6, but given that
GCC internally decomposes "wait (1, 2)" into "wait (1) wait (2)" (similar for
other clauses, too), it's reasonable to also support that syntax in the front
ends -- which happens to already be the case for C, C++, and easy enough to do
for Fortran.

gcc/fortran/
* openmp.c (gfc_match_omp_clauses): Support multiple OpenACC wait
clauses.
gcc/testsuite/
* c-c++-common/goacc/asyncwait-5.c: New file.
* gfortran.dg/goacc/asyncwait-5.f: Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/***@266684 138bc75d-0d04-0410-961f-82ee72b054a4
---
gcc/fortran/ChangeLog | 5 +++++
gcc/fortran/openmp.c | 1 -
gcc/testsuite/ChangeLog | 5 +++++
gcc/testsuite/c-c++-common/goacc/asyncwait-5.c | 14 ++++++++++++++
gcc/testsuite/gfortran.dg/goacc/asyncwait-5.f | 13 +++++++++++++
5 files changed, 37 insertions(+), 1 deletion(-)

diff --git gcc/fortran/ChangeLog gcc/fortran/ChangeLog
index 06e7400eda7d..435ecf82f970 100644
--- gcc/fortran/ChangeLog
+++ gcc/fortran/ChangeLog
@@ -1,3 +1,8 @@
+2018-11-30 Thomas Schwinge <***@codesourcery.com>
+
+ * openmp.c (gfc_match_omp_clauses): Support multiple OpenACC wait
+ clauses.
+
2018-11-27 Martin Liska <***@suse.cz>

* decl.c (gfc_match_gcc_builtin): New function.
diff --git gcc/fortran/openmp.c gcc/fortran/openmp.c
index 6430e61ea7a6..e1560c1fe372 100644
--- gcc/fortran/openmp.c
+++ gcc/fortran/openmp.c
@@ -1876,7 +1876,6 @@ gfc_match_omp_clauses (gfc_omp_clauses **cp, const omp_mask mask,
break;
case 'w':
if ((mask & OMP_CLAUSE_WAIT)
- && !c->wait
&& gfc_match ("wait") == MATCH_YES)
{
c->wait = true;
diff --git gcc/testsuite/ChangeLog gcc/testsuite/ChangeLog
index 874c158f75dd..75ca70b4af28 100644
--- gcc/testsuite/ChangeLog
+++ gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2018-11-30 Thomas Schwinge <***@codesourcery.com>
+
+ * c-c++-common/goacc/asyncwait-5.c: New file.
+ * gfortran.dg/goacc/asyncwait-5.f: Likewise.
+
2018-11-30 Peter Bergner <***@linux.ibm.com>

PR target/87496
diff --git gcc/testsuite/c-c++-common/goacc/asyncwait-5.c gcc/testsuite/c-c++-common/goacc/asyncwait-5.c
new file mode 100644
index 000000000000..fe6f8a0cf2da
--- /dev/null
+++ gcc/testsuite/c-c++-common/goacc/asyncwait-5.c
@@ -0,0 +1,14 @@
+/* Multiple OpenACC wait clauses. */
+
+/* { dg-additional-options "-fdump-tree-original" } */
+
+void f()
+{
+#pragma acc parallel async (1) wait (14)
+ ;
+ /* { dg-final { scan-tree-dump-times "(?n)#pragma acc parallel wait\\(14\\) async\\(1\\)$" 1 "original" } } */
+
+#pragma acc parallel async (2) wait (11, 12) wait (13)
+ ;
+ /* { dg-final { scan-tree-dump-times "(?n)#pragma acc parallel wait\\(13\\) wait\\(12\\) wait\\(11\\) async\\(2\\)\$" 1 "original" } } */
+}
diff --git gcc/testsuite/gfortran.dg/goacc/asyncwait-5.f gcc/testsuite/gfortran.dg/goacc/asyncwait-5.f
new file mode 100644
index 000000000000..59b886343af6
--- /dev/null
+++ gcc/testsuite/gfortran.dg/goacc/asyncwait-5.f
@@ -0,0 +1,13 @@
+! Multiple OpenACC wait clauses.
+
+! { dg-additional-options "-fdump-tree-original" }
+
+!$ACC PARALLEL ASYNC (1) WAIT (14)
+!$ACC END PARALLEL
+! { dg-final { scan-tree-dump-times "(?n)#pragma acc parallel async\\(1\\) wait\\(14\\)$" 1 "original" } }
+
+!$ACC PARALLEL ASYNC (2) WAIT (11, 12) WAIT(13)
+!$ACC END PARALLEL
+! { dg-final { scan-tree-dump-times "(?n)#pragma acc parallel async\\(2\\) wait\\(11\\) wait\\(12\\) wait\\(13\\)$" 1 "original" } }
+
+ END


Grüße
Thomas

Loading...