Skip to content

Commit d5e08a1

Browse files
jataylopruthvistonyjithunnair-amd
authored
[ROCm] support for rocm5.3 wheel builds (#1160)
* Updates to support rocm5.3 wheel builds (#6) * Changes to support ROCm 5.3 * Updated as per comments * Installing python before magma build - In ROCm 5.3 libtorch build are failing during magma build due to to missing python binary so added install statement * Move python install to libtorch/Dockerfile (#8) * Updating the condition for noRCCL build (#9) * Updating the condition for noRCCL build * Updated changes as per comments * Use MIOpen branch for ROCm5.3; Change all conditions to -eq * Use staging branch of MIOpen for ROCm5.3 * Fix merge conflict Fix merge conflict Co-authored-by: Pruthvi Madugundu <[email protected]> Co-authored-by: Pruthvi Madugundu <[email protected]> Co-authored-by: Jithun Nair <[email protected]> Co-authored-by: Jithun Nair <[email protected]>
1 parent c4392a8 commit d5e08a1

File tree

4 files changed

+101
-12
lines changed

4 files changed

+101
-12
lines changed

common/install_miopen.sh

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,23 +59,26 @@ MIOPEN_CMAKE_COMMON_FLAGS="
5959
-DMIOPEN_BUILD_DRIVER=OFF
6060
"
6161
# Pull MIOpen repo and set DMIOPEN_EMBED_DB based on ROCm version
62-
if [[ $ROCM_INT -ge 50200 ]]; then
63-
MIOPEN_CMAKE_DB_FLAGS="-DMIOPEN_EMBED_DB=gfx900_56;gfx906_60;gfx90878;gfx90a6e;gfx1030_36"
62+
if [[ $ROCM_INT -eq 50300 ]]; then
63+
MIOPEN_CMAKE_DB_FLAGS="-DMIOPEN_EMBED_DB=gfx900_56;gfx906_60;gfx90878;gfx90a6e;gfx1030_36 -DMIOPEN_USE_MLIR=Off"
64+
MIOPEN_BRANCH="release/rocm-rel-5.3-staging"
65+
elif [[ $ROCM_INT -eq 50200 ]]; then
66+
MIOPEN_CMAKE_DB_FLAGS="-DMIOPEN_EMBED_DB=gfx900_56;gfx906_60;gfx90878;gfx90a6e;gfx1030_36 -DMIOPEN_USE_MLIR=Off"
6467
MIOPEN_BRANCH="release/rocm-rel-5.2-staging"
65-
elif [[ $ROCM_INT -ge 50100 ]]; then
68+
elif [[ $ROCM_INT -eq 50100 ]]; then
6669
MIOPEN_CMAKE_DB_FLAGS="-DMIOPEN_EMBED_DB=gfx900_56;gfx906_60;gfx90878;gfx90a6e;gfx1030_36"
6770
MIOPEN_BRANCH="release/rocm-rel-5.1-staging"
68-
elif [[ $ROCM_INT -ge 50000 ]]; then
71+
elif [[ $ROCM_INT -eq 50000 ]]; then
6972
MIOPEN_CMAKE_DB_FLAGS="-DMIOPEN_EMBED_DB=gfx900_56;gfx906_60;gfx90878;gfx90a6e;gfx1030_36"
7073
MIOPEN_BRANCH="release/rocm-rel-5.0-staging"
71-
elif [[ $ROCM_INT -ge 40500 ]]; then
74+
elif [[ $ROCM_INT -eq 40500 ]]; then
7275
MIOPEN_CMAKE_COMMON_FLAGS="${MIOPEN_CMAKE_COMMON_FLAGS} -DMIOPEN_USE_HIP_KERNELS=Off -DMIOPEN_DEFAULT_FIND_MODE=Normal"
7376
MIOPEN_CMAKE_DB_FLAGS="-DMIOPEN_EMBED_DB=gfx900_56;gfx906_60;gfx90878;gfx90a6e;gfx1030_36"
7477
MIOPEN_BRANCH="release/rocm-rel-4.5-staging"
75-
elif [[ $ROCM_INT -ge 40300 ]]; then
78+
elif [[ $ROCM_INT -eq 40300 ]]; then
7679
MIOPEN_CMAKE_DB_FLAGS="-DMIOPEN_EMBED_DB=gfx900_56;gfx900_64;gfx906_60;gfx906_64;gfx90878;gfx1030_36"
7780
MIOPEN_BRANCH="release/rocm-rel-4.3-staging"
78-
elif [[ $ROCM_INT -ge 40200 ]]; then
81+
elif [[ $ROCM_INT -eq 40200 ]]; then
7982
MIOPEN_CMAKE_DB_FLAGS="-DMIOPEN_EMBED_DB=gfx803_36;gfx803_64;gfx900_56;gfx900_64;gfx906_60;gfx906_64;gfx90878"
8083
MIOPEN_BRANCH="rocm-4.2.x-staging"
8184
else

libtorch/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,10 @@ ENV MKLROOT /opt/intel
7171
ADD ./common/install_rocm.sh install_rocm.sh
7272
ADD ./common/install_rocm_drm.sh install_rocm_drm.sh
7373
ADD ./common/install_rocm_magma.sh install_rocm_magma.sh
74-
# gfortran needed for building magma from source for ROCm
74+
# gfortran and python needed for building magma from source for ROCm
7575
RUN apt-get update -y && \
7676
apt-get install gfortran -y && \
77+
apt-get install python -y && \
7778
apt-get clean
7879

7980
FROM rocm as rocm5.1.1

manywheel/build_common.sh

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,11 +162,23 @@ else
162162
echo "BUILD_DEBUG_INFO was not set, skipping debug info"
163163
fi
164164

165+
if [[ "$DISABLE_RCCL" = 1 ]]; then
166+
echo "Disabling NCCL/RCCL in pyTorch"
167+
USE_RCCL=0
168+
USE_NCCL=0
169+
USE_KINETO=0
170+
else
171+
USE_RCCL=1
172+
USE_NCCL=1
173+
USE_KINETO=1
174+
fi
175+
165176
echo "Calling setup.py bdist at $(date)"
166177
time CMAKE_ARGS=${CMAKE_ARGS[@]} \
167-
EXTRA_CAFFE2_CMAKE_FLAGS=${EXTRA_CAFFE2_CMAKE_FLAGS[@]} \
168-
BUILD_LIBTORCH_CPU_WITH_DEBUG=$BUILD_DEBUG_INFO \
169-
python setup.py bdist_wheel -d /tmp/$WHEELHOUSE_DIR
178+
EXTRA_CAFFE2_CMAKE_FLAGS=${EXTRA_CAFFE2_CMAKE_FLAGS[@]} \
179+
BUILD_LIBTORCH_CPU_WITH_DEBUG=$BUILD_DEBUG_INFO \
180+
USE_NCCL=${USE_NCCL} USE_RCCL=${USE_RCCL} USE_KINETO=${USE_KINETO} \
181+
python setup.py bdist_wheel -d /tmp/$WHEELHOUSE_DIR
170182
echo "Finished setup.py bdist at $(date)"
171183

172184
# Build libtorch packages

manywheel/build_rocm.sh

Lines changed: 74 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,80 @@ else
8989
fi
9090
ROCM_INT=$(($ROCM_VERSION_MAJOR * 10000 + $ROCM_VERSION_MINOR * 100 + $ROCM_VERSION_PATCH))
9191

92-
if [[ $ROCM_INT -ge 50200 ]]; then
92+
if [[ $ROCM_INT -ge 50300 ]]; then
93+
DEPS_LIST=(
94+
"/opt/rocm/lib/libMIOpen.so.1"
95+
"/opt/rocm/lib/libamdhip64.so.5"
96+
"/opt/rocm/lib/libhipblas.so.0"
97+
"/opt/rocm/lib/libhipfft.so"
98+
"/opt/rocm/lib/libhiprand.so.1"
99+
"/opt/rocm/lib/libhipsparse.so.0"
100+
"/opt/rocm/lib/libhsa-runtime64.so.1"
101+
"/opt/rocm/lib/libamd_comgr.so.2"
102+
"/opt/rocm/magma/lib/libmagma.so"
103+
"/opt/rocm/lib/librccl.so.1"
104+
"/opt/rocm/lib/librocblas.so.0"
105+
"/opt/rocm/lib/librocfft-device-0.so.0"
106+
"/opt/rocm/lib/librocfft-device-1.so.0"
107+
"/opt/rocm/lib/librocfft-device-2.so.0"
108+
"/opt/rocm/lib/librocfft-device-3.so.0"
109+
"/opt/rocm/lib/librocfft.so.0"
110+
"/opt/rocm/lib/librocm_smi64.so.5"
111+
"/opt/rocm/lib/librocrand.so.1"
112+
"/opt/rocm/lib/librocsolver.so.0"
113+
"/opt/rocm/lib/librocsparse.so.0"
114+
"/opt/rocm/lib/libroctracer64.so.4"
115+
"/opt/rocm/lib/libroctx64.so.4"
116+
"$LIBGOMP_PATH"
117+
"$LIBNUMA_PATH"
118+
"$LIBELF_PATH"
119+
"$LIBTINFO_PATH"
120+
"$LIBDRM_PATH"
121+
"$LIBDRM_AMDGPU_PATH"
122+
)
123+
124+
DEPS_SONAME=(
125+
"libMIOpen.so.1"
126+
"libamdhip64.so.5"
127+
"libhipblas.so.0"
128+
"libhipfft.so"
129+
"libhiprand.so.1"
130+
"libhipsparse.so.0"
131+
"libhsa-runtime64.so.1"
132+
"libamd_comgr.so.2"
133+
"libmagma.so"
134+
"librccl.so.1"
135+
"librocblas.so.0"
136+
"librocfft-device-0.so.0"
137+
"librocfft-device-1.so.0"
138+
"librocfft-device-2.so.0"
139+
"librocfft-device-3.so.0"
140+
"librocfft.so.0"
141+
"librocm_smi64.so.5"
142+
"librocrand.so.1"
143+
"librocsolver.so.0"
144+
"librocsparse.so.0"
145+
"libroctracer64.so.4"
146+
"libroctx64.so.4"
147+
"libgomp.so.1"
148+
"libnuma.so.1"
149+
"libelf.so.1"
150+
"libtinfo.so.5"
151+
"libdrm.so.2"
152+
"libdrm_amdgpu.so.1"
153+
)
154+
155+
DEPS_AUX_SRCLIST=(
156+
"/opt/rocm/lib/rocblas/library/*"
157+
"/opt/amdgpu/share/libdrm/amdgpu.ids"
158+
)
159+
160+
DEPS_AUX_DSTLIST=(
161+
"lib/rocblas/library/."
162+
"share/libdrm/amdgpu.ids"
163+
)
164+
165+
elif [[ $ROCM_INT -ge 50200 ]]; then
93166
DEPS_LIST=(
94167
"/opt/rocm/lib/libMIOpen.so.1"
95168
"/opt/rocm/lib/libamdhip64.so.5"

0 commit comments

Comments
 (0)