mirror of git://gcc.gnu.org/git/gcc.git
[openacc] Factor out async argument utility functions
2018-05-09 Tom de Vries <tom@codesourcery.com> PR libgomp/83792 * oacc-int.h (async_valid_stream_id_p, async_valid_p) (async_synchronous_p): New function. * oacc-async.c (acc_async_test, acc_wait, acc_wait_all_async): Use async_valid_p. * oacc-cuda.c (acc_get_cuda_stream, acc_set_cuda_stream): Use async_valid_stream_id_p. * oacc-mem.c (gomp_acc_remove_pointer): Use async_synchronous_p. * oacc-parallel.c (GOACC_parallel_keyed): Same. From-SVN: r260081
This commit is contained in:
parent
88b1e41c2d
commit
edbd038a5f
|
|
@ -1,3 +1,15 @@
|
||||||
|
2018-05-09 Tom de Vries <tom@codesourcery.com>
|
||||||
|
|
||||||
|
PR libgomp/83792
|
||||||
|
* oacc-int.h (async_valid_stream_id_p, async_valid_p)
|
||||||
|
(async_synchronous_p): New function.
|
||||||
|
* oacc-async.c (acc_async_test, acc_wait, acc_wait_all_async): Use
|
||||||
|
async_valid_p.
|
||||||
|
* oacc-cuda.c (acc_get_cuda_stream, acc_set_cuda_stream): Use
|
||||||
|
async_valid_stream_id_p.
|
||||||
|
* oacc-mem.c (gomp_acc_remove_pointer): Use async_synchronous_p.
|
||||||
|
* oacc-parallel.c (GOACC_parallel_keyed): Same.
|
||||||
|
|
||||||
2018-05-07 Tom de Vries <tom@codesourcery.com>
|
2018-05-07 Tom de Vries <tom@codesourcery.com>
|
||||||
|
|
||||||
PR testsuite/85677
|
PR testsuite/85677
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@
|
||||||
int
|
int
|
||||||
acc_async_test (int async)
|
acc_async_test (int async)
|
||||||
{
|
{
|
||||||
if (async < acc_async_sync)
|
if (!async_valid_p (async))
|
||||||
gomp_fatal ("invalid async argument: %d", async);
|
gomp_fatal ("invalid async argument: %d", async);
|
||||||
|
|
||||||
struct goacc_thread *thr = goacc_thread ();
|
struct goacc_thread *thr = goacc_thread ();
|
||||||
|
|
@ -59,7 +59,7 @@ acc_async_test_all (void)
|
||||||
void
|
void
|
||||||
acc_wait (int async)
|
acc_wait (int async)
|
||||||
{
|
{
|
||||||
if (async < acc_async_sync)
|
if (!async_valid_p (async))
|
||||||
gomp_fatal ("invalid async argument: %d", async);
|
gomp_fatal ("invalid async argument: %d", async);
|
||||||
|
|
||||||
struct goacc_thread *thr = goacc_thread ();
|
struct goacc_thread *thr = goacc_thread ();
|
||||||
|
|
@ -117,7 +117,7 @@ acc_async_wait_all (void)
|
||||||
void
|
void
|
||||||
acc_wait_all_async (int async)
|
acc_wait_all_async (int async)
|
||||||
{
|
{
|
||||||
if (async < acc_async_sync)
|
if (!async_valid_p (async))
|
||||||
gomp_fatal ("invalid async argument: %d", async);
|
gomp_fatal ("invalid async argument: %d", async);
|
||||||
|
|
||||||
struct goacc_thread *thr = goacc_thread ();
|
struct goacc_thread *thr = goacc_thread ();
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ acc_get_cuda_stream (int async)
|
||||||
{
|
{
|
||||||
struct goacc_thread *thr = goacc_thread ();
|
struct goacc_thread *thr = goacc_thread ();
|
||||||
|
|
||||||
if (async < 0)
|
if (!async_valid_stream_id_p (async))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (thr && thr->dev && thr->dev->openacc.cuda.get_stream_func)
|
if (thr && thr->dev && thr->dev->openacc.cuda.get_stream_func)
|
||||||
|
|
@ -72,7 +72,7 @@ acc_set_cuda_stream (int async, void *stream)
|
||||||
{
|
{
|
||||||
struct goacc_thread *thr;
|
struct goacc_thread *thr;
|
||||||
|
|
||||||
if (async < 0 || stream == NULL)
|
if (!async_valid_stream_id_p (async) || stream == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
goacc_lazy_initialize ();
|
goacc_lazy_initialize ();
|
||||||
|
|
|
||||||
|
|
@ -99,6 +99,28 @@ void goacc_restore_bind (void);
|
||||||
void goacc_lazy_initialize (void);
|
void goacc_lazy_initialize (void);
|
||||||
void goacc_host_init (void);
|
void goacc_host_init (void);
|
||||||
|
|
||||||
|
static inline bool
|
||||||
|
async_valid_stream_id_p (int async)
|
||||||
|
{
|
||||||
|
return async >= 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline bool
|
||||||
|
async_valid_p (int async)
|
||||||
|
{
|
||||||
|
return (async == acc_async_noval || async == acc_async_sync
|
||||||
|
|| async_valid_stream_id_p (async));
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline bool
|
||||||
|
async_synchronous_p (int async)
|
||||||
|
{
|
||||||
|
if (!async_valid_p (async))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return async == acc_async_sync;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef HAVE_ATTRIBUTE_VISIBILITY
|
#ifdef HAVE_ATTRIBUTE_VISIBILITY
|
||||||
# pragma GCC visibility pop
|
# pragma GCC visibility pop
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -723,7 +723,7 @@ gomp_acc_remove_pointer (void *h, bool force_copyfrom, int async, int mapnum)
|
||||||
gomp_mutex_unlock (&acc_dev->lock);
|
gomp_mutex_unlock (&acc_dev->lock);
|
||||||
|
|
||||||
/* If running synchronously, unmap immediately. */
|
/* If running synchronously, unmap immediately. */
|
||||||
if (async < acc_async_noval)
|
if (async_synchronous_p (async))
|
||||||
gomp_unmap_vars (t, true);
|
gomp_unmap_vars (t, true);
|
||||||
else
|
else
|
||||||
t->device_descr->openacc.register_async_cleanup_func (t, async);
|
t->device_descr->openacc.register_async_cleanup_func (t, async);
|
||||||
|
|
|
||||||
|
|
@ -183,7 +183,7 @@ GOACC_parallel_keyed (int device, void (*fn) (void *),
|
||||||
async, dims, tgt);
|
async, dims, tgt);
|
||||||
|
|
||||||
/* If running synchronously, unmap immediately. */
|
/* If running synchronously, unmap immediately. */
|
||||||
if (async < acc_async_noval)
|
if (async_synchronous_p (async))
|
||||||
gomp_unmap_vars (tgt, true);
|
gomp_unmap_vars (tgt, true);
|
||||||
else
|
else
|
||||||
tgt->device_descr->openacc.register_async_cleanup_func (tgt, async);
|
tgt->device_descr->openacc.register_async_cleanup_func (tgt, async);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue