diff --git a/next/0001-use-any-hip.patch b/next/0001-use-any-hip.patch new file mode 100644 index 0000000..dca86ea --- /dev/null +++ b/next/0001-use-any-hip.patch @@ -0,0 +1,34 @@ +From 4248211ce9a9de81bb3ade5d421ba709b19ead08 Mon Sep 17 00:00:00 2001 +From: Tom Rix +Date: Sat, 3 Feb 2024 15:01:28 -0500 +Subject: [PATCH] use any hip + +--- + cmake/public/LoadHIP.cmake | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/cmake/public/LoadHIP.cmake b/cmake/public/LoadHIP.cmake +index 1abeb06228..28458c4146 100644 +--- a/cmake/public/LoadHIP.cmake ++++ b/cmake/public/LoadHIP.cmake +@@ -30,7 +30,7 @@ endif() + message("Building PyTorch for GPU arch: ${PYTORCH_ROCM_ARCH}") + + # Add HIP to the CMAKE Module Path +-set(CMAKE_MODULE_PATH ${ROCM_PATH}/lib/cmake/hip ${CMAKE_MODULE_PATH}) ++set(CMAKE_MODULE_PATH ${ROCM_PATH}/lib64/cmake/hip ${CMAKE_MODULE_PATH}) + + macro(find_package_and_print_version PACKAGE_NAME) + find_package("${PACKAGE_NAME}" ${ARGN}) +@@ -38,7 +38,7 @@ macro(find_package_and_print_version PACKAGE_NAME) + endmacro() + + # Find the HIP Package +-find_package_and_print_version(HIP 1.0) ++find_package_and_print_version(HIP MODULE) + + if(HIP_FOUND) + set(PYTORCH_FOUND_HIP TRUE) +-- +2.43.0 + diff --git a/python-torch.spec b/python-torch.spec index a99d278..b164f97 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -61,6 +61,7 @@ Patch5: 0001-disable-submodule-search.patch Patch100: 0001-cuda-hip-signatures.patch Patch101: 0001-silence-an-assert.patch Patch102: 0001-can-not-use-with-c-files.patch +Patch103: 0001-use-any-hip.patch %endif %else @@ -325,6 +326,7 @@ export USE_NCCL=OFF export BUILD_NVFUSER=OFF export HIP_PATH=%{_prefix} export ROCM_PATH=%{_prefix} +export DEVICE_LIB_PATH=/usr/lib/clang/17/amdgcn/bitcode %else export USE_ROCM=OFF %endif @@ -343,6 +345,13 @@ export USE_XNNPACK=ON %py3_build %install +%if %{with rocm} +export USE_ROCM=ON +export HIP_PATH=%{_prefix} +export ROCM_PATH=%{_prefix} +export DEVICE_LIB_PATH=/usr/lib/clang/17/amdgcn/bitcode +%endif + %py3_install # empty files @@ -403,6 +412,11 @@ sed -i -f br.sed devel.files %{python3_sitearch}/torch/lib/libtorch_cpu.so %{python3_sitearch}/torch/lib/libtorch_global_deps.so %{python3_sitearch}/torch/lib/libtorch_python.so +%if %{with rocm} +%{python3_sitearch}/torch/lib/libc10_hip.so +%{python3_sitearch}/torch/lib/libcaffe2_nvrtc.so +%{python3_sitearch}/torch/lib/libtorch_hip.so +%endif # misc %{python3_sitearch}/torch/utils/model_dump/{*.js,*.mjs,*.html}