]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix 'libgomp.{c-c++-common,fortran}/target-present-*' test cases
authorThomas Schwinge <thomas@codesourcery.com>
Wed, 15 Feb 2023 11:39:19 +0000 (12:39 +0100)
committerThomas Schwinge <thomas@codesourcery.com>
Wed, 15 Feb 2023 18:58:57 +0000 (19:58 +0100)
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
libgomp/testsuite/libgomp.c-c++-common/target-present-1.c
libgomp/testsuite/libgomp.c-c++-common/target-present-2.c
libgomp/testsuite/libgomp.c-c++-common/target-present-3.c
libgomp/testsuite/libgomp.fortran/target-present-1.f90
libgomp/testsuite/libgomp.fortran/target-present-2.f90
libgomp/testsuite/libgomp.fortran/target-present-3.f90

index b638cdbb41e1a98c3920e84187a3e7dd6dff0978..5257ee00e0ce89fab19beef566a7f65b7db1d58e 100644 (file)
@@ -1,3 +1,12 @@
+2023-02-15  Thomas Schwinge  <thomas@codesourcery.com>
+
+       * 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  <tobias@codesourcery.com>
 
        Backported from master:
index bbc4559b12ec52a664f6b343d476d95d6b45650f..55aecd1c8d1353c62b3ae645b137a564f3135aae 100644 (file)
@@ -1,5 +1,4 @@
-/* { dg-do run { target offload_target_any } } */
-/* { 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: !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];
index 6259c959c04426150c7c7e8d25cc1a03e412b8ec..1ce919e62ce09abb30139600ede7a3e1c0f5d1ca 100644 (file)
@@ -1,5 +1,4 @@
-/* { dg-do run { target offload_target_any } } */
-/* { 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, 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];
index 89e648645b282f04095a4ab968738864da584ee4..886969c4c4a874b80bb663b895cbcc742c40e17b 100644 (file)
@@ -1,6 +1,3 @@
-/* { dg-do run { target offload_target_any } } */
-/* { 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: !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)
index 80046011b25a8e0ee0c26970481bbf10aa855531..c56b76e02332df20ef1955090c5d2f92d887ea98 100644 (file)
@@ -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)
index 0a38dea1e41c6c92504be9375d9b9b5df5c93d61..f62e0c224683564a84f78bc6ec440d0f42f3c3dd 100644 (file)
@@ -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)
index c4deb8652d153eec2c22fdd24156654f6817f032..b186c1c5462e105c3de561d6aa7a0bee5162fd28 100644 (file)
@@ -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