x
This commit is contained in:
+16
-5
@@ -188,17 +188,28 @@ RUN set -ex && \
|
||||
# roc::* 别名(PyTorch Caffe2Targets 直接引用 roc:: 命名空间的 hip 包名)
|
||||
for pair in \
|
||||
"hipblas:rocblas" "hiprand:rocrand" "hipsolver:rocsolver" \
|
||||
"hipsparse:rocsparse" "hipfft:rocfft" "hipcub:rocprim" \
|
||||
"hipblaslt:hipblaslt" "hiprtc:hiprtc"; \
|
||||
"hipsparse:rocsparse" "hipfft:rocfft" "hipcub:rocprim"; \
|
||||
do \
|
||||
hip_pkg="${pair%%:*}"; roc_pkg="${pair#*:}"; \
|
||||
cfg_dir="/opt/rocm/lib/cmake/${hip_pkg}"; \
|
||||
if [ -f "${cfg_dir}/${hip_pkg}-config.cmake" ]; then \
|
||||
if ! grep -q "roc::${hip_pkg}" "${cfg_dir}/${hip_pkg}-config.cmake" 2>/dev/null; then \
|
||||
printf 'if(TARGET hip::%s AND NOT TARGET roc::%s)\n add_library(roc::%s ALIAS hip::%s)\nendif()\n' \
|
||||
"${hip_pkg}" "${hip_pkg}" "${hip_pkg}" "${hip_pkg}" \
|
||||
printf 'if(TARGET roc::%s AND NOT TARGET roc::%s)\n add_library(roc::%s ALIAS roc::%s)\nendif()\n' \
|
||||
"${roc_pkg}" "${hip_pkg}" "${hip_pkg}" "${roc_pkg}" \
|
||||
>> "${cfg_dir}/${hip_pkg}-config.cmake" && \
|
||||
echo "roc::${hip_pkg} alias → ${hip_pkg}-config.cmake."; \
|
||||
echo "roc::${hip_pkg} → roc::${roc_pkg}."; \
|
||||
fi; \
|
||||
fi; \
|
||||
done && \
|
||||
# hipblaslt / hiprtc:底层是 INTERFACE IMPORTED(非 ALIAS),roc:: 直接指 hip::
|
||||
for pkg in hipblaslt hiprtc; do \
|
||||
cfg_dir="/opt/rocm/lib/cmake/${pkg}"; \
|
||||
if [ -f "${cfg_dir}/${pkg}-config.cmake" ]; then \
|
||||
if ! grep -q "roc::${pkg}" "${cfg_dir}/${pkg}-config.cmake" 2>/dev/null; then \
|
||||
printf 'if(TARGET hip::%s AND NOT TARGET roc::%s)\n add_library(roc::%s ALIAS hip::%s)\nendif()\n' \
|
||||
"${pkg}" "${pkg}" "${pkg}" "${pkg}" \
|
||||
>> "${cfg_dir}/${pkg}-config.cmake" && \
|
||||
echo "roc::${pkg} → hip::${pkg}."; \
|
||||
fi; \
|
||||
fi; \
|
||||
done && \
|
||||
|
||||
Reference in New Issue
Block a user