public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-8455] Avoid registering unsupported OMP offload devices
@ 2024-01-26 14:36 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2024-01-26 14:36 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:c34ab549d88da13ae16edccedd4218807afefb65

commit r14-8455-gc34ab549d88da13ae16edccedd4218807afefb65
Author: Richard Biener <rguenther@suse.de>
Date:   Fri Jan 26 12:57:10 2024 +0100

    Avoid registering unsupported OMP offload devices
    
    The following avoids registering unsupported GCN offload devices
    when iterating over available ones.  With a Zen4 desktop CPU
    you will have an IGPU (unspported) which will otherwise be made
    available.  This causes testcases like
    libgomp.c-c++-common/non-rect-loop-1.c which iterate over all
    decives to FAIL.
    
    libgomp/
            * plugin/plugin-gcn.c (suitable_hsa_agent_p): Filter out
            agents with unsupported ISA.

Diff:
---
 libgomp/plugin/plugin-gcn.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/libgomp/plugin/plugin-gcn.c b/libgomp/plugin/plugin-gcn.c
index 588358bbbf9b..2771123252a8 100644
--- a/libgomp/plugin/plugin-gcn.c
+++ b/libgomp/plugin/plugin-gcn.c
@@ -1427,6 +1427,8 @@ init_hsa_runtime_functions (void)
 #undef DLSYM_FN
 }
 
+static gcn_isa isa_code (const char *isa);
+
 /* Return true if the agent is a GPU and can accept of concurrent submissions
    from different threads.  */
 
@@ -1443,6 +1445,18 @@ suitable_hsa_agent_p (hsa_agent_t agent)
   switch (device_type)
     {
     case HSA_DEVICE_TYPE_GPU:
+      {
+	char name[64];
+	hsa_status_t status
+	  = hsa_fns.hsa_agent_get_info_fn (agent, HSA_AGENT_INFO_NAME, name);
+	if (status != HSA_STATUS_SUCCESS
+	    || isa_code (name) == EF_AMDGPU_MACH_UNSUPPORTED)
+	  {
+	    GCN_DEBUG ("Ignoring unsupported agent '%s'\n",
+		       status == HSA_STATUS_SUCCESS ? name : "invalid");
+	    return false;
+	  }
+      }
       break;
     case HSA_DEVICE_TYPE_CPU:
       if (!support_cpu_devices)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-01-26 14:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-26 14:36 [gcc r14-8455] Avoid registering unsupported OMP offload devices Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).