https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94629

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ams at gcc dot gnu.org

--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I have a few unimportant tweaks for this in my tree.
Anyway, e.g. in the GCN plugin, I wonder if we don't need:
diff --git a/libgomp/plugin/plugin-gcn.c b/libgomp/plugin/plugin-gcn.c
index dc72c90962c..c733b8bfb18 100644
--- a/libgomp/plugin/plugin-gcn.c
+++ b/libgomp/plugin/plugin-gcn.c
@@ -1508,7 +1508,8 @@ init_hsa_context (void)
     = GOMP_PLUGIN_malloc_cleared (hsa_context.agent_count
                                  * sizeof (struct agent_info));
   status = hsa_fns.hsa_iterate_agents_fn (assign_agent_ids, &agent_index);
-  if (agent_index != hsa_context.agent_count)
+  if (status != HSA_STATUS_SUCCESS
+      || agent_index != hsa_context.agent_count)
     {
       GOMP_PLUGIN_error ("Failed to assign IDs to all GCN agents");
       return false;
@@ -3473,7 +3474,8 @@ GOMP_OFFLOAD_init_device (int n)
   status = hsa_fns.hsa_agent_iterate_regions_fn (agent->id,
                                                 get_kernarg_memory_region,
                                                 &agent->kernarg_region);
-  if (agent->kernarg_region.handle == (uint64_t) -1)
+  if (status != HSA_STATUS_SUCCESS
+      || agent->kernarg_region.handle == (uint64_t) -1)
     {
       GOMP_PLUGIN_error ("Could not find suitable memory region for kernel "
                         "arguments");
@@ -3486,7 +3488,8 @@ GOMP_OFFLOAD_init_device (int n)
   status = hsa_fns.hsa_agent_iterate_regions_fn (agent->id,
                                                 get_data_memory_region,
                                                 &agent->data_region);
-  if (agent->data_region.handle == (uint64_t) -1)
+  if (status != HSA_STATUS_SUCCESS
+      || agent->data_region.handle == (uint64_t) -1)
     {
       GOMP_PLUGIN_error ("Could not find suitable memory region for device "
                         "data");
or if instead we should drop the "status = " for the cases where nothing checks
it. Andrew?

Reply via email to