Skip to content

Commit e754b2d

Browse files
q10facebook-github-bot
authored andcommitted
Limit the number of ROCm hardware targets (pytorch#886)
Summary: Pull Request resolved: facebookresearch/FBGEMM#886 - Limit the number of ROCm hardware targets to reduce Nova ROCm build times X-link: pytorch#3797 Reviewed By: sryap Differential Revision: D70949678 Pulled By: q10 fbshipit-source-id: a14cc0f12c7988aa3e9b68549bad9d109f1d7ca6
1 parent e95ccaa commit e754b2d

File tree

3 files changed

+49
-3
lines changed

3 files changed

+49
-3
lines changed

.github/scripts/fbgemm_gpu_build.bash

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,12 +171,22 @@ __configure_fbgemm_gpu_build_rocm () {
171171
# cards, in which case the arch_list will be empty.
172172
echo "[BUILD] rocminfo did not return anything valid!"
173173

174-
# By default, we build just for MI100 and MI250 to save time. This list
175-
# needs to be updated if the CI ROCm machines have different hardware.
174+
# By default, we build for a limited number of architectures to save on
175+
# build time. This list needs to be updated if the CI ROCm machines
176+
# have different hardware.
176177
#
177178
# Architecture mapping can be found at:
178179
# https://rocm.docs.amd.com/en/latest/reference/gpu-arch-specs.html
179-
local arch_list="gfx908,gfx90a,gfx942"
180+
if [ -z "${BUILD_FROM_NOVA+x}" ]; then
181+
# If BUILD_FROM_NOVA is unset, then we are building from AMD host with
182+
# sufficient resources, so we can build for more architectures.
183+
local arch_list="gfx908,gfx90a,gfx942"
184+
else
185+
# If BUILD_FROM_NOVA is set (regardless of 0 or 1), we are building in
186+
# Nova. Nova machines take a longer time to build FBGEMM_GPU for
187+
# ROCm, so we limit to one architecture.
188+
local arch_list="gfx942"
189+
fi
180190
fi
181191
else
182192
echo "[BUILD] rocminfo not found in PATH!"

.github/scripts/nova_dir.bash

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ if [[ "$working_dir" == "$FBGEMM_REPO" ]]; then cd fbgemm_gpu || echo "Failed to
1313
## Build clean/wheel will be done in pre-script. Set flag such that setup.py will skip these steps in Nova workflow
1414
export BUILD_FROM_NOVA=1
1515

16+
if [[ "$CU_VERSION" == "cu"* ]]; then
17+
echo "Current TORCH_CUDA_ARCH_LIST value: ${TORCH_CUDA_ARCH_LIST}"
18+
elif [[ "$CU_VERSION" == "rocm"* ]]; then
19+
echo "Current PYTORCH_ROCM_ARCH value: ${PYTORCH_ROCM_ARCH}"
20+
fi
21+
1622
## Overwrite existing ENV VAR in Nova
1723
if [[ "$CONDA_ENV" != "" ]]; then export CONDA_RUN="conda run --no-capture-output -p ${CONDA_ENV}" && echo "$CONDA_RUN"; fi
1824

@@ -34,4 +40,20 @@ elif [[ "$CU_VERSION" == "cu"* ]]; then
3440
echo ""
3541
echo "Will default to the TORCH_CUDA_ARCH_LIST supplied by the environment!!!"
3642
echo "################################################################################"
43+
44+
elif [[ "$CU_VERSION" == "rocm6.3"* ]]; then
45+
export PYTORCH_ROCM_ARCH="gfx908,gfx90a,gfx942,gfx1201"
46+
echo "Set PYTORCH_ROCM_ARCH to: ${PYTORCH_ROCM_ARCH}"
47+
48+
elif [[ "$CU_VERSION" == "rocm6.2"* ]]; then
49+
export PYTORCH_ROCM_ARCH="gfx908,gfx90a,gfx942"
50+
echo "Set PYTORCH_ROCM_ARCH to: ${PYTORCH_ROCM_ARCH}"
51+
52+
elif [[ "$CU_VERSION" == "rocm"* ]]; then
53+
echo "################################################################################"
54+
echo "[NOVA] Currently building the ROCm variant, but the supplied CU_VERSION is"
55+
echo "unknown or not supported in FBGEMM_GPU: ${CU_VERSION}"
56+
echo ""
57+
echo "Will default to the PYTORCH_ROCM_ARCH supplied by the environment!!!"
58+
echo "################################################################################"
3759
fi

fbgemm_gpu/CMakeLists.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,20 @@ if(SKBUILD)
5959
BLOCK_PRINT("The project is built using scikit-build")
6060
endif()
6161

62+
BLOCK_PRINT(
63+
"Build Settings"
64+
""
65+
"NVCC_VERBOSE : ${NVCC_VERBOSE}"
66+
"CUDNN_INCLUDE_DIR : ${CUDNN_INCLUDE_DIR}"
67+
"CUDNN_LIBRARY : ${CUDNN_LIBRARY}"
68+
"NVML_LIB_PATH : ${NVML_LIB_PATH}"
69+
"TORCH_CUDA_ARCH_LIST : ${TORCH_CUDA_ARCH_LIST}"
70+
""
71+
"HIP_ROOT_DIR : ${HIP_ROOT_DIR}"
72+
"HIPCC_VERBOSE : ${HIPCC_VERBOSE}"
73+
"AMDGPU_TARGETS : ${AMDGPU_TARGETS}"
74+
"PYTORCH_ROCM_ARCH : ${PYTORCH_ROCM_ARCH}")
75+
6276
if(FBGEMM_CPU_ONLY OR USE_ROCM)
6377
project(
6478
fbgemm_gpu

0 commit comments

Comments
 (0)