This patch lets the AMD GCN libgomp plugin wait for asynchronous queues to have some space to push new operations when they are full, rather than just erroring out immediately on that condition. This fixes the libgomp.oacc-c-c++-common/da-4.c test.
Julian ChangeLog libgomp/ * plugin/plugin-gcn.c (queue_push_callback): Wait on queue-full condition. --- libgomp/ChangeLog.openacc | 5 +++++ libgomp/plugin/plugin-gcn.c | 11 +++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/libgomp/ChangeLog.openacc b/libgomp/ChangeLog.openacc index 2a9a7f18ca2..f9d8e6ecd39 100644 --- a/libgomp/ChangeLog.openacc +++ b/libgomp/ChangeLog.openacc @@ -1,3 +1,8 @@ +2019-08-13 Julian Brown <jul...@codesourcery.com> + + * plugin/plugin-gcn.c (queue_push_callback): Wait on queue-full + condition. + 2019-08-13 Julian Brown <jul...@codesourcery.com> * 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 65690e643ed..099f70b647c 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); -- 2.22.0