Skip to content

Commit cf5a4bf

Browse files
[openmp] - Update search method for rocm-device-libs during devicertl… (#435)
… build Make use of find_package(AMDDeviceLibs) to search for the cmake config in the build tree instead of looping through various paths. Co-authored-by: Ethan Stewart <[email protected]>
1 parent ce6e8d8 commit cf5a4bf

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

openmp/device/CMakeLists.txt

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,14 @@ set(src_files
4040

4141
)
4242
if(NOT LLVM_TARGETS_TO_BUILD OR "AMDGPU" IN_LIST LLVM_TARGETS_TO_BUILD)
43-
set(amdbc_dirs
44-
"${CMAKE_BINARY_DIR}/../rocm-device-libs-prefix/src/rocm-device-libs-build/lib/llvm/lib/clang/${LLVM_VERSION_MAJOR}/lib/amdgcn/bitcode"
45-
"${CMAKE_INSTALL_PREFIX}/../../amdgcn/bitcode"
46-
"/opt/rocm/amdgcn/bitcode")
47-
foreach(amdbc_dir ${amdbc_dirs})
48-
if(EXISTS "${amdbc_dir}/ockl.bc" AND NOT _ockl_bc)
49-
set(_ockl_bc ${amdbc_dir}/ockl.bc)
50-
endif()
51-
if(EXISTS "${amdbc_dir}/ocml.bc" AND NOT _ocml_bc)
52-
set(_ocml_bc ${amdbc_dir}/ocml.bc)
53-
endif()
54-
endforeach()
43+
find_package(AMDDeviceLibs REQUIRED CONFIG
44+
HINTS ${CMAKE_BINARY_DIR}/../../tools/rocm-device-libs
45+
${CMAKE_BINARY_DIR}/../rocm-device-libs-prefix/src/rocm-device-libs-build
46+
${CMAKE_INSTALL_PREFIX}
47+
)
48+
get_target_property(_ocml_bc ocml IMPORTED_LOCATION)
49+
get_target_property(_ockl_bc ockl IMPORTED_LOCATION)
50+
5551
if(NOT _ockl_bc)
5652
message(FATAL_ERROR "Could not find ockl.bc")
5753
endif()

0 commit comments

Comments
 (0)