From 5d8575da656b17eb8f39dc218acaceb4815579d7 Mon Sep 17 00:00:00 2001 From: Julian Brown Date: Tue, 13 Aug 2019 13:13:30 -0700 Subject: [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) --- libgomp/ChangeLog.omp | 5 +++++ libgomp/plugin/plugin-gcn.c | 11 +++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'libgomp') diff --git a/libgomp/ChangeLog.omp b/libgomp/ChangeLog.omp index 2a9a7f1..f9d8e6e 100644 --- a/libgomp/ChangeLog.omp +++ b/libgomp/ChangeLog.omp @@ -1,5 +1,10 @@ 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. (copy_data): Free temporary buffer if using. (queue_push_copy): Add using_src_copy parameter. diff --git a/libgomp/plugin/plugin-gcn.c b/libgomp/plugin/plugin-gcn.c index 65690e6..099f70b 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); -- cgit v1.1