[ROCm] Load ROCm if Torch is used as a dependency (#80469)

Includes LoadHIP.cmake if pytorch is used as a dependency for another project and ROCm is enabled. This removes the need to explicitly link against ROCm libraries in extension projects.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/80469
Approved by: https://github.com/pruthvistony, https://github.com/malfet
This commit is contained in:
Ronak Malik
2022-07-05 21:04:06 +00:00
committed by PyTorch MergeBot
parent 6bf4c662c8
commit d03f989d53
2 changed files with 5 additions and 0 deletions

View File

@ -1095,6 +1095,7 @@ if(BUILD_SHARED_LIBS)
${PROJECT_SOURCE_DIR}/cmake/public/protobuf.cmake
${PROJECT_SOURCE_DIR}/cmake/public/threads.cmake
${PROJECT_SOURCE_DIR}/cmake/public/utils.cmake
${PROJECT_SOURCE_DIR}/cmake/public/LoadHIP.cmake
DESTINATION share/cmake/Caffe2/public
COMPONENT dev)
install(DIRECTORY

View File

@ -78,6 +78,10 @@ else()
endif()
endif()
if (@USE_ROCM@)
include("${CMAKE_CURRENT_LIST_DIR}/public/LoadHIP.cmake")
endif()
if(@USE_CUDA@)
# The file public/cuda.cmake exclusively uses CAFFE2_USE_*.
# If Caffe2 was compiled with the libraries below, they must