From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1666) id E76523858282; Fri, 26 Jan 2024 14:36:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E76523858282 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1706279819; bh=tG/EGiSg2MhNb2OyKKMbjbP9i4dEON4LTjEsgqstsq0=; h=From:To:Subject:Date:From; b=QQU+Sl98tL+BVOQji7MjU3DNoAv525YqUij3EtL5A9qR1+JcnL93yJBUkWU80BCLP VQWV5xFiyiVc2ztk4pF/Oc40+1P/dspTDwTU4cZjhydQ860wybn7RPG7x3gcEZNSbU hKRawlwa5vLgavI/eKKXHmGnK5f9MdseLeX0/1VQ= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Richard Biener To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-8455] Avoid registering unsupported OMP offload devices X-Act-Checkin: gcc X-Git-Author: Richard Biener X-Git-Refname: refs/heads/master X-Git-Oldrev: 209ed06c3acddb25935ecdedf2b31235b71e5c39 X-Git-Newrev: c34ab549d88da13ae16edccedd4218807afefb65 Message-Id: <20240126143659.E76523858282@sourceware.org> Date: Fri, 26 Jan 2024 14:36:59 +0000 (GMT) List-Id: https://gcc.gnu.org/g:c34ab549d88da13ae16edccedd4218807afefb65 commit r14-8455-gc34ab549d88da13ae16edccedd4218807afefb65 Author: Richard Biener 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)