Skip to content

Commit

Permalink
rocAL HIP GPU backend- switch to object library for the HIP rocAL ker…
Browse files Browse the repository at this point in the history
…nels (#660)
  • Loading branch information
AryanSalmanpour authored Oct 25, 2021
1 parent 5242204 commit 334e287
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
2 changes: 1 addition & 1 deletion rocAL/rocAL/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ if(${BUILD_RALI})
endif()

if("${BACKEND}" STREQUAL "HIP" AND HIP_FOUND)
target_link_libraries(${PROJECT_NAME} rocAL_hip)
target_link_libraries(${PROJECT_NAME} $<TARGET_OBJECTS:rocAL_hip>)
endif()

install(TARGETS rali DESTINATION lib)
Expand Down
21 changes: 9 additions & 12 deletions rocAL/rocAL/rocAL_hip/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,15 @@
cmake_minimum_required(VERSION 3.5)
project(rocAL_hip CXX)

set(RALIHIP_SOURCES
set(rocAL_HIP_SOURCES
rali_hip_kernels.cpp
)

if(HIP_COMPILER STREQUAL clang)
set(hip_library_name amdhip64)
endif()
#message("HIP library name: ${hip_library_name}")

set_source_files_properties(${RALIHIP_SOURCES} PROPERTIES HIP_SOURCE_PROPERTY_FORMAT 1)
set(HIP_HCC_FLAGS -std=c++14)
hip_add_library(${PROJECT_NAME} ${RALIHIP_SOURCES} HIPCC_OPTIONS "${HIP_HCC_FLAGS}" SHARED)
target_compile_definitions(${PROJECT_NAME} PRIVATE)
message("-- CMake CXX Compiler " ${CMAKE_CXX_COMPILER})
install(TARGETS ${PROJECT_NAME} DESTINATION lib)
set_source_files_properties(${rocAL_HIP_SOURCES} PROPERTIES HIP_SOURCE_PROPERTY_FORMAT 1)
set(HIP_CXX_FLAGS -std=c++14)
set(COMPILER_FOR_HIP ${ROCM_PATH}/bin/hipcc)
set(CMAKE_CXX_COMPILER ${COMPILER_FOR_HIP})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${HIP_CXX_FLAGS}")
add_library(${PROJECT_NAME} OBJECT ${rocAL_HIP_SOURCES})
set_target_properties(${PROJECT_NAME} PROPERTIES POSITION_INDEPENDENT_CODE ON)
target_compile_definitions(${PROJECT_NAME} PRIVATE __HIP_PLATFORM_HCC__)

0 comments on commit 334e287

Please sign in to comment.