build: bundle the rocBLAS device libraries at the depth the runtime looks for

'cp -r SRC DST/' with a missing DST creates DST as a copy of SRC and drops a
directory level, so rocblas/library/* landed as lib/rocblas/* and hipblaslt's
arch subdirectories landed one level high. Nothing complains at load time: the
engine reads 29 GiB of weights, answers /health, and dies on the first request
with

  rocBLAS error: Cannot read .../lib/rocblas/library/TensileLibrary.dat:
  No such file or directory for GPU arch : gfx1201

Declare the destination and copy contents, both trees.
This commit is contained in:
Frank
2026-09-16 15:15:02 -07:00
parent 05c0d3a00a
commit c9c42e7489
+17 -4
View File
@@ -116,10 +116,23 @@ if command -v patchelf >/dev/null; then
"$ROCM_LOCAL_PATH/lib/llvm/lib"/libomp.so* \
"$ROCM_LOCAL_PATH/lib/llvm/lib"/libomptarget.so* "$LIB_DIR/" 2>/dev/null || true
cp -v "$ROCM_LOCAL_PATH/lib/rocm_sysdeps/lib"/librocm_sysdeps_*.so* "$LIB_DIR/" 2>/dev/null || true
[[ -d "$ROCM_LOCAL_PATH/lib/rocblas/library" ]] && \
cp -r "$ROCM_LOCAL_PATH/lib/rocblas/library" "$LIB_DIR/rocblas/" 2>/dev/null || true
[[ -d "$ROCM_LOCAL_PATH/lib/hipblaslt/library" ]] && \
cp -r "$ROCM_LOCAL_PATH/lib/hipblaslt/library" "$LIB_DIR/hipblaslt/" 2>/dev/null || true
# rocBLAS and hipBLASLt look for their device code at a FIXED depth under
# the binary's lib dir: $ORIGIN/../lib/rocblas/library and
# $ORIGIN/../lib/hipblaslt/library/<arch>. `cp -r SRC DST/` with a missing
# DST creates DST as a copy of SRC and flattens the source by one level, so
# the engine loads, serves nothing, and dies on the FIRST request with
# rocBLAS error: Cannot read .../lib/rocblas/library/TensileLibrary.dat:
# No such file or directory for GPU arch : gfx1201
# (measured 2026-09-16, after a build that looked perfectly healthy).
# Declare the destination, then copy the contents into it.
if [[ -d "$ROCM_LOCAL_PATH/lib/rocblas/library" ]]; then
mkdir -p "$LIB_DIR/rocblas/library"
cp -r "$ROCM_LOCAL_PATH/lib/rocblas/library/." "$LIB_DIR/rocblas/library/"
fi
if [[ -d "$ROCM_LOCAL_PATH/lib/hipblaslt/library" ]]; then
mkdir -p "$LIB_DIR/hipblaslt/library"
cp -r "$ROCM_LOCAL_PATH/lib/hipblaslt/library/." "$LIB_DIR/hipblaslt/library/"
fi
for bin in "$BUILD_DIR"/bin/llama-*; do
[[ -f "$bin" ]] && patchelf --set-rpath '$ORIGIN/../lib' "$bin"
done