From: Julian Brown Date: Tue, 12 Feb 2019 14:36:03 +0000 (-0800) Subject: Tweak error return value for acc_set_cuda_stream. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=64a95e9be2e86f85bc6c5877b5c22578bbe98b47;p=thirdparty%2Fgcc.git 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. (cherry picked from openacc-gcc-9-branch commit 6b0f72aad2030b3efa651652d75ad3d3cc9a76f6) --- diff --git a/libgomp/ChangeLog.omp b/libgomp/ChangeLog.omp index f5c8a47a9c55..2da291cca004 100644 --- a/libgomp/ChangeLog.omp +++ b/libgomp/ChangeLog.omp @@ -1,3 +1,11 @@ +2019-02-12 Julian Brown + + * 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. + 2018-10-02 Thomas Schwinge Cesar Philippidis diff --git a/libgomp/oacc-cuda.c b/libgomp/oacc-cuda.c index 1a6946c5ddab..1ca714975f23 100644 --- a/libgomp/oacc-cuda.c +++ b/libgomp/oacc-cuda.c @@ -72,6 +72,9 @@ acc_get_cuda_stream (int async) return NULL; } +/* 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) { @@ -84,7 +87,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) { goacc_aq aq = get_goacc_asyncqueue (async); 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 d793c7436300..e2d86dee61c8 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-84.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-84.c @@ -38,6 +38,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 141c83b53dd6..22982415d459 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-85.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-85.c @@ -38,6 +38,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) {