Skip to content

Commit 4e03118

Browse files
q10meta-codesync[bot]
authored andcommitted
Update default target ROCm architectures in OSS build (#5219)
Summary: X-link: https://github.com/facebookresearch/FBGEMM/pull/2216 Pull Request resolved: #5219 - Update default target ROCm architectures in OSS builds Reviewed By: jwfromm Differential Revision: D88923679 fbshipit-source-id: 811f6a9c6a1eb22e5601bfb5865352c18a7b2b7e
1 parent 79697bd commit 4e03118

File tree

2 files changed

+39
-2
lines changed

2 files changed

+39
-2
lines changed

.github/scripts/fbgemm_gpu_build.bash

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,13 +222,17 @@ __configure_fbgemm_gpu_build_rocm () {
222222
# the value set to 0), we are building in Nova. Nova machines take much
223223
# longer time to build FBGEMM_GPU for ROCm, so we have to limit to just the
224224
# latest model.
225-
echo "[BUILD] Building in Nova environment, ignoring the provided PYTORCH_ROCM_ARCH list and limiting ROCm targets ..."
225+
echo "[BUILD] Building in Nova environment, which is resource-constrained - will be ignoring the provided PYTORCH_ROCM_ARCH list and limiting ROCm targets ..."
226226
local arch_list="gfx942"
227227

228228
else
229229
# If BUILD_FROM_NOVA is unset, then we are building from a compute host with
230230
# sufficient resources, so we can build for more AMD Instinct architectures.
231-
local arch_list="gfx908,gfx90a,gfx942"
231+
if [[ ${rocm_version_arr[0]} -ge 7 ]]; then
232+
local arch_list="gfx908,gfx90a,gfx942,gfx950"
233+
else
234+
local arch_list="gfx908,gfx90a,gfx942"
235+
fi
232236
fi
233237

234238
echo "[BUILD] Setting the following ROCm targets: ${arch_list}"

.github/scripts/utils_base.bash

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,3 +298,36 @@ set_clang_symlinks () {
298298
print_exec ln -sf "${cxx_path}" "$(dirname "$cxx_path")/c++"
299299
print_exec ln -sf "${cxx_path}" "$(dirname "$cxx_path")/g++"
300300
}
301+
302+
__fetch_cuda_version_array () {
303+
local env_name="$1"
304+
# shellcheck disable=SC2155
305+
local env_prefix=$(env_name_or_prefix "${env_name}")
306+
307+
# shellcheck disable=SC2155,SC2086
308+
local cuda_version=$(conda run ${env_prefix} nvcc --version | sed -n 's/^.*release \([0-9]\+\.[0-9]\+\).*$/\1/p')
309+
echo "[INFO] Extracted CUDA version: ${cuda_version}"
310+
311+
# shellcheck disable=SC2206
312+
export cuda_version_arr=(${cuda_version//./ })
313+
}
314+
315+
__fetch_rocm_version_array () {
316+
local env_name="$1"
317+
# shellcheck disable=SC2155
318+
local env_prefix=$(env_name_or_prefix "${env_name}")
319+
320+
# shellcheck disable=SC2155,SC2086
321+
local rocm_version=$(conda run ${env_prefix} python -c "import torch; print(torch.version.hip)" 2>/dev/null)
322+
323+
if [ -n "$rocm_version" ] && [ "$rocm_version" != "None" ]; then
324+
echo "[INFO] Extracted ROCm version: ${rocm_version}"
325+
# Extract version numbers (e.g., "5.7.0" -> array of [5, 7, 0])
326+
IFS='.' read -ra rocm_version_arr <<< "$rocm_version"
327+
export rocm_version_arr=(${rocm_version//./ })
328+
329+
else
330+
echo "[INFO] Could not extract ROCm version!"
331+
return 1
332+
fi
333+
}

0 commit comments

Comments
 (0)