public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/omp/gcc-12] Tweak error return value for acc_set_cuda_stream.
@ 2022-06-29 14:33 Kwok Yeung
0 siblings, 0 replies; only message in thread
From: Kwok Yeung @ 2022-06-29 14:33 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:30d29fbc7bcb98b4b4567e6e02add4a19a6fb356
commit 30d29fbc7bcb98b4b4567e6e02add4a19a6fb356
Author: Julian Brown <julian@codesourcery.com>
Date: Tue Feb 12 06:36:03 2019 -0800
Tweak error return value for acc_set_cuda_stream.
The return value of acc_set_cuda_stream is unspecified in OpenACC 2.6.
The testsuite changes might be unnecessary with the current async code.
libgomp/
* oacc-cuda.c (acc_set_cuda_stream): Return 0 on error/invalid
arguments.
* testsuite/libgomp.oacc-c-c++-common/lib-84.c: Handle unnumbered
async stream being an alias for a numbered async stream.
* testsuite/libgomp.oacc-c-c++-common/lib-85.c: Likewise.
Diff:
---
libgomp/ChangeLog.omp | 8 ++++++++
libgomp/oacc-cuda.c | 5 ++++-
libgomp/testsuite/libgomp.oacc-c-c++-common/lib-84.c | 6 ++++++
libgomp/testsuite/libgomp.oacc-c-c++-common/lib-85.c | 6 ++++++
4 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/libgomp/ChangeLog.omp b/libgomp/ChangeLog.omp
index 1bfebcb3217..2769eb88dad 100644
--- a/libgomp/ChangeLog.omp
+++ b/libgomp/ChangeLog.omp
@@ -1,3 +1,11 @@
+2019-02-12 Julian Brown <julian@codesourcery.com>
+
+ * oacc-cuda.c (acc_set_cuda_stream): Return 0 on error/invalid
+ arguments.
+ * testsuite/libgomp.oacc-c-c++-common/lib-84.c: Handle unnumbered
+ async stream being an alias for a numbered async stream.
+ * testsuite/libgomp.oacc-c-c++-common/lib-85.c: Likewise.
+
2020-04-19 Chung-Lin Tang <cltang@codesourcery.com>
PR other/76739
diff --git a/libgomp/oacc-cuda.c b/libgomp/oacc-cuda.c
index 91b602de014..80b9cca5eb5 100644
--- a/libgomp/oacc-cuda.c
+++ b/libgomp/oacc-cuda.c
@@ -115,6 +115,9 @@ acc_get_cuda_stream (int async)
return ret;
}
+/* As of OpenACC 2.6, the return code of this function appears to be
+ unspecified. We choose to return 1 for success, or 0 for failure. */
+
int
acc_set_cuda_stream (int async, void *stream)
{
@@ -127,7 +130,7 @@ acc_set_cuda_stream (int async, void *stream)
thr = goacc_thread ();
- int ret = -1;
+ int ret = 0;
if (thr && thr->dev && thr->dev->openacc.cuda.set_stream_func)
{
acc_prof_info prof_info;
diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-84.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-84.c
index c1ff76372fc..674e09a251d 100644
--- a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-84.c
+++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-84.c
@@ -39,6 +39,12 @@ main (int argc, char **argv)
if (streams[i] != NULL)
abort ();
+ /* The no-value async may be an alias for a numbered async stream.
+ Skip over setting it below else the above NULL check will fail for
+ the aliased stream. */
+ if (i == acc_async_noval)
+ continue;
+
r = cuStreamCreate (&streams[i], CU_STREAM_DEFAULT);
if (r != CUDA_SUCCESS)
{
diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-85.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-85.c
index db250657ac5..4e5c7b1b905 100644
--- a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-85.c
+++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-85.c
@@ -39,6 +39,12 @@ main (int argc, char **argv)
if (streams[i] != NULL)
abort ();
+ /* The no-value async may be an alias for a numbered async stream.
+ Skip over setting it below else the above NULL check will fail for
+ the aliased stream. */
+ if (i == acc_async_noval)
+ continue;
+
r = cuStreamCreate (&streams[i], CU_STREAM_DEFAULT);
if (r != CUDA_SUCCESS)
{
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-06-29 14:33 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-29 14:33 [gcc/devel/omp/gcc-12] Tweak error return value for acc_set_cuda_stream Kwok Yeung
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).