#Indirect call to a device function defined in a source file different than the calling function/kernel is only supported when compiling the entire program with -fgpu-rdc
if(GPU_SEPARABLE_COMPILATION)
list(APPEND CMAKE_HIP_FLAGS "-fgpu-rdc")
endif()
#link the correct gpu runtime library
function(gpu_runtime_link target_name)
target_include_directories(${target_name} PRIVATE
${CMAKE_SOURCE_DIR}/include/cuda2hip)
target_link_libraries(${target_name} PUBLIC hip::host)
endfunction()
#link the correct gpu runtime library
function(gpu_blas_link target_name)
target_include_directories(${target_name} PRIVATE
${CMAKE_SOURCE_DIR}/include/cuda2hip)
target_link_libraries(${target_name} PUBLIC roc::hipblas)
endfunction()
function(gpu_device_link target_name)
target_include_directories(${target_name} PRIVATE
${CMAKE_SOURCE_DIR}/include/cuda2hip)
set_target_properties(${target_name} PROPERTIES
LINKER_LANGUAGE "HIP")
# still non-functional in cmake 3.21 (use CMAKE_HIP_FLAGS)