public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/omp/gcc-12] Enhance 'libgomp.c-c++-common/requires-4.c', 'libgomp.c-c++-common/requires-5.c' testing
@ 2022-07-07 12:08 Tobias Burnus
0 siblings, 0 replies; only message in thread
From: Tobias Burnus @ 2022-07-07 12:08 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:8bdc6ae489ada8b50615bdb1b1d44c740ae3a60f
commit 8bdc6ae489ada8b50615bdb1b1d44c740ae3a60f
Author: Thomas Schwinge <thomas@codesourcery.com>
Date: Thu Jul 7 14:05:53 2022 +0200
Enhance 'libgomp.c-c++-common/requires-4.c', 'libgomp.c-c++-common/requires-5.c' testing
These should compile and link and execute in all configurations; host-fallback
execution, which we may actually verify.
Follow-up to recent commit 683f11843974f0bdf42f79cdcbb0c2b43c7b81b0
"OpenMP: Move omp requires checks to libgomp".
libgomp/
* testsuite/libgomp.c-c++-common/requires-4.c: Enhance testing.
* testsuite/libgomp.c-c++-common/requires-5.c: Likewise.
(cherry picked from commit 5647e2c3853cbd51a6536a84b8eb0eb3c210dfbf)
Diff:
---
libgomp/ChangeLog.omp | 8 ++++++++
.../testsuite/libgomp.c-c++-common/requires-4.c | 21 ++++++++++++++++-----
.../testsuite/libgomp.c-c++-common/requires-5.c | 22 +++++++++++++++-------
3 files changed, 39 insertions(+), 12 deletions(-)
diff --git a/libgomp/ChangeLog.omp b/libgomp/ChangeLog.omp
index 8ace421648f..e16b1c91d2d 100644
--- a/libgomp/ChangeLog.omp
+++ b/libgomp/ChangeLog.omp
@@ -1,3 +1,11 @@
+2022-07-07 Tobias Burnus <tobias@codesourcery.com>
+
+ Backport from mainline:
+ 2022-07-07 Thomas Schwinge <thomas@codesourcery.com>
+
+ * testsuite/libgomp.c-c++-common/requires-4.c: Enhance testing.
+ * testsuite/libgomp.c-c++-common/requires-5.c: Likewise.
+
2022-07-07 Tobias Burnus <tobias@codesourcery.com>
Backport from mainline:
diff --git a/libgomp/testsuite/libgomp.c-c++-common/requires-4.c b/libgomp/testsuite/libgomp.c-c++-common/requires-4.c
index 128fdbb8463..6ed5a5f647a 100644
--- a/libgomp/testsuite/libgomp.c-c++-common/requires-4.c
+++ b/libgomp/testsuite/libgomp.c-c++-common/requires-4.c
@@ -1,22 +1,33 @@
-/* { dg-do link { target offloading_enabled } } */
/* { dg-additional-options "-flto" } */
/* { dg-additional-sources requires-4-aux.c } */
-/* Check diagnostic by device-compiler's or host compiler's lto1.
+/* Check no diagnostic by device-compiler's or host compiler's lto1.
Other file uses: 'requires reverse_offload', but that's inactive as
there are no declare target directives, device constructs nor device routines */
+/* Depending on offload device capabilities, it may print something like the
+ following (only) if GOMP_DEBUG=1:
+ "devices present but 'omp requires unified_address, unified_shared_memory, reverse_offload' cannot be fulfilled"
+ and in that case does host-fallback execution.
+
+ No offload devices support USM at present, so we may verify host-fallback
+ execution by presence of separate memory spaces. */
+
#pragma omp requires unified_address,unified_shared_memory
-int a[10];
+int a[10] = { 0 };
extern void foo (void);
int
main (void)
{
- #pragma omp target
+ #pragma omp target map(to: a)
+ for (int i = 0; i < 10; i++)
+ a[i] = i;
+
for (int i = 0; i < 10; i++)
- a[i] = 0;
+ if (a[i] != i)
+ __builtin_abort ();
foo ();
return 0;
diff --git a/libgomp/testsuite/libgomp.c-c++-common/requires-5.c b/libgomp/testsuite/libgomp.c-c++-common/requires-5.c
index c1e5540cfc5..7fe0c735d27 100644
--- a/libgomp/testsuite/libgomp.c-c++-common/requires-5.c
+++ b/libgomp/testsuite/libgomp.c-c++-common/requires-5.c
@@ -1,21 +1,29 @@
-/* { dg-do run { target { offload_target_nvptx || offload_target_amdgcn } } } */
/* { dg-additional-sources requires-5-aux.c } */
+/* Depending on offload device capabilities, it may print something like the
+ following (only) if GOMP_DEBUG=1:
+ "devices present but 'omp requires unified_address, unified_shared_memory, reverse_offload' cannot be fulfilled"
+ and in that case does host-fallback execution.
+
+ As no offload devices support USM at present, we may verify host-fallback
+ execution by absence of separate memory spaces. */
+
#pragma omp requires unified_shared_memory, unified_address, reverse_offload
-int a[10];
+int a[10] = { 0 };
extern void foo (void);
int
main (void)
{
- #pragma omp target
+ #pragma omp target map(to: a)
for (int i = 0; i < 10; i++)
- a[i] = 0;
+ a[i] = i;
+
+ for (int i = 0; i < 10; i++)
+ if (a[i] != i)
+ __builtin_abort ();
foo ();
return 0;
}
-
-/* (Only) if GOMP_DEBUG=1, should print at runtime the following:
- "devices present but 'omp requires unified_address, unified_shared_memory, reverse_offload' cannot be fulfilled" */
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-07-07 12:08 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-07 12:08 [gcc/devel/omp/gcc-12] Enhance 'libgomp.c-c++-common/requires-4.c', 'libgomp.c-c++-common/requires-5.c' testing Tobias Burnus
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).