public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Tobias Burnus <burnus@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-1605] testsuite/libgomp.*/target-present-*.{c, f90}: Improve and fix Date: Wed, 7 Jun 2023 11:23:49 +0000 (GMT) [thread overview] Message-ID: <20230607112349.D7F0E3858C54@sourceware.org> (raw) https://gcc.gnu.org/g:dd958667821e38b7d6b8efe448044901b4762b3a commit r14-1605-gdd958667821e38b7d6b8efe448044901b4762b3a Author: Tobias Burnus <tobias@codesourcery.com> Date: Wed Jun 7 13:22:13 2023 +0200 testsuite/libgomp.*/target-present-*.{c,f90}: Improve and fix One of the testcases lacked variables in a map clause such that the fail occurred too early. Additionally, it would have failed for all those non-host devices where 'present' is always true, i.e. non-host devices which can access all of the host memory (shared-memory devices). [There are currently none.] The commit now runs the code on all devices, which should succeed for host fallback and for shared-memory devices, finding potenial issues that way. Additionally, a checkpoint (required stdout output) is used to ensure that the execution won't fail (with the same error) before reaching the expected fail location. 2023-06-07 Thomas Schwinge <thomas@codesourcery.com> Tobias Burnus <tobias@codesourcery.com> libgomp/ * testsuite/libgomp.c-c++-common/target-present-1.c: Run code also for non-offload_device targets; check that it runs successfully for those and for all until a checkpoint for all * 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-3.f90: Likewise. * testsuite/libgomp.fortran/target-present-2.f90: Likewise; add missing vars to map clause. Diff: --- libgomp/testsuite/libgomp.c-c++-common/target-present-1.c | 9 ++++++--- libgomp/testsuite/libgomp.c-c++-common/target-present-2.c | 11 +++++++---- libgomp/testsuite/libgomp.c-c++-common/target-present-3.c | 9 +++++---- libgomp/testsuite/libgomp.fortran/target-present-1.f90 | 9 +++++---- libgomp/testsuite/libgomp.fortran/target-present-2.f90 | 13 +++++++------ libgomp/testsuite/libgomp.fortran/target-present-3.f90 | 9 +++++---- 6 files changed, 35 insertions(+), 25 deletions(-) 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 12f154c91a8..aa343197e35 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_device } } */ -/* { dg-shouldfail "present error triggered" } */ +#include <stdio.h> #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: not present on the device \\\(0x\[0-9a-f\]+, \[0-9\]+\\\)" } */ + /* { dg-output "libgomp: present clause: not present on the device \\\(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 d4debbab10b..ad11023b2d6 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_device } } */ -/* { dg-shouldfail "present error triggered" } */ +#include <stdio.h> #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 and 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: not present on the device \\\(0x\[0-9a-f\]+, \[0-9\]+\\\)" } */ + /* { dg-output "libgomp: present clause: not present on the device \\\(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 9d8d8f8a335..455519af405 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_device } } */ -/* { dg-shouldfail "present error triggered" } */ - #include <stdio.h> #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: not present on the device \\\(0x\[0-9a-f\]+, \[0-9\]+\\\)" } */ + /* { dg-output "libgomp: present clause: not present on the device \\\(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 349dcb118b2..768166fcff7 100644 --- a/libgomp/testsuite/libgomp.fortran/target-present-1.f90 +++ b/libgomp/testsuite/libgomp.fortran/target-present-1.f90 @@ -1,6 +1,3 @@ -! { dg-do run { target offload_device } } -! { dg-shouldfail "present error triggered" } - program main implicit none integer, parameter :: N = 100 @@ -19,8 +16,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: not present on the device \\\(0x\[0-9a-f\]+, \[0-9\]+\\\)" } + ! { dg-output "libgomp: present clause: not present on the device \\\(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 07e79d1b576..8f2c24ef5f2 100644 --- a/libgomp/testsuite/libgomp.fortran/target-present-2.f90 +++ b/libgomp/testsuite/libgomp.fortran/target-present-2.f90 @@ -1,6 +1,3 @@ -! { dg-do run { target offload_device } } -! { dg-shouldfail "present error triggered" } - program main implicit none integer, parameter :: N = 100 @@ -11,16 +8,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, and 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: not present on the device \\\(0x\[0-9a-f\]+, \[0-9\]+\\\)" } + ! { dg-output "libgomp: present clause: not present on the device \\\(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 a2709eb6f17..eb29c907624 100644 --- a/libgomp/testsuite/libgomp.fortran/target-present-3.f90 +++ b/libgomp/testsuite/libgomp.fortran/target-present-3.f90 @@ -1,6 +1,3 @@ -! { dg-do run { target offload_device } } -! { dg-shouldfail "present error triggered" } - program main implicit none integer, parameter :: N = 100 @@ -15,8 +12,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: not present on the device \\\(0x\[0-9a-f\]+, \[0-9\]+\\\)" } + ! { dg-output "libgomp: present clause: not present on the device \\\(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
reply other threads:[~2023-06-07 11:23 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20230607112349.D7F0E3858C54@sourceware.org \ --to=burnus@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).