https://gcc.gnu.org/g:62482764b33c03c8125a99689013a22b57e42a3f

commit 62482764b33c03c8125a99689013a22b57e42a3f
Author: Tobias Burnus <tbur...@baylibre.com>
Date:   Mon Nov 18 14:58:21 2024 +0100

    libgomp/plugin/plugin-gcn.c: async-queue init - fix function-return type 
and fail fatally
    
    libgomp/ChangeLog:
    
            * plugin/plugin-gcn.c (GOMP_OFFLOAD_openacc_async_construct): In
            case of an error, call GOMP_PLUGIN_fatal not ..._error; use NULL
            not false in return.
    
    (cherry picked from commit 884637b6362391921100efa2c7db4f4452e2a13f)

Diff:
---
 libgomp/ChangeLog.omp       |  7 +++++++
 libgomp/plugin/plugin-gcn.c | 16 +++++++++-------
 2 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/libgomp/ChangeLog.omp b/libgomp/ChangeLog.omp
index 4b915220fdc9..21c83c403264 100644
--- a/libgomp/ChangeLog.omp
+++ b/libgomp/ChangeLog.omp
@@ -1,5 +1,12 @@
 2024-12-18  Thomas Schwinge  <tschwi...@baylibre.com>
 
+       Backported from trunk:
+       2024-11-18  Tobias Burnus  <tbur...@baylibre.com>
+
+       * plugin/plugin-gcn.c (GOMP_OFFLOAD_openacc_async_construct): In
+       case of an error, call GOMP_PLUGIN_fatal not ..._error; use NULL
+       not false in return.
+
        Backported from trunk:
        2024-08-07  Tobias Burnus  <tbur...@baylibre.com>
 
diff --git a/libgomp/plugin/plugin-gcn.c b/libgomp/plugin/plugin-gcn.c
index 6fd22e19d37a..271a7fc05bda 100644
--- a/libgomp/plugin/plugin-gcn.c
+++ b/libgomp/plugin/plugin-gcn.c
@@ -4490,7 +4490,9 @@ GOMP_OFFLOAD_openacc_async_exec (void (*fn_ptr) (void *),
   gcn_exec (kernel, devaddrs, dims, targ_mem_desc, true, aq);
 }
 
-/* Create a new asynchronous thread and queue for running future kernels.  */
+/* Create a new asynchronous thread and queue for running future kernels;
+   issues a fatal error if the queue cannot be created as all callers expect
+   that the queue exists.  */
 
 void
 GOMP_OFFLOAD_openacc_async_exec_params (void (*fn) (void *), size_t mapnum,
@@ -4527,18 +4529,18 @@ GOMP_OFFLOAD_openacc_async_construct (int device)
 
   if (pthread_mutex_init (&aq->mutex, NULL))
     {
-      GOMP_PLUGIN_error ("Failed to initialize a GCN agent queue mutex");
-      return false;
+      GOMP_PLUGIN_fatal ("Failed to initialize a GCN agent queue mutex");
+      return NULL;
     }
   if (pthread_cond_init (&aq->queue_cond_in, NULL))
     {
-      GOMP_PLUGIN_error ("Failed to initialize a GCN agent queue cond");
-      return false;
+      GOMP_PLUGIN_fatal ("Failed to initialize a GCN agent queue cond");
+      return NULL;
     }
   if (pthread_cond_init (&aq->queue_cond_out, NULL))
     {
-      GOMP_PLUGIN_error ("Failed to initialize a GCN agent queue cond");
-      return false;
+      GOMP_PLUGIN_fatal ("Failed to initialize a GCN agent queue cond");
+      return NULL;
     }
 
   hsa_status_t status = hsa_fns.hsa_queue_create_fn (agent->id,

Reply via email to