This commit is contained in:
2026-06-09 10:29:11 +08:00
parent 0ab132a220
commit d4ce1d38f0
+17 -2
View File
@@ -179,11 +179,26 @@ RUN set -ex && \
for pkg in hipblaslt hiprtc; do \
cfg_dir="/opt/rocm/lib/cmake/${pkg}"; \
mkdir -p "${cfg_dir}" && \
printf 'set(%s_FOUND TRUE)\nset(%s_VERSION "7.2.1")\nif(NOT TARGET hip::%s)\n add_library(hip::%s INTERFACE IMPORTED)\n set_target_properties(hip::%s PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "/opt/rocm/include")\nendif()\nif(NOT TARGET %s::%s)\n add_library(%s::%s ALIAS hip::%s)\nendif()\n' \
printf 'set(%s_FOUND TRUE)\nset(%s_VERSION "7.2.1")\nif(NOT TARGET hip::%s)\n add_library(hip::%s INTERFACE IMPORTED)\n set_target_properties(hip::%s PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "/opt/rocm/include")\nendif()\nif(NOT TARGET %s::%s)\n add_library(%s::%s ALIAS hip::%s)\nendif()\nif(NOT TARGET roc::%s)\n add_library(roc::%s ALIAS hip::%s)\nendif()\n' \
"${pkg}" "${pkg}" "${pkg}" "${pkg}" "${pkg}" \
"${pkg}" "${pkg}" "${pkg}" "${pkg}" "${pkg}" \
"${pkg}" "${pkg}" \
> "${cfg_dir}/${pkg}-config.cmake" && \
echo "${pkg}-config.cmake created (minimal + namespace alias)."; \
echo "${pkg}-config.cmake created (hip:: + ${pkg}:: + roc:: aliases)."; \
done && \
# roc::hiprand / roc::hipsolver / roc::hipsparse / roc::hipfft 别名(PyTorch Caffe2Targets 直接引用 roc:: 命名空间)
for pair in "hiprand:rocrand" "hipsolver:rocsolver" "hipsparse:rocsparse" "hipfft:rocfft" "hipcub:rocprim"; do \
hip_pkg="${pair%%:*}"; roc_pkg="${pair#*:}"; \
roc_target="roc::${hip_pkg}"; hip_target="hip::${hip_pkg}"; src_target="roc::${roc_pkg}"; \
cfg_dir="/opt/rocm/lib/cmake/${hip_pkg}"; \
if [ -f "${cfg_dir}/${hip_pkg}-config.cmake" ]; then \
if ! grep -q "${roc_target}" "${cfg_dir}/${hip_pkg}-config.cmake" 2>/dev/null; then \
printf 'if(TARGET %s AND NOT TARGET %s)\n add_library(%s ALIAS %s)\nendif()\n' \
"${src_target}" "${roc_target}" "${roc_target}" "${src_target}" \
>> "${cfg_dir}/${hip_pkg}-config.cmake" && \
echo "${roc_target} alias appended to ${hip_pkg}-config.cmake."; \
fi; \
fi; \
done && \
# miopen minimal config(强制覆盖,miopen-hip 可能不带 cmake config)
mkdir -p /opt/rocm/lib/cmake/miopen && \