Skip to content

Commit e08026d

Browse files
dmikushinpytorchmergebot
authored andcommitted
Use miopen_LIBRARIES and rccl_LIBRARIES directly, when they are valid target (pytorch#80446)
As of [this RCCL PR](ROCm/rccl#570), `${rccl_LIBRARIES}` refers to the actual RCCL library target, not just a symbolic "rccl" string. So starting from the next release, no special treatment of it would be required in PyTorch anymore. This patch checks whether `${RCCL_LIBRARIES}` and `${MIOpen_LIBRARIES}` are already valid, and if they are - is not trying to find them manually. Pull Request resolved: pytorch#80446 Approved by: https://github.com/pruthvistony, https://github.com/malfet
1 parent 91b0250 commit e08026d

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

cmake/public/LoadHIP.cmake

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,10 +300,18 @@ if(HIP_FOUND)
300300
find_library(PYTORCH_HIP_HCC_LIBRARIES ${hip_library_name} HINTS ${HIP_PATH}/lib)
301301
# TODO: miopen_LIBRARIES should return fullpath to the library file,
302302
# however currently it's just the lib name
303-
find_library(PYTORCH_MIOPEN_LIBRARIES ${miopen_LIBRARIES} HINTS ${MIOPEN_PATH}/lib)
303+
if(TARGET ${miopen_LIBRARIES})
304+
set(PYTORCH_MIOPEN_LIBRARIES ${miopen_LIBRARIES})
305+
else()
306+
find_library(PYTORCH_MIOPEN_LIBRARIES ${miopen_LIBRARIES} HINTS ${MIOPEN_PATH}/lib)
307+
endif()
304308
# TODO: rccl_LIBRARIES should return fullpath to the library file,
305309
# however currently it's just the lib name
306-
find_library(PYTORCH_RCCL_LIBRARIES ${rccl_LIBRARIES} HINTS ${RCCL_PATH}/lib)
310+
if(TARGET ${rccl_LIBRARIES})
311+
set(PYTORCH_RCCL_LIBRARIES ${rccl_LIBRARIES})
312+
else()
313+
find_library(PYTORCH_RCCL_LIBRARIES ${rccl_LIBRARIES} HINTS ${RCCL_PATH}/lib)
314+
endif()
307315
# hiprtc is part of HIP
308316
find_library(ROCM_HIPRTC_LIB ${hip_library_name} HINTS ${HIP_PATH}/lib)
309317
# roctx is part of roctracer

0 commit comments

Comments
 (0)