diff options
author | Julian Brown <julian@codesourcery.com> | 2019-08-13 13:13:30 -0700 |
---|---|---|
committer | Thomas Schwinge <thomas@codesourcery.com> | 2020-03-03 12:50:41 +0100 |
commit | 5d8575da656b17eb8f39dc218acaceb4815579d7 (patch) | |
tree | 8ebcdc549a6c77b26cfa3a57b6bf3c7f6ee12e18 /libgomp | |
parent | addc8702db3df69ac119d6d99200c318897f38d3 (diff) | |
download | gcc-5d8575da656b17eb8f39dc218acaceb4815579d7.zip gcc-5d8575da656b17eb8f39dc218acaceb4815579d7.tar.gz gcc-5d8575da656b17eb8f39dc218acaceb4815579d7.tar.bz2 |
[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)
Diffstat (limited to 'libgomp')
-rw-r--r-- | libgomp/ChangeLog.omp | 5 | ||||
-rw-r--r-- | libgomp/plugin/plugin-gcn.c | 11 |
2 files changed, 14 insertions, 2 deletions
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 <julian@codesourcery.com> + * plugin/plugin-gcn.c (queue_push_callback): Wait on queue-full + condition. + +2019-08-13 Julian Brown <julian@codesourcery.com> + * 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); |