From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1534) id 711493857433; Tue, 5 Jul 2022 08:10:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 711493857433 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Tobias Burnus To: gcc-cvs@gcc.gnu.org Subject: [gcc/devel/omp/gcc-12] OpenMP: Support nowait with Fortran [PR105378] X-Act-Checkin: gcc X-Git-Author: Tobias Burnus X-Git-Refname: refs/heads/devel/omp/gcc-12 X-Git-Oldrev: a25ddca52deba998c1ac6962a690f6ecca6a1ddb X-Git-Newrev: 47b01438a722d3abadfddd72132e6f3123b90f6c Message-Id: <20220705081038.711493857433@sourceware.org> Date: Tue, 5 Jul 2022 08:10:38 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jul 2022 08:10:38 -0000 https://gcc.gnu.org/g:47b01438a722d3abadfddd72132e6f3123b90f6c commit 47b01438a722d3abadfddd72132e6f3123b90f6c Author: Tobias Burnus Date: Tue Jul 5 09:18:13 2022 +0200 OpenMP: Support nowait with Fortran [PR105378] Fortran part to C/C++/libgomp commit r13-724-gb43836914bdc2a37563cf31359b2c4803bfe4374 gcc/fortran/ PR c/105378 * openmp.cc (gfc_match_omp_taskwait): Accept nowait. gcc/testsuite/ PR c/105378 * gfortran.dg/gomp/taskwait-depend-nowait-1.f90: New. libgomp/ PR c/105378 * libgomp.texi (OpenMP 5.1): Set 'taskwait nowait' to 'Y'. * testsuite/libgomp.fortran/taskwait-depend-nowait-1.f90: New. (cherry picked from commit 4fb2b4f7ea6b80ae75d3efb6f86e7c6179080535) Diff: --- gcc/fortran/ChangeLog.omp | 8 +++++ gcc/fortran/openmp.cc | 3 +- gcc/testsuite/ChangeLog.omp | 8 +++++ .../gfortran.dg/gomp/taskwait-depend-nowait-1.f90 | 14 ++++++++ libgomp/ChangeLog.omp | 9 +++++ libgomp/libgomp.texi | 2 +- .../libgomp.fortran/taskwait-depend-nowait-1.f90 | 42 ++++++++++++++++++++++ 7 files changed, 84 insertions(+), 2 deletions(-) diff --git a/gcc/fortran/ChangeLog.omp b/gcc/fortran/ChangeLog.omp index 6da0dce78ab..9a7cebb45c7 100644 --- a/gcc/fortran/ChangeLog.omp +++ b/gcc/fortran/ChangeLog.omp @@ -1,3 +1,11 @@ +2022-07-05 Tobias Burnus + + Backport from mainline: + 2022-05-24 Tobias Burnus + + PR c/105378 + * openmp.cc (gfc_match_omp_taskwait): Accept nowait. + 2022-07-05 Tobias Burnus Backport from mainline: diff --git a/gcc/fortran/openmp.cc b/gcc/fortran/openmp.cc index ff7545089b6..76b25a82ec9 100644 --- a/gcc/fortran/openmp.cc +++ b/gcc/fortran/openmp.cc @@ -6427,7 +6427,8 @@ gfc_match_omp_taskwait (void) new_st.ext.omp_clauses = NULL; return MATCH_YES; } - return match_omp (EXEC_OMP_TASKWAIT, omp_mask (OMP_CLAUSE_DEPEND)); + return match_omp (EXEC_OMP_TASKWAIT, + omp_mask (OMP_CLAUSE_DEPEND) | OMP_CLAUSE_NOWAIT); } diff --git a/gcc/testsuite/ChangeLog.omp b/gcc/testsuite/ChangeLog.omp index 6523bed1dd5..473bd6ba061 100644 --- a/gcc/testsuite/ChangeLog.omp +++ b/gcc/testsuite/ChangeLog.omp @@ -1,3 +1,11 @@ +2022-07-05 Tobias Burnus + + Backport from mainline: + 2022-05-24 Tobias Burnus + + PR c/105378 + * gfortran.dg/gomp/taskwait-depend-nowait-1.f90: New. + 2022-07-05 Tobias Burnus Backport from mainline: diff --git a/gcc/testsuite/gfortran.dg/gomp/taskwait-depend-nowait-1.f90 b/gcc/testsuite/gfortran.dg/gomp/taskwait-depend-nowait-1.f90 new file mode 100644 index 00000000000..cd2f1d288be --- /dev/null +++ b/gcc/testsuite/gfortran.dg/gomp/taskwait-depend-nowait-1.f90 @@ -0,0 +1,14 @@ +subroutine foo (p) + integer :: p(*) + !$omp taskwait depend(iterator(i = 1:17) , in : p(i)) nowait depend(out : p(32)) +end + +subroutine bar (p) + implicit none + integer :: p(*) + !$omp taskwait depend(mutexinoutset : p(1)) nowait ! { dg-error "'mutexinoutset' kind in 'depend' clause on a 'taskwait' construct" } +end + +subroutine baz + !$omp taskwait nowait ! { dg-error "'taskwait' construct with 'nowait' clause but no 'depend' clauses" } +end diff --git a/libgomp/ChangeLog.omp b/libgomp/ChangeLog.omp index e1c16cb8f6b..dd0db03a02d 100644 --- a/libgomp/ChangeLog.omp +++ b/libgomp/ChangeLog.omp @@ -1,3 +1,12 @@ +2022-07-05 Tobias Burnus + + Backport from mainline: + 2022-05-24 Tobias Burnus + + PR c/105378 + * libgomp.texi (OpenMP 5.1): Set 'taskwait nowait' to 'Y'. + * testsuite/libgomp.fortran/taskwait-depend-nowait-1.f90: New. + 2022-07-05 Tobias Burnus Backport from mainline: diff --git a/libgomp/libgomp.texi b/libgomp/libgomp.texi index 8f30f6ed4b5..1f2f848ba73 100644 --- a/libgomp/libgomp.texi +++ b/libgomp/libgomp.texi @@ -303,7 +303,7 @@ The OpenMP 4.5 specification is fully supported. @code{target} regions @tab N @tab @item @code{interop} directive @tab N @tab @item @code{omp_interop_t} object support in runtime routines @tab N @tab -@item @code{nowait} clause in @code{taskwait} directive @tab N @tab +@item @code{nowait} clause in @code{taskwait} directive @tab Y @tab @item Extensions to the @code{atomic} directive @tab Y @tab @item @code{seq_cst} clause on a @code{flush} construct @tab Y @tab @item @code{inoutset} argument to the @code{depend} clause @tab Y @tab diff --git a/libgomp/testsuite/libgomp.fortran/taskwait-depend-nowait-1.f90 b/libgomp/testsuite/libgomp.fortran/taskwait-depend-nowait-1.f90 new file mode 100644 index 00000000000..a5b058d4a4f --- /dev/null +++ b/libgomp/testsuite/libgomp.fortran/taskwait-depend-nowait-1.f90 @@ -0,0 +1,42 @@ +program main + implicit none + integer :: a(0:63), b = 1 + !$omp parallel num_threads (4) + block + !$omp single + block + integer :: i + !$omp taskwait depend(in: a) nowait + !$omp taskwait depend(in: a) nowait + !$omp taskwait + !$omp taskgroup + block + !$omp taskwait depend(in: a) nowait + !$omp taskwait depend(in: a) nowait + end block + do i = 0, 63 + !$omp task depend(in: a) shared(a) + block + a(i) = i + end block + end do + !$omp taskwait depend(inout: a) nowait + do i = 0, 63 + !$omp task depend(inoutset: a) shared(a) + block + if (a(i) /= i) then + error stop + else + a(i) = 2 * i + 1 + end if + end block + end do + !$omp taskwait nowait depend(out: a) depend(in: b) + !$omp taskwait depend(inout: b) + do i = 0, 63 + if (a(i) /= 2 * i + 1) & + error stop + end do + end block + end block +end program