From patchwork Wed Feb 15 19:02:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 65058 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 9C92B3858031 for ; Wed, 15 Feb 2023 19:03:31 +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 496263858D28 for ; Wed, 15 Feb 2023 19:02:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 496263858D28 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.97,300,1669104000"; d="scan'208,223";a="96852829" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa3.mentor.iphmx.com with ESMTP; 15 Feb 2023 11:02:56 -0800 IronPort-SDR: W+Fi8NkBxrrGMfyQVn+rLd/lhKs1qkZZR+CJ/BndL6FdqqNJk+EbCKuToYHlwWYq+I9CizAuH7 4UCsoVXU9qjnO/SRH4KuHrJ4ls0aWRcFX8mn5af9tA8sc/W50mPmdJHriGEnE3Xb7DQuSOeczR Pqtqk3iVJ2kVKi9J00oCB1XQ5V2NFuiqQtdkqSqRChf9Ed/AY9L3xiTGRTN+B8cigH7V+R12OJ az9NN3ayBkWBn9ytmmlCffXe5CeAsr4ayzswj6oL5tbPGNH9A4bDEHRsb1wRViVuEtPn4UIPjh maE= From: Thomas Schwinge To: Kwok Cheung Yeung , Subject: [og12] Fix 'libgomp.{c-c++-common,fortran}/target-present-*' test cases (was: [OG12][committed] openmp: Add support for the 'present' modifier) In-Reply-To: <049a4654-2596-1913-20fc-1aeea48eb3ec@codesourcery.com> References: <049a4654-2596-1913-20fc-1aeea48eb3ec@codesourcery.com> User-Agent: Notmuch/0.29.3+94~g74c3f1b (https://notmuchmail.org) Emacs/28.2 (x86_64-pc-linux-gnu) Date: Wed, 15 Feb 2023 20:02:45 +0100 Message-ID: <87bkluzr8q.fsf@euler.schwinge.homeip.net> MIME-Version: 1.0 X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-11.mgc.mentorg.com (139.181.222.11) 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 2023-02-09T21:17:44+0000, Kwok Cheung Yeung wrote: > I've ported my patch for supporting the OpenMP 5.1 'present' modifier > and committed it to the devel/omp/gcc-12 development branch: > > 229b705862c openmp: Add support for the 'present' modifier > > Tested with offloading on amdgcn and nvptx. I've pushed to devel/omp/gcc-12 branch commit bbda035ee62ba4db21356136c97e9d83a97ba7d1 "Fix 'libgomp.{c-c++-common,fortran}/target-present-*' test cases", see attached. Note that this likewise applies to the current upstream submission: "openmp: Add support for 'present' modifier". 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 bbda035ee62ba4db21356136c97e9d83a97ba7d1 Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Wed, 15 Feb 2023 12:39:19 +0100 Subject: [PATCH] Fix 'libgomp.{c-c++-common,fortran}/target-present-*' test cases Their execution isn't expected to error out if we've been *compiling for any offload target*, but rather if they're *executing on a non-shared memory offload device*. For example, if (any) offloading is configured but not effective (no device available, for example), you'd get: PASS: libgomp.c/../libgomp.c-c++-common/target-present-1.c (test for excess errors) FAIL: libgomp.c/../libgomp.c-c++-common/target-present-1.c execution test PASS: libgomp.c/../libgomp.c-c++-common/target-present-2.c (test for excess errors) FAIL: libgomp.c/../libgomp.c-c++-common/target-present-2.c execution test PASS: libgomp.c/../libgomp.c-c++-common/target-present-3.c (test for excess errors) FAIL: libgomp.c/../libgomp.c-c++-common/target-present-3.c execution test PASS: libgomp.c++/../libgomp.c-c++-common/target-present-1.c (test for excess errors) FAIL: libgomp.c++/../libgomp.c-c++-common/target-present-1.c execution test PASS: libgomp.c++/../libgomp.c-c++-common/target-present-2.c (test for excess errors) FAIL: libgomp.c++/../libgomp.c-c++-common/target-present-2.c execution test PASS: libgomp.c++/../libgomp.c-c++-common/target-present-3.c (test for excess errors) FAIL: libgomp.c++/../libgomp.c-c++-common/target-present-3.c execution test PASS: libgomp.fortran/target-present-1.f90 -O0 (test for excess errors) FAIL: libgomp.fortran/target-present-1.f90 -O0 execution test [...] PASS: libgomp.fortran/target-present-2.f90 -O0 (test for excess errors) FAIL: libgomp.fortran/target-present-2.f90 -O0 execution test [...] PASS: libgomp.fortran/target-present-3.f90 -O0 (test for excess errors) FAIL: libgomp.fortran/target-present-3.f90 -O0 execution test [...] Also, verify reaching a checkpoint before the expected error condition -- and fix up one case where that didn't happen; missing OpenMP 'map' clauses ('libgomp.fortran/target-present-2.f90'). Fix-up for recent og12 commit 229b705862c1d7f9634f72272b77c22970baf821 "openmp: Add support for the 'present' modifier" libgomp/ * testsuite/libgomp.c-c++-common/target-present-1.c: Fix. * testsuite/libgomp.c-c++-common/target-present-2.c: Likewise. * testsuite/libgomp.c-c++-common/target-present-3.c: Likewise. * testsuite/libgomp.fortran/target-present-1.f90: Likewise. * testsuite/libgomp.fortran/target-present-2.f90: Likewise. * testsuite/libgomp.fortran/target-present-3.f90: Likewise. --- libgomp/ChangeLog.omp | 9 +++++++++ .../libgomp.c-c++-common/target-present-1.c | 9 ++++++--- .../libgomp.c-c++-common/target-present-2.c | 11 +++++++---- .../libgomp.c-c++-common/target-present-3.c | 9 +++++---- .../testsuite/libgomp.fortran/target-present-1.f90 | 9 ++++++--- .../testsuite/libgomp.fortran/target-present-2.f90 | 13 ++++++++----- .../testsuite/libgomp.fortran/target-present-3.f90 | 9 ++++++--- 7 files changed, 47 insertions(+), 22 deletions(-) diff --git a/libgomp/ChangeLog.omp b/libgomp/ChangeLog.omp index b638cdbb41e..5257ee00e0c 100644 --- a/libgomp/ChangeLog.omp +++ b/libgomp/ChangeLog.omp @@ -1,3 +1,12 @@ +2023-02-15 Thomas Schwinge + + * testsuite/libgomp.c-c++-common/target-present-1.c: Fix. + * testsuite/libgomp.c-c++-common/target-present-2.c: Likewise. + * testsuite/libgomp.c-c++-common/target-present-3.c: Likewise. + * testsuite/libgomp.fortran/target-present-1.f90: Likewise. + * testsuite/libgomp.fortran/target-present-2.f90: Likewise. + * testsuite/libgomp.fortran/target-present-3.f90: Likewise. + 2023-02-15 Tobias Burnus Backported from master: diff --git a/libgomp/testsuite/libgomp.c-c++-common/target-present-1.c b/libgomp/testsuite/libgomp.c-c++-common/target-present-1.c index bbc4559b12e..55aecd1c8d1 100644 --- a/libgomp/testsuite/libgomp.c-c++-common/target-present-1.c +++ b/libgomp/testsuite/libgomp.c-c++-common/target-present-1.c @@ -1,5 +1,4 @@ -/* { dg-do run { target offload_target_any } } */ -/* { dg-shouldfail "present error triggered" } */ +#include #define N 100 @@ -18,8 +17,12 @@ int main (void) for (int i = 0; i < N; i++) c[i] = a[i]; + fprintf (stderr, "CheCKpOInT\n"); + /* { dg-output "CheCKpOInT(\n|\r\n|\r).*" } */ + /* b has not been allocated, so this should result in an error. */ - /* { dg-output "libgomp: present clause: !omp_target_is_present \\\(0x\[0-9a-f\]+, \[0-9\]+\\\)" } */ + /* { dg-output "libgomp: present clause: !omp_target_is_present \\\(0x\[0-9a-f\]+, \[0-9\]+\\\)" { target offload_device_nonshared_as } } + { dg-shouldfail "present error triggered" { offload_device_nonshared_as } } */ #pragma omp target map (present, to: b) for (int i = 0; i < N; i++) c[i] += b[i]; diff --git a/libgomp/testsuite/libgomp.c-c++-common/target-present-2.c b/libgomp/testsuite/libgomp.c-c++-common/target-present-2.c index 6259c959c04..1ce919e62ce 100644 --- a/libgomp/testsuite/libgomp.c-c++-common/target-present-2.c +++ b/libgomp/testsuite/libgomp.c-c++-common/target-present-2.c @@ -1,5 +1,4 @@ -/* { dg-do run { target offload_target_any } } */ -/* { dg-shouldfail "present error triggered" } */ +#include #define N 100 @@ -13,13 +12,17 @@ int main (void) } #pragma omp target enter data map (alloc: a, c) - /* a has already been allocated, so this should be okay. */ + /* a, c have already been allocated, so this should be okay. */ #pragma omp target defaultmap (present) for (int i = 0; i < N; i++) c[i] = a[i]; + fprintf (stderr, "CheCKpOInT\n"); + /* { dg-output "CheCKpOInT(\n|\r\n|\r).*" } */ + /* b has not been allocated, so this should result in an error. */ - /* { dg-output "libgomp: present clause: !omp_target_is_present \\\(0x\[0-9a-f\]+, \[0-9\]+\\\)" } */ + /* { dg-output "libgomp: present clause: !omp_target_is_present \\\(0x\[0-9a-f\]+, \[0-9\]+\\\)" { target offload_device_nonshared_as } } + { dg-shouldfail "present error triggered" { offload_device_nonshared_as } } */ #pragma omp target defaultmap (present) for (int i = 0; i < N; i++) c[i] += b[i]; diff --git a/libgomp/testsuite/libgomp.c-c++-common/target-present-3.c b/libgomp/testsuite/libgomp.c-c++-common/target-present-3.c index 89e648645b2..886969c4c4a 100644 --- a/libgomp/testsuite/libgomp.c-c++-common/target-present-3.c +++ b/libgomp/testsuite/libgomp.c-c++-common/target-present-3.c @@ -1,6 +1,3 @@ -/* { dg-do run { target offload_target_any } } */ -/* { dg-shouldfail "present error triggered" } */ - #include #define N 100 @@ -19,8 +16,12 @@ int main (void) /* This should work as a has already been allocated. */ #pragma omp target update to (present: a) + fprintf (stderr, "CheCKpOInT\n"); + /* { dg-output "CheCKpOInT(\n|\r\n|\r).*" } */ + /* This should fail as b has not been allocated. */ - /* { dg-output "libgomp: present clause: !omp_target_is_present \\\(0x\[0-9a-f\]+, \[0-9\]+\\\)" } */ + /* { dg-output "libgomp: present clause: !omp_target_is_present \\\(0x\[0-9a-f\]+, \[0-9\]+\\\)" { target offload_device_nonshared_as } } + { dg-shouldfail "present error triggered" { offload_device_nonshared_as } } */ #pragma omp target update to (present: b) #pragma omp target exit data map (from: c) diff --git a/libgomp/testsuite/libgomp.fortran/target-present-1.f90 b/libgomp/testsuite/libgomp.fortran/target-present-1.f90 index 80046011b25..c56b76e0233 100644 --- a/libgomp/testsuite/libgomp.fortran/target-present-1.f90 +++ b/libgomp/testsuite/libgomp.fortran/target-present-1.f90 @@ -1,5 +1,4 @@ -! { dg-do run { target offload_target_any } } -! { dg-shouldfail "present error triggered" } +! { dg-do run } program main implicit none @@ -19,8 +18,12 @@ program main end do !$omp end target + print *, "CheCKpOInT" + ! { dg-output "CheCKpOInT(\n|\r\n|\r).*" } + ! b has not been allocated, so this should result in an error. - ! { dg-output "libgomp: present clause: !omp_target_is_present \\\(0x\[0-9a-f\]+, \[0-9\]+\\\)" } + ! { dg-output "libgomp: present clause: !omp_target_is_present \\\(0x\[0-9a-f\]+, \[0-9\]+\\\)" { target offload_device_nonshared_as } } + ! { dg-shouldfail "present error triggered" { offload_device_nonshared_as } } !$omp target map (present, to: b) do i = 1, N c(i) = c(i) + b(i) diff --git a/libgomp/testsuite/libgomp.fortran/target-present-2.f90 b/libgomp/testsuite/libgomp.fortran/target-present-2.f90 index 0a38dea1e41..f62e0c22468 100644 --- a/libgomp/testsuite/libgomp.fortran/target-present-2.f90 +++ b/libgomp/testsuite/libgomp.fortran/target-present-2.f90 @@ -1,5 +1,4 @@ -! { dg-do run { target offload_target_any } } -! { dg-shouldfail "present error triggered" } +! { dg-do run } program main implicit none @@ -11,16 +10,20 @@ program main b(i) = i * 3 + 1 end do - !$omp target enter data map (alloc: a) - ! a has already been allocated, so this should be okay. + !$omp target enter data map (alloc: a, c, i) + ! a, c, i have already been allocated, so this should be okay. !$omp target defaultmap (present) do i = 1, N c(i) = a(i) end do !$omp end target + print *, "CheCKpOInT" + ! { dg-output "CheCKpOInT(\n|\r\n|\r).*" } + ! b has not been allocated, so this should result in an error. - ! { dg-output "libgomp: present clause: !omp_target_is_present \\\(0x\[0-9a-f\]+, \[0-9\]+\\\)" } + ! { dg-output "libgomp: present clause: !omp_target_is_present \\\(0x\[0-9a-f\]+, \[0-9\]+\\\)" { target offload_device_nonshared_as } } + ! { dg-shouldfail "present error triggered" { offload_device_nonshared_as } } !$omp target defaultmap (present) do i = 1, N c(i) = c(i) + b(i) diff --git a/libgomp/testsuite/libgomp.fortran/target-present-3.f90 b/libgomp/testsuite/libgomp.fortran/target-present-3.f90 index c4deb8652d1..b186c1c5462 100644 --- a/libgomp/testsuite/libgomp.fortran/target-present-3.f90 +++ b/libgomp/testsuite/libgomp.fortran/target-present-3.f90 @@ -1,5 +1,4 @@ -! { dg-do run { target offload_target_any } } -! { dg-shouldfail "present error triggered" } +! { dg-do run } program main implicit none @@ -15,8 +14,12 @@ program main ! This should work as a has already been allocated. !$omp target update to (present: a) + print *, "CheCKpOInT" + ! { dg-output "CheCKpOInT(\n|\r\n|\r).*" } + ! This should fail as b has not been allocated. - ! { dg-output "libgomp: present clause: !omp_target_is_present \\\(0x\[0-9a-f\]+, \[0-9\]+\\\)" } + ! { dg-output "libgomp: present clause: !omp_target_is_present \\\(0x\[0-9a-f\]+, \[0-9\]+\\\)" { target offload_device_nonshared_as } } + ! { dg-shouldfail "present error triggered" { offload_device_nonshared_as } } !$omp target update to (present: b) !$omp target exit data map (from: c) end program -- 2.25.1