From: Julian Brown Date: Tue, 13 Aug 2019 20:13:30 +0000 (-0700) Subject: [og9] Wait on queue-full condition in AMD GCN libgomp offloading plugin X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5d8575da656b17eb8f39dc218acaceb4815579d7;p=thirdparty%2Fgcc.git [og9] Wait on queue-full condition in AMD GCN libgomp offloading plugin libgomp/ * plugin/plugin-gcn.c (queue_push_callback): Wait on queue-full condition. (cherry picked from openacc-gcc-9-branch commit b4bc0ff301aae3b6a6359f007b3c773419c3163b) --- diff --git a/libgomp/ChangeLog.omp b/libgomp/ChangeLog.omp index 2a9a7f18ca2e..f9d8e6ecd397 100644 --- a/libgomp/ChangeLog.omp +++ b/libgomp/ChangeLog.omp @@ -1,3 +1,8 @@ +2019-08-13 Julian Brown + + * plugin/plugin-gcn.c (queue_push_callback): Wait on queue-full + condition. + 2019-08-13 Julian Brown * plugin/plugin-gcn.c (struct copy_data): Add using_src_copy field. diff --git a/libgomp/plugin/plugin-gcn.c b/libgomp/plugin/plugin-gcn.c index 65690e643ede..099f70b647cf 100644 --- a/libgomp/plugin/plugin-gcn.c +++ b/libgomp/plugin/plugin-gcn.c @@ -1416,8 +1416,15 @@ queue_push_callback (struct goacc_asyncqueue *aq, void (*fn)(void *), void *data) { if (aq->queue_n == ASYNC_QUEUE_SIZE) - GOMP_PLUGIN_fatal ("Async thread %d:%d: error: queue overflowed", - aq->agent->device_id, aq->id); + { + pthread_mutex_lock (&aq->mutex); + + /* Queue is full. Wait for it to not be full. */ + while (aq->queue_n == ASYNC_QUEUE_SIZE) + pthread_cond_wait (&aq->queue_cond_out, &aq->mutex); + + pthread_mutex_unlock (&aq->mutex); + } pthread_mutex_lock (&aq->mutex);