From patchwork Wed Jun 14 09:56:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 107845 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1120089vqr; Wed, 14 Jun 2023 02:57:43 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6pUEQ3hYMuPVUzdtce5U5nxW2uKeXqM6EMDwlbYAH+S0mvXlwMp7tInrsq/4Gbfk3ZDP56 X-Received: by 2002:a17:906:fe46:b0:974:1838:88d8 with SMTP id wz6-20020a170906fe4600b00974183888d8mr13445678ejb.57.1686736663666; Wed, 14 Jun 2023 02:57:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686736663; cv=none; d=google.com; s=arc-20160816; b=yOwSL/xj9K1UsqtKHsWCBNfdhiVxQsWbVU/z+OZod9SZKIG+po1g9gUmdhZ0OwABo6 JJI0BywoGdz63psMOkXbI1lcgtbLTWjGmVQU12MkCWYxQs9FqlM8cxXcazYt/o9rwlS5 9wHobMuhKAVQQMA/cnVPlvDKAWjhzJVFyV/oz5iQrY4iOrbvDXSqng1T/ZmCNnXbi+K6 A9aOTNimju4NilyUqivT9hZePwfYUt2PePVkqcwyUTsN9gSrOS0Rtlfim6CCvvhEklNC NF0zas2tKVud9Pku5i6ChRvRG89rowltbMMOn28lwHi4sez0yDPLbAnd5a4N1yvdu4fb a3sA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mime-version:message-id:date :user-agent:references:in-reply-to:subject:cc:to:from:ironport-sdr :dmarc-filter:delivered-to; bh=6Qv1mYYYzi0GnHPSRfj9abMYx5rvb7oQGIjn+JhsV90=; b=eyy4vr8DJ7op5U+PyBmtgb/VJkeuL1IkXM/l6+r3pC013EKNiUosW3s0nT4hzd2I8h nw10ZRyoqaZ7LbjbSGZiWOKKSUG1zM6NTjYzreSBvbyTY2ryXuy9sqJ763D2uq/hwUPn QHE+zA+pMX/qZ/GuI0jxPIKgMgPciGecnxd4PLvR3qebFafrQr/xPiEkVgz8iivFOZks l5ifsgTYl0vx50NSYpW20jIEHTW9wK+Aau+GwCUehTeQo2Q6JPAK6oVzhRth4p3TucyR EOGIJRFxlK38IfhbtarMxcArAI0HTZ0k1yRFZRx2O9rbRkqnalB3isMy6aMNRXRLsAKB 1KyQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id j4-20020a170906830400b00965a20908edsi7120280ejx.422.2023.06.14.02.57.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Jun 2023 02:57:43 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8564F3857735 for ; Wed, 14 Jun 2023 09:57:30 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa4.mentor.iphmx.com (esa4.mentor.iphmx.com [68.232.137.252]) by sourceware.org (Postfix) with ESMTPS id 807473858D1E; Wed, 14 Jun 2023 09:57:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 807473858D1E 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="6.00,242,1681200000"; d="scan'208,223";a="8774879" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa4.mentor.iphmx.com with ESMTP; 14 Jun 2023 01:57:00 -0800 IronPort-SDR: auao0TBsy1IcZRhpELm3OgIIVL0A4uEznRuqOnrkRomtmj+FA0l3W61jI5KhY/BmuAhdQCSdky LsIQeEXI8Mcl4SEG8gZAY3f0OqwLmFzyY4S0g3K5KuMH1Nga3k+0uc87XAOZ9zIwvtWFnE9sSB fK84aAo9F/+G/W+GLkYDHBCmy9JCCyZmHyusqzPcwYzSeFXBzLmQzUxDnT5pMCGesbhZzuCY+p s1MTqBY3jv3ZqLgbaHCHbzqZis20inycdX/r/qanNk7n8cytFjD112Dv6BPyAPerU31HC7cweh WJU= From: Thomas Schwinge To: Tobias Burnus , CC: Jakub Jelinek , Subject: Add 'libgomp.{,oacc-}fortran/fortran-torture_execute_math.f90' In-Reply-To: References: <87cz2aqezb.fsf@euler.schwinge.homeip.net> <87ttvb7ied.fsf@euler.schwinge.homeip.net> User-Agent: Notmuch/0.29.3+94~g74c3f1b (https://notmuchmail.org) Emacs/28.2 (x86_64-pc-linux-gnu) Date: Wed, 14 Jun 2023 11:56:51 +0200 Message-ID: <87y1kmv02k.fsf@euler.schwinge.homeip.net> MIME-Version: 1.0 X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-14.mgc.mentorg.com (139.181.222.14) To svr-ies-mbx-10.mgc.mentorg.com (139.181.222.10) X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, 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: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767865143030087431?= X-GMAIL-MSGID: =?utf-8?q?1768671584081610236?= Hi! On 2023-06-13T13:11:38+0200, Tobias Burnus wrote: > On 13.06.23 12:42, Thomas Schwinge wrote: >> On 2023-06-05T14:18:48+0200, I wrote: >>> OK to push the attached >>> "Add 'libgomp.{,oacc-}fortran/fortran-torture_execute_math.f90'"? >> >> Subject: [PATCH] Add >> 'libgomp.{,oacc-}fortran/fortran-torture_execute_math.f90' >> >> gcc/testsuite/ >> * gfortran.fortran-torture/execute/math.f90: Enhance for optional >> OpenACC, OpenMP 'target' usage. > > I think it is more readable with a linebreak here and with "OpenACC > 'serial' and OpenMP ..." instead of "OpenACC, OpenMP". > > What I would like to see a hint somewhere in the commit log that the > libgomp files include the gfortran.fortran-torture file. I don't care > whether you add the hint before the changelog items as free text – or in > the bullet above (e.g. "as it is included in libgomp/testsuite") – or > after "New." in the following bullet list. > >> libgomp/ >> * testsuite/libgomp.fortran/fortran-torture_execute_math.f90: New. >> * testsuite/libgomp.oacc-fortran/fortran-torture_execute_math.f90: >> Likewise. > >> --- >> .../gfortran.fortran-torture/execute/math.f90 | 23 +++++++++++++++++-- >> .../fortran-torture_execute_math.f90 | 4 ++++ >> .../fortran-torture_execute_math.f90 | 5 ++++ >> 3 files changed, 30 insertions(+), 2 deletions(-) >> create mode 100644 libgomp/testsuite/libgomp.fortran/fortran-torture_execute_math.f90 >> create mode 100644 libgomp/testsuite/libgomp.oacc-fortran/fortran-torture_execute_math.f90 >> >> diff --git a/gcc/testsuite/gfortran.fortran-torture/execute/math.f90 b/gcc/testsuite/gfortran.fortran-torture/execute/math.f90 >> index 17cc78f7a10..e71f669304f 100644 >> --- a/gcc/testsuite/gfortran.fortran-torture/execute/math.f90 >> +++ b/gcc/testsuite/gfortran.fortran-torture/execute/math.f90 >> @@ -1,9 +1,14 @@ >> ! Program to test mathematical intrinsics >> + >> +! See also 'libgomp/testsuite/libgomp.fortran/fortran-torture_execute_math.f90'; thus the '!$omp' directives. >> +! See also 'libgomp/testsuite/libgomp.oacc-fortran/fortran-torture_execute_math.f90'; thus the '!$acc' directives. > > Likewise here: it is not completely obvious that this file is 'include'd > by the other testcases. > > Maybe add a line "! This file is also included in:" and remove the "See > also" or some creative variant of it. > > Minor remark: The OpenMP part is OK, but strict reading of the spec > requires an "omp declare target' if a subroutine is in a different > compilation unit. And according the glossary, that's the case here. In > practice, it also works without as it is in the same translation unit. > (compilation unit = for C/C++: translation unit, for Fortran: > subprogram). I think the HPE/Cray compiler will complain, but maybe only > when used with modules and not with subroutine subprograms. (As many > compilers write a .mod file for modules, a late change of attributes can > be more problematic.) > > Otherwise LGTM. Thanks for the review. I've now pushed commit e76af2162c7b768ef0a913d485c51a80b08a1020 "Add 'libgomp.{,oacc-}fortran/fortran-torture_execute_math.f90'", see attached. > PS: I assume that you have check it with both with an in-build-tree and > an in-install-tree testsuite run. I happened to have (..., but don't think it'd make a relevant difference here?) 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 e76af2162c7b768ef0a913d485c51a80b08a1020 Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Fri, 2 Jun 2023 23:11:00 +0200 Subject: [PATCH] Add 'libgomp.{,oacc-}fortran/fortran-torture_execute_math.f90' ..., via 'include'ing the existing 'gfortran.fortran-torture/execute/math.f90', which therefore is enhanced for optional OpenACC 'serial', OpenMP 'target' usage. gcc/testsuite/ * gfortran.fortran-torture/execute/math.f90: Enhance for optional OpenACC 'serial', OpenMP 'target' usage. libgomp/ * testsuite/libgomp.fortran/fortran-torture_execute_math.f90: New. * testsuite/libgomp.oacc-fortran/fortran-torture_execute_math.f90: Likewise. --- .../gfortran.fortran-torture/execute/math.f90 | 24 +++++++++++++++++-- .../fortran-torture_execute_math.f90 | 4 ++++ .../fortran-torture_execute_math.f90 | 5 ++++ 3 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 libgomp/testsuite/libgomp.fortran/fortran-torture_execute_math.f90 create mode 100644 libgomp/testsuite/libgomp.oacc-fortran/fortran-torture_execute_math.f90 diff --git a/gcc/testsuite/gfortran.fortran-torture/execute/math.f90 b/gcc/testsuite/gfortran.fortran-torture/execute/math.f90 index 17cc78f7a105..6c97eba3f8ff 100644 --- a/gcc/testsuite/gfortran.fortran-torture/execute/math.f90 +++ b/gcc/testsuite/gfortran.fortran-torture/execute/math.f90 @@ -1,9 +1,15 @@ ! Program to test mathematical intrinsics + +! This file is also 'include'd in: +! - 'libgomp/testsuite/libgomp.fortran/fortran-torture_execute_math.f90' (thus the '!$omp' directives) +! - 'libgomp/testsuite/libgomp.oacc-fortran/fortran-torture_execute_math.f90' (thus the '!$acc' directives) + subroutine dotest (n, val4, val8, known) implicit none real(kind=4) val4, known real(kind=8) val8 integer n + !$acc routine seq if (abs (val4 - known) .gt. 0.001) STOP 1 if (abs (real (val8, kind=4) - known) .gt. 0.001) STOP 2 @@ -14,17 +20,20 @@ subroutine dotestc (n, val4, val8, known) complex(kind=4) val4, known complex(kind=8) val8 integer n + !$acc routine seq + if (abs (val4 - known) .gt. 0.001) STOP 3 if (abs (cmplx (val8, kind=4) - known) .gt. 0.001) STOP 4 end subroutine -program testmath +subroutine testmath implicit none real(kind=4) r, two4, half4 real(kind=8) q, two8, half8 complex(kind=4) cr complex(kind=8) cq external dotest, dotestc + !$acc routine seq two4 = 2.0 two8 = 2.0_8 @@ -96,5 +105,16 @@ program testmath cq = log ((-1.0_8, -1.0_8)) call dotestc (21, cr, cq, (0.3466, -2.3562)) -end program +end subroutine +program main + implicit none + external testmath + + !$acc serial + !$omp target + call testmath + !$acc end serial + !$omp end target + +end program diff --git a/libgomp/testsuite/libgomp.fortran/fortran-torture_execute_math.f90 b/libgomp/testsuite/libgomp.fortran/fortran-torture_execute_math.f90 new file mode 100644 index 000000000000..3348a0bb3adc --- /dev/null +++ b/libgomp/testsuite/libgomp.fortran/fortran-torture_execute_math.f90 @@ -0,0 +1,4 @@ +! { dg-do run } +! { dg-additional-options -foffload-options=-lm } + +include '../../../gcc/testsuite/gfortran.fortran-torture/execute/math.f90' diff --git a/libgomp/testsuite/libgomp.oacc-fortran/fortran-torture_execute_math.f90 b/libgomp/testsuite/libgomp.oacc-fortran/fortran-torture_execute_math.f90 new file mode 100644 index 000000000000..1b2ac4407623 --- /dev/null +++ b/libgomp/testsuite/libgomp.oacc-fortran/fortran-torture_execute_math.f90 @@ -0,0 +1,5 @@ +! { dg-do run } +!TODO { dg-prune-output {using 'vector_length \(32\)', ignoring 1} } +! { dg-additional-options -foffload-options=-lm } + +include '../../../gcc/testsuite/gfortran.fortran-torture/execute/math.f90' -- 2.39.2