SWDEV-274915 - Prevent repeatedly linking dependence

Some upstream will load hip multiple times thus Rocclr static lib  will
be linked to hip::amdhip64 many times. This will bring some unexpected
issues such as in hipBLAS. The patch prevents his happening.

Change-Id: I6bb27659f74371dae6e59c59fd6bb2022cc062ff
This commit is contained in:
Tao Sang
2021-03-02 17:23:36 -05:00
committato da Tao Sang
parent fd0f49503f
commit f65348cfbe
+5 -1
Vedi File
@@ -176,7 +176,11 @@ if(HIP_RUNTIME MATCHES "rocclr")
message(STATUS "hip::amdhip64 is ${amdhip64_type}")
if(${amdhip64_type} STREQUAL "STATIC_LIBRARY")
# For cyclic dependence
target_link_libraries(amdrocclr_static INTERFACE hip::amdhip64)
get_target_property(link_interf_libs amdrocclr_static LINK_INTERFACE_LIBRARIES)
if(NOT "${link_interf_libs}" MATCHES "hip\:\:amdhip64")
# Prevent repeatedly linking dependence
target_link_libraries(amdrocclr_static INTERFACE hip::amdhip64)
endif()
endif()
if(NOT WIN32)