[llvm] [offload][test] Add fallback to legacy AMDGPU triple library dir (PR #209131)

Robert Imschweiler via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 13 03:12:44 PDT 2026


https://github.com/ro-i created https://github.com/llvm/llvm-project/pull/209131

After the amdgcn-amd-amdhsa -> amdgpu-amd-amdhsa rename, look up the device runtime libraries in the legacy directory when the runtime was built under the old triple name.

Claude assisted with this patch.

>From f22a2176d64c3f1cd7d1322bd82dbafb7759dac1 Mon Sep 17 00:00:00 2001
From: Robert Imschweiler <robert.imschweiler at amd.com>
Date: Mon, 13 Jul 2026 04:29:28 -0500
Subject: [PATCH] [offload][test] Add fallback to legacy AMDGPU triple library
 dir

After the amdgcn-amd-amdhsa -> amdgpu-amd-amdhsa rename, look up the
device runtime libraries in the legacy directory when the runtime was
built under the old triple name.

Claude assisted with this patch.
---
 offload/test/lit.cfg | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/offload/test/lit.cfg b/offload/test/lit.cfg
index 0b7ca00778acc..9dc4e73e4f4c0 100644
--- a/offload/test/lit.cfg
+++ b/offload/test/lit.cfg
@@ -247,9 +247,16 @@ if config.libomptarget_current_target in host_targets:
     config.available_features.add('host')
 
 def get_target_library_dir():
-    return os.path.join(
-        config.llvm_library_dir,
-        remove_suffix_if_present(config.libomptarget_current_target))
+    target = remove_suffix_if_present(config.libomptarget_current_target)
+    library_dir = os.path.join(config.llvm_library_dir, target)
+    # The AMDGPU offload triple was renamed amdgcn-amd-amdhsa ->
+    # amdgpu-amd-amdhsa. Fall back to the legacy directory when the runtime was
+    # built under the old triple name.
+    if target == amdgpu_target and not os.path.isdir(library_dir):
+        legacy_dir = os.path.join(config.llvm_library_dir, legacy_amdgpu_target)
+        if os.path.isdir(legacy_dir):
+            return legacy_dir
+    return library_dir
 
 if "gpu" in config.available_features and "intelgpu" not in config.available_features:
     config.test_flags += " -Xoffload-linker -L" + get_target_library_dir()



More information about the llvm-commits mailing list