[Offload][AMDGPU] Make compiler-rt libs visible (#209849)

Fixed the failure in offload test after
https://github.com/llvm/llvm-project/pull/209765
This commit is contained in:
Kewen Meng 2026-07-15 15:57:15 -07:00 committed by GitHub
parent 18d2b47a0d
commit ba2be3f8ad
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -252,14 +252,28 @@ def get_target_library_dir():
# 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.
# FIXME: Drop this once --offload-arch and bundled AMDGPU offload images
# consistently use amdgpu-amd-amdhsa.
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
def get_compiler_rt_library_dirs():
target = remove_suffix_if_present(config.libomptarget_current_target)
dirs = glob.glob(os.path.join(config.llvm_library_dir, "clang", "*", "lib",
target))
if target == amdgpu_target:
# FIXME: Drop this once --offload-arch and bundled AMDGPU offload images
# consistently use amdgpu-amd-amdhsa.
dirs += glob.glob(os.path.join(config.llvm_library_dir, "clang", "*",
"lib", legacy_amdgpu_target))
return dirs
if "gpu" in config.available_features and "intelgpu" not in config.available_features:
config.test_flags += " -Xoffload-linker -L" + get_target_library_dir()
for library_dir in [get_target_library_dir()] + get_compiler_rt_library_dirs():
config.test_flags += " -Xoffload-linker -L" + library_dir
def add_libraries(source):
if "gpu" not in config.available_features: