Skip to content

Commit c13cad7

Browse files
authored
Merge pull request #32 from Jorghi12/rocm_forked_branch
Minor changes to ROCm PyTorch
2 parents 33ebb58 + 9f3fb17 commit c13cad7

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

.jenkins/pytorch/build.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,18 @@ cmake --version
3030
pip install -r requirements.txt || true
3131

3232
if [[ "$BUILD_ENVIRONMENT" == *rocm* ]]; then
33+
# This is necessary in order to cross compile (or else we'll have missing GPU device).
3334
export HCC_AMDGPU_TARGET=gfx900
35+
36+
# These environment variables are not set on CI when we were running as the Jenkins user.
37+
# The HIP Utility scripts require these environment variables to be set in order to run without error.
3438
export LANG=C.UTF-8
3539
export LC_ALL=C.UTF-8
3640

41+
# This environment variable enabled HCC Optimizations that speed up the linking stage.
42+
# https://github.com/RadeonOpenCompute/hcc#hcc-with-thinlto-linking
43+
# export KMTHINLTO=1
44+
3745
sudo chown -R jenkins:jenkins /usr/local
3846
rm -rf "$(dirname "${BASH_SOURCE[0]}")/../../../pytorch_amd/" || true
3947
python "$(dirname "${BASH_SOURCE[0]}")/../../tools/amd_build/build_pytorch_amd.py"

caffe2/CMakeLists.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -273,9 +273,8 @@ if(USE_ROCM)
273273
target_include_directories(caffe2_hip PRIVATE ${Caffe2_HIP_INCLUDES})
274274
target_include_directories(caffe2_hip INTERFACE $<INSTALL_INTERFACE:include>)
275275

276-
IF(BUILD_ATEN)
277-
aten_set_target_props(caffe2_hip)
278-
ENDIF()
276+
# Set standard properties on the target
277+
aten_set_target_props(caffe2_hip)
279278

280279
# When a library has object files that contain device code, it needs to use hipcc/hcc to link.
281280
set_target_properties(caffe2_hip PROPERTIES LINKER_LANGUAGE HIP)

cmake/public/LoadHIP.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,16 @@ FIND_PACKAGE(HIP 1.0)
102102
IF(HIP_FOUND)
103103
set(PYTORCH_FOUND_HIP TRUE)
104104

105+
### Remove setting of Flags when FindHIP.CMake PR #558 is accepted.###
106+
# https://github.com/ROCm-Developer-Tools/HIP/pull/558 #
105107
set(CMAKE_SHARED_LIBRARY_SONAME_HIP_FLAG ${CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG})
106108
set(CMAKE_HIP_LINK_EXECUTABLE "${HIP_HIPCC_CMAKE_LINKER_HELPER} ${HCC_PATH} <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>" )
107109
set(CMAKE_HIP_CREATE_SHARED_LIBRARY "${HIP_HIPCC_CMAKE_LINKER_HELPER} ${HCC_PATH} <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <LINK_LIBRARIES> -shared" )
108110
set(CMAKE_HIP_CREATE_SHARED_MODULE "${HIP_HIPCC_CMAKE_LINKER_HELPER} ${HCC_PATH} <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <LINK_LIBRARIES> -shared" )
109111
set(CMAKE_HIP_ARCHIVE_CREATE ${CMAKE_CXX_ARCHIVE_CREATE})
110112
set(CMAKE_HIP_ARCHIVE_APPEND ${CMAKE_CXX_ARCHIVE_APPEND})
111113
set(CMAKE_HIP_ARCHIVE_FINISH ${CMAKE_CXX_ARCHIVE_FINISH})
114+
### Remove setting of Flags when FindHIP.CMake PR #558 is accepted.###
112115

113116
set(rocrand_DIR ${ROCRAND_PATH}/lib/cmake/rocrand)
114117
set(hiprand_DIR ${HIPRAND_PATH}/lib/cmake/hiprand)

0 commit comments

Comments
 (0)