From patchwork Wed Nov 2 20:10:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 59803 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 862E7385697F for ; Wed, 2 Nov 2022 20:11:24 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa3.mentor.iphmx.com (esa3.mentor.iphmx.com [68.232.137.180]) by sourceware.org (Postfix) with ESMTPS id 007B3385AC25; Wed, 2 Nov 2022 20:11:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 007B3385AC25 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com X-IronPort-AV: E=Sophos;i="5.95,234,1661846400"; d="scan'208,223";a="85794548" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa3.mentor.iphmx.com with ESMTP; 02 Nov 2022 12:11:04 -0800 IronPort-SDR: 7jYKrbjzsf1cwEr8MOeJTls8ZqJ7ekIwwV9ECIagM/zhjUV4lJiLuElKPugdOneynfvHYYBNeM yz0+nm7YXdRLq/hR04wDPBa2GLtLs0k5jOzTGjd1KQmfabg5gSmAq/QlHeJ8LtiDkWb+ddGElH VI51zLCtYRezVFzi3cVft84jTczvWrh/gT0Kctb8ps4xgnxd7pEbDvDXzK+MgRxEsn3WG3c8tk 3asD9Ob8J4ksyDsmIGn8TNjsTERp1X8EDbnEA+Wgr8kdVNn6aL1Wt9N45H3LnELGVSqe7cnXeV Nbo= From: Thomas Schwinge To: , Subject: Add 'libgomp.oacc-fortran/declare-allocatable-1-runtime.f90' (was: Add 'libgomp.oacc-fortran/declare-allocatable-1.f90') In-Reply-To: <877d0dktqv.fsf@euler.schwinge.homeip.net> References: <86f51209-c59d-a4cf-297d-9a072823aa61@codesourcery.com> <877d0dktqv.fsf@euler.schwinge.homeip.net> User-Agent: Notmuch/0.29.3+94~g74c3f1b (https://notmuchmail.org) Emacs/27.1 (x86_64-pc-linux-gnu) Date: Wed, 2 Nov 2022 21:10:54 +0100 Message-ID: <874jvhktgx.fsf@euler.schwinge.homeip.net> MIME-Version: 1.0 X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: SVR-IES-MBX-08.mgc.mentorg.com (139.181.222.8) To svr-ies-mbx-10.mgc.mentorg.com (139.181.222.10) X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP 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: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Hi! On 2022-11-02T21:04:56+0100, I wrote: > On 2017-04-05T08:23:58-0700, Cesar Philippidis wrote: >> This patch implements the OpenACC 2.5 behavior of fortran allocate on >> variables marked with declare create as defined in Section 2.13.2 in the >> OpenACC spec. > > That functionality is still missing in GCC master branch, however a test > case included in that submission here: > >> --- /dev/null >> +++ b/libgomp/testsuite/libgomp.oacc-fortran/declare-allocatable-1.f90 >> @@ -0,0 +1,211 @@ >> +! Test declare create with allocatable arrays. > > ... is useful in a different (though related) context that I'm currently > working on. Having applied the following changes: > > - Replace 'call abort' by 'error stop' (in spirit of earlier PR84381 > changes). > - Replace '[logical] .neqv. .true.' by '.not.[logical]'. > - Add scanning for OpenACC compiler diagnostics. > - 'dg-xfail-run-if' for '-DACC_MEM_SHARED=0' (see above). > > ..., I've then pushed to master branch > commit 8c357d884b16cb3c14cba8a61be5b53fd04a6bfe > "Add 'libgomp.oacc-fortran/declare-allocatable-1.f90'", see attached. > --- /dev/null > +++ b/libgomp/testsuite/libgomp.oacc-fortran/declare-allocatable-1.f90 > @@ -0,0 +1,268 @@ > +! Test OpenACC 'declare create' with allocatable arrays. > + > +! { dg-do run } > + > +!TODO-OpenACC-declare-allocate > +! Not currently implementing correct '-DACC_MEM_SHARED=0' behavior: > +! Missing support for OpenACC "Changes from Version 2.0 to 2.5": > +! "The 'declare create' directive with a Fortran 'allocatable' has new behavior". > +! { dg-xfail-run-if TODO { *-*-* } { -DACC_MEM_SHARED=0 } } > + > +[...] Getting rid of the "'dg-xfail-run-if' for '-DACC_MEM_SHARED=0'" via a work around (as seen in real-world code), I've pushed to master branch commit 59c6c5dbf267cd9d0a8df72b2a5eb5657b64268e "Add 'libgomp.oacc-fortran/declare-allocatable-1-runtime.f90'", see attached. Grüße Thomas ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955 From 59c6c5dbf267cd9d0a8df72b2a5eb5657b64268e Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Fri, 14 Oct 2022 17:36:51 +0200 Subject: [PATCH] Add 'libgomp.oacc-fortran/declare-allocatable-1-runtime.f90' ... which is 'libgomp.oacc-fortran/declare-allocatable-1.f90' adjusted for missing support for OpenACC "Changes from Version 2.0 to 2.5": "The 'declare create' directive with a Fortran 'allocatable' has new behavior". Thus, after 'allocate'/before 'deallocate', call 'acc_create'/'acc_delete' manually. libgomp/ * testsuite/libgomp.oacc-fortran/declare-allocatable-1-runtime.f90: New. --- ...ble-1.f90 => declare-allocatable-1-runtime.f90} | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) copy libgomp/testsuite/libgomp.oacc-fortran/{declare-allocatable-1.f90 => declare-allocatable-1-runtime.f90} (96%) diff --git a/libgomp/testsuite/libgomp.oacc-fortran/declare-allocatable-1.f90 b/libgomp/testsuite/libgomp.oacc-fortran/declare-allocatable-1-runtime.f90 similarity index 96% copy from libgomp/testsuite/libgomp.oacc-fortran/declare-allocatable-1.f90 copy to libgomp/testsuite/libgomp.oacc-fortran/declare-allocatable-1-runtime.f90 index 1c8ccd9f61f..e4cb9c378a3 100644 --- a/libgomp/testsuite/libgomp.oacc-fortran/declare-allocatable-1.f90 +++ b/libgomp/testsuite/libgomp.oacc-fortran/declare-allocatable-1-runtime.f90 @@ -3,10 +3,10 @@ ! { dg-do run } !TODO-OpenACC-declare-allocate -! Not currently implementing correct '-DACC_MEM_SHARED=0' behavior: ! Missing support for OpenACC "Changes from Version 2.0 to 2.5": ! "The 'declare create' directive with a Fortran 'allocatable' has new behavior". -! { dg-xfail-run-if TODO { *-*-* } { -DACC_MEM_SHARED=0 } } +! Thus, after 'allocate'/before 'deallocate', call 'acc_create'/'acc_delete' +! manually. !TODO { dg-additional-options -fno-inline } for stable results regarding OpenACC 'routine'. @@ -67,6 +67,7 @@ program test ! Test local usage of an allocated declared array. allocate (b(n)) + call acc_create (b) if (.not.allocated (b)) error stop if (.not.acc_is_present (b)) error stop @@ -91,12 +92,14 @@ program test if (b(i) /= i*a) error stop end do + call acc_delete (b) deallocate (b) ! Test the usage of an allocated declared array inside an acc ! routine subroutine. allocate (b(n)) + call acc_create (b) if (.not.allocated (b)) error stop if (.not.acc_is_present (b)) error stop @@ -114,6 +117,7 @@ program test if (b(i) /= i*2) error stop end do + call acc_delete (b) deallocate (b) ! Test the usage of an allocated declared array inside a host @@ -129,6 +133,7 @@ program test if (b(i) /= 1.0) error stop end do + call acc_delete (b) deallocate (b) if (allocated (b)) error stop @@ -137,6 +142,7 @@ program test ! routine function. allocate (b(n)) + call acc_create (b) if (.not.allocated (b)) error stop if (.not.acc_is_present (b)) error stop @@ -170,12 +176,14 @@ program test if (b(i) /= i) error stop end do + call acc_delete (b) deallocate (b) ! Test the usage of an allocated declared array inside a host ! function. allocate (b(n)) + call acc_create (b) if (.not.allocated (b)) error stop if (.not.acc_is_present (b)) error stop @@ -202,6 +210,7 @@ program test if (b(i) /= i*i) error stop end do + call acc_delete (b) deallocate (b) end program test ! { dg-line l[incr c] } ! { dg-bogus {note: variable 'overflow\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} {TODO n/a} { xfail *-*-* } l$c } @@ -234,6 +243,7 @@ subroutine sub2 integer i allocate (b(n)) + call acc_create (b) if (.not.allocated (b)) error stop if (.not.acc_is_present (b)) error stop -- 2.35.1