1 find_package(AMDDeviceLibs QUIET HINTS ${CMAKE_INSTALL_PREFIX} PATHS /opt/rocm)
2 if(AMDDeviceLibs_FOUND)
3 message(STATUS "Found the ROCm device library. Implementations falling back "
4 "to the vendor libraries will be resolved statically.")
5 get_target_property(ocml_path ocml IMPORTED_LOCATION)
6 list(APPEND bitcode_link_flags
7 "SHELL:-Xclang -mlink-builtin-bitcode -Xclang ${ocml_path}")
9 message(STATUS "Could not find the ROCm device library. Unimplemented "
10 "functions will be an external reference to the vendor libraries.")
13 find_package(CUDAToolkit QUIET)
15 set(libdevice_path ${CUDAToolkit_BIN_DIR}/../nvvm/libdevice/libdevice.10.bc)
16 if (EXISTS ${libdevice_path})
17 message(STATUS "Found the CUDA device library. Implementations falling back "
18 "to the vendor libraries will be resolved statically.")
19 list(APPEND bitcode_link_flags
20 "SHELL:-Xclang -mlink-builtin-bitcode -Xclang ${libdevice_path}")
23 message(STATUS "Could not find the ROCm device library. Unimplemented "
24 "functions will be an external reference to the vendor libraries.")
27 # FIXME: We need a way to pass the library to only the NVTPX / AMDGPU build.
28 # This shouldn't cause issues because we only link in needed symbols, but it
29 # will link in identity metadata from both libraries. This silences the warning.
30 list(APPEND bitcode_link_flags "-Wno-linker-warnings")
32 add_entrypoint_object(
43 add_entrypoint_object(
54 add_entrypoint_object(
65 add_entrypoint_object(
76 add_entrypoint_object(
87 add_entrypoint_object(
98 add_entrypoint_object(
105 ${bitcode_link_flags}
109 add_entrypoint_object(
116 ${bitcode_link_flags}
120 add_entrypoint_object(
127 ${bitcode_link_flags}
131 add_entrypoint_object(
138 ${bitcode_link_flags}
142 add_entrypoint_object(
149 ${bitcode_link_flags}
153 add_entrypoint_object(
160 ${bitcode_link_flags}
164 add_entrypoint_object(
171 ${bitcode_link_flags}
175 add_entrypoint_object(
182 ${bitcode_link_flags}
186 add_entrypoint_object(
193 ${bitcode_link_flags}
197 add_entrypoint_object(
204 ${bitcode_link_flags}
208 add_entrypoint_object(
215 ${bitcode_link_flags}
219 add_entrypoint_object(
226 ${bitcode_link_flags}
230 add_entrypoint_object(
237 ${bitcode_link_flags}
241 add_entrypoint_object(
248 ${bitcode_link_flags}
252 add_entrypoint_object(
259 ${bitcode_link_flags}
263 add_entrypoint_object(
270 ${bitcode_link_flags}
274 add_entrypoint_object(
281 ${bitcode_link_flags}
285 add_entrypoint_object(
292 ${bitcode_link_flags}
296 add_entrypoint_object(
303 ${bitcode_link_flags}
307 add_entrypoint_object(
314 ${bitcode_link_flags}
319 add_entrypoint_object(
326 ${bitcode_link_flags}
330 add_entrypoint_object(
337 ${bitcode_link_flags}
341 add_entrypoint_object(
348 ${bitcode_link_flags}
352 add_entrypoint_object(
359 ${bitcode_link_flags}
364 add_entrypoint_object(
371 ${bitcode_link_flags}
375 add_entrypoint_object(
382 ${bitcode_link_flags}
386 add_entrypoint_object(
393 ${bitcode_link_flags}
397 add_entrypoint_object(
404 ${bitcode_link_flags}
408 add_entrypoint_object(
415 ${bitcode_link_flags}
419 add_entrypoint_object(
426 ${bitcode_link_flags}
430 add_entrypoint_object(
437 ${bitcode_link_flags}
441 add_entrypoint_object(
448 ${bitcode_link_flags}
452 add_entrypoint_object(
459 ${bitcode_link_flags}
463 add_entrypoint_object(
470 ${bitcode_link_flags}
474 add_entrypoint_object(
481 ${bitcode_link_flags}
485 add_entrypoint_object(
492 ${bitcode_link_flags}
496 add_entrypoint_object(
503 ${bitcode_link_flags}
507 add_entrypoint_object(
514 ${bitcode_link_flags}
518 add_entrypoint_object(
525 ${bitcode_link_flags}
529 add_entrypoint_object(
536 ${bitcode_link_flags}