From patchwork Tue May 24 08:34:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 1634879 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4L6nb04sN1z9sGG for ; Tue, 24 May 2022 18:35:40 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B6C7C385E038 for ; Tue, 24 May 2022 08:35:37 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx-relay16-hz2.antispameurope.com (mx-relay16-hz2.antispameurope.com [83.246.65.158]) by sourceware.org (Postfix) with ESMTPS id 723503856DF5 for ; Tue, 24 May 2022 08:34:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 723503856DF5 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=net-b.de Authentication-Results: sourceware.org; spf=none smtp.mailfrom=net-b.de Received: from s041.wsp.plusnet.de ([195.90.7.81]) by mx-relay16-hz2.antispameurope.com; Tue, 24 May 2022 10:34:29 +0200 Received: from [192.168.0.36] (port-92-195-237-11.dynamic.as20676.net [92.195.237.11]) by s041.wsp.plusnet.de (Postfix) with ESMTPSA id ADCB7140207; Tue, 24 May 2022 10:34:25 +0200 (CEST) Message-ID: Date: Tue, 24 May 2022 10:34:25 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Content-Language: en-US To: gcc-patches , Jakub Jelinek From: Tobias Burnus Subject: [Patch] OpenMP: Support nowait with Fortran [PR105378] X-cloud-security-sender: burnus@net-b.de X-cloud-security-recipient: gcc-patches@gcc.gnu.org X-cloud-security-Virusscan: CLEAN X-cloud-security-disclaimer: This E-Mail was scanned by E-Mailservice on mx-relay16-hz2.antispameurope.com with 42434E22D7E X-cloud-security-connect: s041.wsp.plusnet.de[195.90.7.81], TLS=1, IP=195.90.7.81 X-cloud-security-Digest: af12da771b7579e32599d6d0d5329230 X-cloud-security: scantime:1.320 X-Spam-Status: No, score=-10.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tobias Burnus Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" Adds the Fortran bits to the just committed C/C+++ patch. The testcases are the C/C++ ones, converted to Fortran and based on those in the patch attached to the PR. OK? Tobias OpenMP: Support nowait with Fortran [PRPR105378] 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/testsuite/ PR c/105378 * libgomp.fortran/taskwait-depend-nowait-1.f90: New. gcc/fortran/openmp.cc | 3 +- .../gfortran.dg/gomp/taskwait-depend-nowait-1.f90 | 14 ++++++++ libgomp/libgomp.texi | 2 +- .../libgomp.fortran/taskwait-depend-nowait-1.f90 | 42 ++++++++++++++++++++++ 4 files changed, 59 insertions(+), 2 deletions(-) diff --git a/gcc/fortran/openmp.cc b/gcc/fortran/openmp.cc index 63fd4dd2767..6172ec27687 100644 --- a/gcc/fortran/openmp.cc +++ b/gcc/fortran/openmp.cc @@ -5701,7 +5701,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/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/libgomp.texi b/libgomp/libgomp.texi index b54555d0ccb..56724687fb4 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