Skip to content

Commit 0fa6648

Browse files
authored
Adjust device-libs search (llvm#4517)
1 parent a2ee874 commit 0fa6648

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

offload/DeviceRTL/CMakeLists.txt

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -113,18 +113,13 @@ function(compileDeviceRTLLibrary target_name target_triple)
113113
set(target_bc_flags ${ARGN})
114114

115115
if(${target_name} MATCHES "amdgpu")
116-
set(amdbc_dirs
117-
"${CMAKE_BINARY_DIR}/../rocm-device-libs-prefix/src/rocm-device-libs-build/lib/llvm/lib/clang/${LLVM_VERSION_MAJOR}/lib/amdgcn/bitcode"
118-
"${CMAKE_INSTALL_PREFIX}/../../amdgcn/bitcode"
119-
"/opt/rocm/amdgcn/bitcode")
120-
foreach(amdbc_dir ${amdbc_dirs})
121-
if(EXISTS "${amdbc_dir}/ockl.bc" AND NOT _ockl_bc)
122-
set(_ockl_bc ${amdbc_dir}/ockl.bc)
123-
endif()
124-
if(EXISTS "${amdbc_dir}/ocml.bc" AND NOT _ocml_bc)
125-
set(_ocml_bc ${amdbc_dir}/ocml.bc)
126-
endif()
127-
endforeach()
116+
find_package(AMDDeviceLibs REQUIRED CONFIG
117+
HINTS ${CMAKE_BINARY_DIR}/../../tools/rocm-device-libs
118+
${CMAKE_BINARY_DIR}/../rocm-device-libs-prefix/src/rocm-device-libs-build
119+
${CMAKE_INSTALL_PREFIX}
120+
)
121+
get_target_property(_ocml_bc ocml IMPORTED_LOCATION)
122+
get_target_property(_ockl_bc ockl IMPORTED_LOCATION)
128123
if(NOT _ockl_bc)
129124
message(FATAL_ERROR "Could not find ockl.bc")
130125
endif()

0 commit comments

Comments
 (0)