mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 00:20:18 +01:00
Fix hardcoded ROCm paths in Caffe2Targets.cmake (#136283)
Fixes #131701 Use CMake imported targets more consistently to eliminate hardcode paths. Here is the new relevant sections of Caffe2Targets.cmake: ``` set_target_properties(c10_hip PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include" INTERFACE_LINK_LIBRARIES "c10;hip::amdhip64" ) ``` ``` set_target_properties(torch_hip PROPERTIES INTERFACE_COMPILE_DEFINITIONS "USE_C10D_NCCL" INTERFACE_COMPILE_OPTIONS "-fPIC;-D__HIP_PLATFORM_AMD__=1;-DCUDA_HAS_FP16=1;-DUSE_ROCM;-D__HIP_NO_HALF_OPERATORS__=1;-D__HIP_NO_HALF_CONVERSIONS__=1;-DTORCH_HIP_VERSION=602;-Wno-shift-count-negative;-Wno-shift-count-overflow;-Wno-duplicate-decl-specifier;-DCAFFE2_USE_MIOPEN;-DTHRUST_DEVICE_SYSTEM=THRUST_DEVICE_SYSTEM_HIP;-std=c++17;-DHIPBLAS_V2;-DHIP_NEW_TYPE_ENUMS" INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include" INTERFACE_LINK_LIBRARIES "c10_hip;torch_cpu_library;hip::amdhip64;MIOpen;hiprtc::hiprtc;roc::hipblaslt;roc::hipblas;hip::hipfft;hip::hiprand;roc::hipsparse;roc::hipsolver" ) ``` HIPCUB dependency was not actually used; which is why it is removed here as the imported target had undesirable side effects. Pull Request resolved: https://github.com/pytorch/pytorch/pull/136283 Approved by: https://github.com/jeffdaily, https://github.com/Skylion007, https://github.com/jithunnair-amd, https://github.com/atalman
This commit is contained in:
parent
f3dd1721f4
commit
e8f1dd6ba0
|
|
@ -48,9 +48,7 @@ if(NOT BUILD_LIBTORCHLESS)
|
|||
endif()
|
||||
|
||||
# ---[ Dependency of c10_hip
|
||||
target_link_libraries(c10_hip PUBLIC c10)
|
||||
|
||||
target_link_libraries(c10_hip PUBLIC ${PYTORCH_HIP_LIBRARIES})
|
||||
target_link_libraries(c10_hip PUBLIC ${C10_LIB} hip::amdhip64)
|
||||
|
||||
target_include_directories(
|
||||
c10_hip PUBLIC
|
||||
|
|
|
|||
|
|
@ -1093,8 +1093,8 @@ if(USE_ROCM)
|
|||
hip_include_directories(${Caffe2_HIP_INCLUDE})
|
||||
|
||||
set(Caffe2_PUBLIC_HIP_DEPENDENCY_LIBS
|
||||
${PYTORCH_HIP_LIBRARIES} ${PYTORCH_MIOPEN_LIBRARIES} ${hipcub_LIBRARIES} ${ROCM_HIPRTC_LIB} ${ROCM_ROCTX_LIB})
|
||||
list(APPEND Caffe2_PUBLIC_HIP_DEPENDENCY_LIBS ${hipblaslt_LIBRARIES})
|
||||
hip::amdhip64 MIOpen hiprtc::hiprtc) # libroctx will be linked in with MIOpen
|
||||
list(APPEND Caffe2_PUBLIC_HIP_DEPENDENCY_LIBS roc::hipblaslt)
|
||||
|
||||
list(APPEND Caffe2_PUBLIC_HIP_DEPENDENCY_LIBS
|
||||
roc::hipblas hip::hipfft hip::hiprand roc::hipsparse roc::hipsolver)
|
||||
|
|
|
|||
|
|
@ -146,6 +146,7 @@ if(HIP_FOUND)
|
|||
set(hipcub_DIR ${ROCM_PATH}/lib/cmake/hipcub)
|
||||
set(rocthrust_DIR ${ROCM_PATH}/lib/cmake/rocthrust)
|
||||
set(hipsolver_DIR ${ROCM_PATH}/lib/cmake/hipsolver)
|
||||
set(hiprtc_DIR ${ROCM_PATH}/lib/cmake/hiprtc)
|
||||
|
||||
|
||||
find_package_and_print_version(hip REQUIRED)
|
||||
|
|
@ -164,6 +165,7 @@ if(HIP_FOUND)
|
|||
find_package_and_print_version(hipcub REQUIRED)
|
||||
find_package_and_print_version(rocthrust REQUIRED)
|
||||
find_package_and_print_version(hipsolver REQUIRED)
|
||||
find_package_and_print_version(hiprtc REQUIRED)
|
||||
|
||||
|
||||
find_library(PYTORCH_HIP_LIBRARIES amdhip64 HINTS ${ROCM_PATH}/lib)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user