Skip to content

Commit b87ef4f

Browse files
committed
detect the hcc version and conditionally add the -hc-function-calls switch
1 parent 8ec01dd commit b87ef4f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

CMakeLists.txt

+7-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,13 @@ if("${HIP_COMPILER}" MATCHES "clang")
152152
endif()
153153

154154
if("${HIP_COMPILER}" MATCHES "hcc")
155-
target_link_libraries(rccl PRIVATE -hc-function-calls)
155+
find_program( hcc_executable hcc )
156+
execute_process(COMMAND bash "-c" "${hcc_executable} --version | sed -e '1!d' -e 's/.*based on HCC\\s*//'" OUTPUT_VARIABLE hcc_version_string)
157+
execute_process(COMMAND bash "-c" "echo \"${hcc_version_string}\" | awk -F\".\" '{ printf $1}'" OUTPUT_VARIABLE hcc_major_version)
158+
execute_process(COMMAND bash "-c" "echo \"${hcc_version_string}\" | awk -F\".\" '{ printf $2}'" OUTPUT_VARIABLE hcc_minor_version)
159+
if ("${hcc_major_version}.${hcc_minor_version}" VERSION_LESS "2.10")
160+
target_link_libraries(rccl PRIVATE -hc-function-calls)
161+
endif()
156162
endif()
157163

158164
if(TARGET hip::device)

0 commit comments

Comments
 (0)