Skip to content

Commit d216c28

Browse files
q10facebook-github-bot
authored andcommitted
Support ROCm 6.4 builds, pt 2 (#4151)
Summary: X-link: facebookresearch/FBGEMM#1233 Pull Request resolved: #4151 - Support ROCm 6.4 builds, pt 2 Reviewed By: jwfromm, spcyppt Differential Revision: D75008423 fbshipit-source-id: edf076f532ff2251ecf12ecd492bce918c022593
1 parent 157e88b commit d216c28

File tree

5 files changed

+34
-20
lines changed

5 files changed

+34
-20
lines changed

.github/scripts/fbgemm_gpu_build.bash

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ prepare_fbgemm_gpu_build () {
3939
echo "[BUILD] Running git submodules update ..."
4040
(exec_with_retries 3 git submodule sync) || return 1
4141
(exec_with_retries 3 git submodule update --init --recursive) || return 1
42+
echo "[BUILD] Successfully ran git submodules update"
4243

4344
# shellcheck disable=SC2155
4445
local env_prefix=$(env_name_or_prefix "${env_name}")
@@ -54,7 +55,16 @@ prepare_fbgemm_gpu_build () {
5455
# shellcheck disable=SC2086
5556
(test_python_import_package "${env_name}" skbuild) || return 1
5657

57-
echo "[BUILD] Successfully ran git submodules update"
58+
# shellcheck disable=SC2155,SC2086
59+
local conda_prefix=$(conda run ${env_prefix} printenv CONDA_PREFIX)
60+
61+
echo "[BUILD] Finding library paths ..."
62+
# shellcheck disable=SC2061,SC2035
63+
(find "${conda_prefix}" -name *omp.so* 2> /dev/null || true)
64+
# shellcheck disable=SC2061,SC2035
65+
(find "${conda_prefix}" -name *tbb.so* 2> /dev/null || true)
66+
# shellcheck disable=SC2061,SC2035
67+
(find "${conda_prefix}" -name *bolt.so* 2> /dev/null || true)
5868
}
5969

6070
__configure_fbgemm_gpu_build_clang () {
@@ -599,7 +609,7 @@ __verify_library_symbols () {
599609
fbgemm_gpu::jagged_2d_to_dense
600610
)
601611

602-
if [ "${fbgemm_build_variant}" == "cuda" ] &&
612+
if [ "${fbgemm_build_variant}" == "cuda" ] ||
603613
[ "${fbgemm_build_variant}" == "rocm" ]; then
604614
lib_symbols_to_check+=(
605615
fbgemm_gpu::asynchronous_inclusive_cumsum_gpu

.github/scripts/utils_build.bash

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,6 @@ __conda_install_glibc () {
8888
(exec_with_retries 3 conda install ${env_prefix} -c conda-forge --override-channels -y \
8989
"libstdcxx-ng=${gcc_version}") || return 1
9090
fi
91-
92-
# Ensure libstdc++.so.6 is found
93-
# shellcheck disable=SC2153
94-
# (test_filepath "${env_name}" 'libstdc++.so.6') || return 1
9591
}
9692

9793
__set_glibcxx_preload () {

.github/workflows/fbgemm_gpu_ci_rocm.yml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,6 @@ jobs:
120120
if: ${{ success() || failure() }}
121121
run: if . $PRELUDE && which conda; then collect_pytorch_env_info $BUILD_ENV; fi
122122

123-
- name: Find OpenMP Libraries
124-
run: |
125-
find / -name *omp.so* 2> /dev/null || true
126-
find / -name *tbb.so* 2> /dev/null || true
127-
find / -name *bolt.so* 2> /dev/null || true
128-
129123
- name: Prepare FBGEMM_GPU Build
130124
run: . $PRELUDE; cd fbgemm_gpu; prepare_fbgemm_gpu_build $BUILD_ENV
131125

@@ -221,12 +215,6 @@ jobs:
221215
- name: Prepare FBGEMM_GPU Build
222216
run: . $PRELUDE; cd fbgemm_gpu; prepare_fbgemm_gpu_build $BUILD_ENV
223217

224-
- name: Find OpenMP Libraries
225-
run: |
226-
find / -name *omp.so* 2> /dev/null || true
227-
find / -name *tbb.so* 2> /dev/null || true
228-
find / -name *bolt.so* 2> /dev/null || true
229-
230218
- name: Install FBGEMM_GPU Wheel
231219
run: . $PRELUDE; install_fbgemm_gpu_wheel $BUILD_ENV *.whl
232220

fbgemm_gpu/docs/src/fbgemm_gpu/development/BuildInstructions.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,7 @@ Install the other necessary build tools such as ``ninja``, ``cmake``, etc:
354354
ninja \
355355
numpy \
356356
scikit-build \
357+
tbb \
357358
wheel
358359
359360
.. _fbgemm-gpu.build.setup.pytorch.install:
@@ -675,6 +676,9 @@ presuming the toolchains have been properly installed.
675676
676677
export ROCM_PATH=/path/to/rocm
677678
679+
# [OPTIONAL] If libtbb.so is missing, create the symlink (presuming libtbb.so.12 is present)
680+
ln -s "${CONDA_PREFIX}/lib/libtbb.so.12" "${CONDA_PREFIX}/lib/libtbb.so"
681+
678682
# [OPTIONAL] Enable verbose HIPCC logs
679683
export HIPCC_VERBOSE=1
680684

fbgemm_gpu/setup.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ def _get_cxx11_abi():
323323
+ (
324324
# Starting from ROCm 6.4, HIP clang complains about
325325
# -fopenmp=libgomp being an invalid fopenmp-target
326-
["-ltbb"]
326+
[]
327327
if self.variant() == "rocm"
328328
else ["-fopenmp=libgomp"]
329329
)
@@ -337,7 +337,23 @@ def _get_cxx11_abi():
337337
)
338338

339339
if self.variant() == "rocm":
340-
cxx_flags.extend([f"-DROCM_VERSION={RocmUtils.version_int()}"])
340+
cxx_flags.extend(
341+
[
342+
f"-DROCM_VERSION={RocmUtils.version_int()}",
343+
]
344+
)
345+
346+
if self.nova_flag() is None:
347+
cxx_flags.extend(
348+
[
349+
# For the ROCm case on non-Nova, an explicit link to
350+
# libtbb is required, or the following error is
351+
# encountered on library load:
352+
#
353+
# undefined symbol: _ZN3tbb6detail2r117deallocate_memoryEPv
354+
"-ltbb",
355+
]
356+
)
341357

342358
cmake_args.extend(
343359
[

0 commit comments

Comments
 (0)