Skip to content

Commit

Permalink
Fix hip targets to work with hip-clang (#111)
Browse files Browse the repository at this point in the history
  • Loading branch information
amdkila committed Mar 5, 2020
1 parent f5b2aa6 commit 4526aa2
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion benchmark/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ foreach(benchmark_src ${rocRAND_BENCHMARK_SRCS})
else()
target_link_libraries(${benchmark_name}
rocrand
hip::hip_hcc hip::hip_device
hip::device
)
endif()
foreach(amdgpu_target ${AMDGPU_TARGETS})
Expand Down
13 changes: 6 additions & 7 deletions library/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,15 @@ else()
add_library(rocrand ${rocRAND_SRCS})

# Remove this check when we no longer build with older rocm stack(ie < 1.8.2)
if(TARGET hip::device)
if(CXX_VERSION_STRING MATCHES "clang")
target_link_libraries(rocrand PRIVATE hip::device)
else()
target_link_libraries(rocrand
PRIVATE
# We keep hip::hip_hcc private, because otherwise it's not possible
# We keep hip::device private, because otherwise it's not possible
# to link to roc::rocrand when using different compiler than hcc,
# hip::hip_hcc adds hcc-specific compilation flags.
hip::hip_hcc
hip::hip_device
# hip::device adds hcc-specific compilation flags.
hip::device
hcc::hccshared
)
endif()
Expand Down Expand Up @@ -172,10 +171,10 @@ if(HIP_PLATFORM STREQUAL "nvcc")
)
else()
# Remove this check when we no longer build with older rocm stack(ie < 1.8.2)
if(TARGET hip::device)
if(CXX_VERSION_STRING MATCHES "clang")
target_link_libraries(hiprand PRIVATE rocrand hip::device)
else()
target_link_libraries(hiprand PRIVATE rocrand hip::hip_hcc hip::hip_device hcc::hccshared)
target_link_libraries(hiprand PRIVATE rocrand hip::device hcc::hccshared)
endif()
foreach(amdgpu_target ${AMDGPU_TARGETS})
target_link_libraries(hiprand PRIVATE --amdgpu-target=${amdgpu_target})
Expand Down
4 changes: 2 additions & 2 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ foreach(test_src ${rocRAND_TEST_SRCS})
if(TARGET hip::device)
target_link_libraries(${test_name} hip::device)
else()
target_link_libraries(${test_name} hip::hip_hcc hip::hip_device)
target_link_libraries(${test_name} hip::device )
endif()
foreach(amdgpu_target ${AMDGPU_TARGETS})
target_link_libraries(${test_name} --amdgpu-target=${amdgpu_target})
Expand Down Expand Up @@ -116,7 +116,7 @@ foreach(test_src ${hipRAND_TEST_SRCS})
if(TARGET hip::device)
target_link_libraries(${test_name} hip::device)
else()
target_link_libraries(${test_name} hip::hip_hcc hip::hip_device)
target_link_libraries(${test_name} hip::device )
endif()
foreach(amdgpu_target ${AMDGPU_TARGETS})
target_link_libraries(${test_name} --amdgpu-target=${amdgpu_target})
Expand Down
2 changes: 1 addition & 1 deletion test/crush/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ foreach(crush_test_src ${rocRAND_CRUSH_TEST_SRCS})
else()
target_link_libraries(${crush_test_name}
rocrand
hip::hip_hcc hip::hip_device
hip::device
${TestU01_LIBRARIES}
)
endif()
Expand Down
4 changes: 2 additions & 2 deletions test/linkage/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function(add_rocrand_link_test TEST_SOURCES)
if(TARGET hip::device)
target_link_libraries(${TEST_TARGET} hip::device)
else()
target_link_libraries(${TEST_TARGET} hip::hip_hcc hip::hip_device)
target_link_libraries(${TEST_TARGET} hip::device )
endif()
foreach(amdgpu_target ${AMDGPU_TARGETS})
target_link_libraries(${TEST_TARGET} --amdgpu-target=${amdgpu_target})
Expand Down Expand Up @@ -101,7 +101,7 @@ function(add_hiprand_link_test TEST_SOURCES)
if(TARGET hip::device)
target_link_libraries(${TEST_TARGET} hip::device)
else()
target_link_libraries(${TEST_TARGET} hip::hip_hcc hip::hip_device)
target_link_libraries(${TEST_TARGET} hip::device )
endif()
foreach(amdgpu_target ${AMDGPU_TARGETS})
target_link_libraries(${TEST_TARGET} --amdgpu-target=${amdgpu_target})
Expand Down

0 comments on commit 4526aa2

Please sign in to comment.