From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa1.mentor.iphmx.com (esa1.mentor.iphmx.com [68.232.129.153]) by sourceware.org (Postfix) with ESMTPS id C12A53858D20; Fri, 4 Feb 2022 09:37:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C12A53858D20 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com IronPort-SDR: do2vaFtU9P7Id/XEb22qc2c6kNh3byi2FcL05R5eAJaR0raK3S5owjlmIc2DF0c7joUjbjlg+D VaAYMb7kP9JbmO+8Zt+OMxFj9uc2OLgeuM1qRbNfcoWkJ9eC/huYt9X4nocQ+1wN6xZ4Inj8mC KCF5rAWWJJUHPJFx9rHNyXQHxwyx8Jfp9uC5OeYW7BYF7ObSczj6OiyvUE5WSz6BQv3lRhlTSv xhONPhh/gS2x65hEpYYzzyQR2QmMzLyDvFU6LaInXGRfsLVW4j+XGLF/rtSquOk6GXlf5vGO74 bzSTdy0D6O+u5sU8Jmrwi7zk X-IronPort-AV: E=Sophos;i="5.88,342,1635235200"; d="scan'208";a="74135885" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa1.mentor.iphmx.com with ESMTP; 04 Feb 2022 01:37:24 -0800 IronPort-SDR: ivX+ej8zFwUx+UEFecX1buwz4Kvr8mjPCbf9C5TLiMFMVgQAj4BnPnQE9y3TbWd3KvMBJMbi6o 8Z47/hxpvP3nGX15Xrelfjlg4yq2BznbEK7CLDAxaPJSxdtQqcnD63T2DHqN0xnhOzUOk+JiJ+ IiGEBiQsJow5k7z3gUZ0uW5sY0aCGrSUd5wtzvswyMsT6gQ0O1ONyzgwIaY297VEIF4aGVCTR+ Xow7quHdxC00JyYY7NGPzaU9O1ZpEfdOSrStAHGowfWIgN06gBac2lVdC60TRVdjMbnMoy85Ss vIQ= From: Thomas Schwinge To: Tobias Burnus CC: Hafiz Abid Qadeer , Jakub Jelinek , , Subject: Re: [PATCH] [gfortran] Add support for allocate clause (OpenMP 5.0). In-Reply-To: References: <20211022130502.2211568-1-abidh@codesourcery.com> <20211102162714.GF304296@tucnak> <20211220200650.GN2646553@tucnak> <8735lh6mcx.fsf@euler.schwinge.homeip.net> <48d8c123-fa4f-d4a3-17de-b082de32f0bf@codesourcery.com> User-Agent: Notmuch/0.29.3+94~g74c3f1b (https://notmuchmail.org) Emacs/27.1 (x86_64-pc-linux-gnu) Date: Fri, 4 Feb 2022 10:37:17 +0100 Message-ID: <87mtj7rn02.fsf@euler.schwinge.homeip.net> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-15.mgc.mentorg.com (139.181.222.15) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00, BODY_8BITS, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: fortran@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Fortran mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Feb 2022 09:37:28 -0000 Hi Tobias! On 2022-01-24T09:45:48+0100, Tobias Burnus wrote: > On 21.01.22 18:43, Tobias Burnus wrote: >> On 21.01.22 18:15, Thomas Schwinge wrote: >>> 11 |=C2=A0=C2=A0=C2=A0=C2=A0 integer(c_int) function is_64bit_a= ligned (a) bind(C) >>> Warning: Variable =E2=80=98a=E2=80=99 at (1) is a dummy argument o= f the BIND(C) >>> procedure =E2=80=98is_64bit_aligned=E2=80=99 but may not be C interoper= able >>> [-Wc-binding-type] >>> >>> Is that something to worry about? > I have attached a patch (not commited), which silences the three kind of > warnings and fixes the interface issue. > TODO: commit it. Still "TODO: commit it" ;-) -- and while I haven't reviewed the changes in detail, I did spot one item that should be addressed, I suppose: > --- a/libgomp/testsuite/libgomp.fortran/allocate-1.c > +++ b/libgomp/testsuite/libgomp.fortran/allocate-1.c > @@ -1,7 +1,7 @@ > #include > > int > -is_64bit_aligned_ (uintptr_t a) > +is_64bit_aligned (uintptr_t a) > { > return ( (a & 0x3f) =3D=3D 0); > } > --- a/libgomp/testsuite/libgomp.fortran/allocate-1.f90 > +++ b/libgomp/testsuite/libgomp.fortran/allocate-1.f90 > @@ -5,30 +5,30 @@ > module m > use omp_lib > use iso_c_binding > - implicit none > + implicit none (type, external) > > interface > integer(c_int) function is_64bit_aligned (a) bind(C) > import :: c_int > - integer :: a > + type(*) :: a > end > end interface > -end module m > > -subroutine foo (x, p, q, px, h, fl) > +contains > + > +subroutine foo (x, p, q, h, fl) > use omp_lib > use iso_c_binding > integer :: x > integer, dimension(4) :: p > integer, dimension(4) :: q > - integer :: px > integer (kind=3Domp_allocator_handle_kind) :: h > integer :: fl > > integer :: y > integer :: r, i, i1, i2, i3, i4, i5 > integer :: l, l3, l4, l5, l6 > - integer :: n, n1, n2, n3, n4 > + integer :: n, n2, n3, n4 > integer :: j2, j3, j4 > integer, dimension(4) :: l2 > integer, dimension(4) :: r2 > @@ -118,6 +118,7 @@ subroutine foo (x, p, q, px, h, fl) > end if > !$omp end parallel > !$omp end teams > +stop > > !$omp parallel do private (y) firstprivate (x) reduction(+: r) alloca= te (h: x, y, r, l, n) lastprivate (l) linear (n: 16) > do i =3D 0, 63 That early 'stop' should probably be backed out? ;-) Gr=C3=BC=C3=9Fe Thomas > @@ -153,77 +154,77 @@ subroutine foo (x, p, q, px, h, fl) > ((is_64bit_aligned(l2(1)) =3D=3D 0) .or. & > (is_64bit_aligned(l3) =3D=3D 0) .or. & > (is_64bit_aligned(i1) =3D=3D 0))) then > - stop 10 > + stop 10 > end if > end do > > !$omp do collapse(2) lastprivate(l4, i2, j2) linear (n2:17) allocate= (h: n2, l4, i2, j2) > do i2 =3D 3, 4 > do j2 =3D 17, 22, 2 > - n2 =3D n2 + 17 > - l4 =3D i2 * 31 + j2 > - if ( (and(fl, 1) /=3D 0) .and. & > - ((is_64bit_aligned(l4) =3D=3D 0) .or. & > - (is_64bit_aligned(n2) =3D=3D 0) .or. & > - (is_64bit_aligned(i2) =3D=3D 0) .or. & > - (is_64bit_aligned(j2) =3D=3D 0))) then > - stop 11 > - end if > + n2 =3D n2 + 17 > + l4 =3D i2 * 31 + j2 > + if ( (and(fl, 1) /=3D 0) .and. & > + ((is_64bit_aligned(l4) =3D=3D 0) .or. & > + (is_64bit_aligned(n2) =3D=3D 0) .or. & > + (is_64bit_aligned(i2) =3D=3D 0) .or. & > + (is_64bit_aligned(j2) =3D=3D 0))) then > + stop 11 > + end if > end do > end do > > !$omp do collapse(2) lastprivate(l5, i3, j3) linear (n3:17) schedule= (static, 3) allocate (n3, l5, i3, j3) > do i3 =3D 3, 4 > do j3 =3D 17, 22, 2 > - n3 =3D n3 + 17 > - l5 =3D i3 * 31 + j3 > - if ( (and(fl, 2) /=3D 0) .and. & > - ((is_64bit_aligned(l5) =3D=3D 0) .or. & > - (is_64bit_aligned(n3) =3D=3D 0) .or. & > - (is_64bit_aligned(i3) =3D=3D 0) .or. & > - (is_64bit_aligned(j3) =3D=3D 0))) then > - stop 12 > - end if > + n3 =3D n3 + 17 > + l5 =3D i3 * 31 + j3 > + if ( (and(fl, 2) /=3D 0) .and. & > + ((is_64bit_aligned(l5) =3D=3D 0) .or. & > + (is_64bit_aligned(n3) =3D=3D 0) .or. & > + (is_64bit_aligned(i3) =3D=3D 0) .or. & > + (is_64bit_aligned(j3) =3D=3D 0))) then > + stop 12 > + end if > end do > end do > > !$omp do collapse(2) lastprivate(l6, i4, j4) linear (n4:17) schedule= (dynamic) allocate (h: n4, l6, i4, j4) > do i4 =3D 3, 4 > do j4 =3D 17, 22,2 > - n4 =3D n4 + 17; > - l6 =3D i4 * 31 + j4; > - if ( (and(fl, 1) /=3D 0) .and. & > - ((is_64bit_aligned(l6) =3D=3D 0) .or. & > - (is_64bit_aligned(n4) =3D=3D 0) .or. & > - (is_64bit_aligned(i4) =3D=3D 0) .or. & > - (is_64bit_aligned(j4) =3D=3D 0))) then > - stop 13 > - end if > + n4 =3D n4 + 17; > + l6 =3D i4 * 31 + j4; > + if ( (and(fl, 1) /=3D 0) .and. & > + ((is_64bit_aligned(l6) =3D=3D 0) .or. & > + (is_64bit_aligned(n4) =3D=3D 0) .or. & > + (is_64bit_aligned(i4) =3D=3D 0) .or. & > + (is_64bit_aligned(j4) =3D=3D 0))) then > + stop 13 > + end if > end do > end do > > !$omp do lastprivate (i5) allocate (i5) > do i5 =3D 1, 17, 3 > if ( (and(fl, 2) /=3D 0) .and. & > - (is_64bit_aligned(i5) =3D=3D 0)) then > - stop 14 > + (is_64bit_aligned(i5) =3D=3D 0)) then > + stop 14 > end if > end do > > !$omp do reduction(+:p, q, r2) allocate(h: p, q, r2) > do i =3D 0, 31 > - p(3) =3D p(3) + i; > - p(4) =3D p(4) + (2 * i) > - q(1) =3D q(1) + (3 * i) > - q(3) =3D q(3) + (4 * i) > - r2(1) =3D r2(1) + (5 * i) > - r2(4) =3D r2(4) + (6 * i) > - if ( (and(fl, 1) /=3D 0) .and. & > - ((is_64bit_aligned(q(1)) =3D=3D 0) .or. & > - (is_64bit_aligned(p(1)) =3D=3D 0) .or. & > - (is_64bit_aligned(r2(1)) =3D=3D 0) )) then > - stop 15 > - end if > + p(3) =3D p(3) + i; > + p(4) =3D p(4) + (2 * i) > + q(1) =3D q(1) + (3 * i) > + q(3) =3D q(3) + (4 * i) > + r2(1) =3D r2(1) + (5 * i) > + r2(4) =3D r2(4) + (6 * i) > + if ( (and(fl, 1) /=3D 0) .and. & > + ((is_64bit_aligned(q(1)) =3D=3D 0) .or. & > + (is_64bit_aligned(p(1)) =3D=3D 0) .or. & > + (is_64bit_aligned(r2(1)) =3D=3D 0) )) then > + stop 15 > + end if > end do > > !$omp task private(y) firstprivate(x) allocate(x, y) > @@ -305,11 +306,13 @@ subroutine foo (x, p, q, px, h, fl) > .or. r2(1) /=3D (5 * p(3)) .or. r2(4) /=3D (6 * p(3))) then > stop 25 > end if > - > end subroutine > +end module m > > program main > use omp_lib > + use m > + implicit none (type, external) > integer, dimension(4) :: p > integer, dimension(4) :: q > > @@ -323,11 +326,11 @@ program main > if (a =3D=3D omp_null_allocator) stop 1 > > call omp_set_default_allocator (omp_default_mem_alloc); > - call foo (42, p, q, 2, a, 0); > - call foo (42, p, q, 2, omp_default_mem_alloc, 0); > - call foo (42, p, q, 2, a, 1); > + call foo (42, p, q, a, 0); > + call foo (42, p, q, omp_default_mem_alloc, 0); > + call foo (42, p, q, a, 1); > call omp_set_default_allocator (a); > - call foo (42, p, q, 2, omp_null_allocator, 3); > - call foo (42, p, q, 2, omp_default_mem_alloc, 2); > + call foo (42, p, q, omp_null_allocator, 3); > + call foo (42, p, q, omp_default_mem_alloc, 2); > call omp_destroy_allocator (a); > end ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstra=C3=9Fe 201= , 80634 M=C3=BCnchen; Gesellschaft mit beschr=C3=A4nkter Haftung; Gesch=C3= =A4ftsf=C3=BChrer: Thomas Heurung, Frank Th=C3=BCrauf; Sitz der Gesellschaf= t: M=C3=BCnchen; Registergericht M=C3=BCnchen, HRB 106955