build_hip_linux.sh: build strata-dsv41 (own build tree) and ship it in the rx9070 package; DSV41=1|0 overrides, --require-dsv41 on the package
This commit is contained in:
1 parent
8fee63f4f0
commit
faaf82acd7
1 file changed
+18
-5
@@ -1,5 +1,5 @@
|
||||
#!/bin/bash
|
||||
# Linux AMD (HIP) engine package: strata + the CPU picture reader (strata-vision) + the GPU picture reader (strata-vision-hip),
|
||||
# Linux AMD (HIP) engine package: strata (+ strata-dsv41 for rx9070) + the CPU picture reader (strata-vision) + the GPU picture reader (strata-vision-hip),
|
||||
# the ROCm libraries both load, and the rocBLAS / hipBLASLt kernel data for the listed archs, packaged as an engine component.
|
||||
# Run on a Linux box that has ROCm (TheRock Python wheels are enough); the tester packages were built in an Ubuntu 22.04 chroot
|
||||
# (glibc 2.35) so they run on every distribution since. All settings are environment variables:
|
||||
@@ -11,6 +11,8 @@
|
||||
# HP=<ROCm devel root> CORE=<ROCm core root> LIBW=<ROCm libraries root> (TheRock: _rocm_sdk_devel, _rocm_sdk_core, _rocm_sdk_libraries_*)
|
||||
# OUT=<work folder> PKGVER=0.1.46 COMMIT=<source commit for the build id> JOBS=16
|
||||
# VISION_ONLY=1 build only the two readers (no engine, no package)
|
||||
# DSV41=1|0 also build strata-dsv41 (the DeepSeek-V4.1 engine, tools/dsv41/build_hip_linux.sh's flags) and ship it beside
|
||||
# strata: default 1 for the rx9070 variant (gfx1200 gfx1201; built and run on an R9700), 0 for the others
|
||||
# NO_PACKAGE=1 stop after the stage folder
|
||||
# VISION_HIP_DEFS="-DGGML_CUDA_FA=OFF" extra cmake definitions for the GPU reader only
|
||||
#
|
||||
@@ -36,6 +38,7 @@ case "$V" in
|
||||
*) ARCHS=${ARCHS:?ARCHS=gfx...} ;;
|
||||
esac
|
||||
NOTE_EXTRA=""; [ "$V" = rx6000 ] && NOTE_EXTRA=" (built, not tested on a real RX 6000 card)"
|
||||
if [ -z "${DSV41:-}" ]; then DSV41=0; [ "$V" = rx9070 ] && DSV41=1; fi
|
||||
ARCHLIST=${ARCHS//;/ }
|
||||
DATAARCH=${ARCHS//;/,}
|
||||
mkdir -p "$OUT"; S=$OUT/build.status
|
||||
@@ -56,6 +59,13 @@ if [ -z "${VISION_ONLY:-}" ]; then
|
||||
nice -n 10 cmake --build "$OUT/b" --target strata -j "$JOBS" > "$OUT/build.log" 2>&1
|
||||
st "engine built rc=$?"
|
||||
[ -x "$OUT/b/strata" ] || { st "ABORT no strata"; exit 1; }
|
||||
if [ "$DSV41" = 1 ]; then # own build tree: the engine's flags stay as they were; STRATA_NATIVE_EXPERTS=ON is what the DeepSeek path was built with
|
||||
cmake -G Ninja -S . -B "$OUT/bd" -DCMAKE_BUILD_TYPE=Release -DSTRATA_ENABLE_HIP=ON -DSTRATA_ENABLE_CUDA=OFF -DSTRATA_BUILD_TESTS=OFF -DSTRATA_BUILD_DSV41=ON -DSTRATA_NATIVE_EXPERTS=ON "-DCMAKE_HIP_ARCHITECTURES=$ARCHS" "${HIPDEFS[@]}" -DSTRATA_GGML_DIR="$LLAMA" -DSTRATA_PORTABLE=ON "-DCMAKE_EXE_LINKER_FLAGS=-Wl,-rpath,'\$ORIGIN' -Wl,--enable-new-dtags" > "$OUT/cfg-dsv41.log" 2>&1
|
||||
st "dsv41 configured rc=$?"
|
||||
nice -n 10 cmake --build "$OUT/bd" --target strata-dsv41 -j "$JOBS" > "$OUT/build-dsv41.log" 2>&1
|
||||
st "dsv41 built rc=$?"
|
||||
[ -x "$OUT/bd/strata-dsv41" ] || { st "ABORT no strata-dsv41 (DSV41=0 leaves it out)"; tail -20 "$OUT/build-dsv41.log" >> "$S"; exit 1; }
|
||||
fi
|
||||
fi
|
||||
# the CPU reader: portable (AVX2), the fallback that runs on any PC
|
||||
cmake -G Ninja -S tools/vision -B "$OUT/bv" -DCMAKE_BUILD_TYPE=Release -DLLAMA_DIR="$LLAMA" -DSTRATA_VISION_CUDA=OFF \
|
||||
@@ -74,11 +84,12 @@ st "gpu reader built rc=$?"
|
||||
STAGE=$OUT/stage; rm -rf "$STAGE"; mkdir -p "$STAGE"
|
||||
ARCHJSON=$(for a in $ARCHLIST; do printf '"%s", ' "$a"; done | sed 's/, $//')
|
||||
cat > "$STAGE/BUILD.json" <<EOJ
|
||||
{"version": "$PKGVER", "source": "f-amd-vision $COMMIT", "variant": "$V", "archs": [$ARCHJSON], "portable": true, "vision": "gpu", "vision_cpu": "strata-vision", "vision_gpu": "strata-vision-hip", "vision_archs": [$ARCHJSON]}
|
||||
{"version": "$PKGVER", "source": "f-amd-vision $COMMIT", "variant": "$V", "archs": [$ARCHJSON], "portable": true, "vision": "gpu", "vision_cpu": "strata-vision", "vision_gpu": "strata-vision-hip", "vision_archs": [$ARCHJSON], "dsv41": $([ "$DSV41" = 1 ] && echo true || echo false)}
|
||||
EOJ
|
||||
# the libraries the engine and the GPU reader load (the CPU reader needs only the system's), collected from the build outputs
|
||||
DATA=(--data "$LIBW/lib/rocblas/library=rocblas/library" --data "$LIBW/lib/hipblaslt/library=hipblaslt/library" --data-arch "$DATAARCH")
|
||||
for b in "$OUT/b/strata" "$OUT/bh/bin/strata-vision-hip"; do
|
||||
BINS=("$OUT/b/strata" "$OUT/bh/bin/strata-vision-hip"); [ "$DSV41" = 1 ] && BINS+=("$OUT/bd/strata-dsv41")
|
||||
for b in "${BINS[@]}"; do
|
||||
python3 packaging/collect_libs.py --binary "$b" --search "$LIBW/lib" --search "$HP/lib" --search "$CORE/lib" --search "$CORE/lib/llvm/lib" ${SYSDEPS:+--search "$HP/lib/rocm_sysdeps/lib"} \
|
||||
--also 'libamd_comgr.so*' --also 'libhiprtc*.so*' --out "$STAGE" \
|
||||
"${DATA[@]}" >> "$OUT/collect.log" 2>&1
|
||||
@@ -86,8 +97,9 @@ for b in "$OUT/b/strata" "$OUT/bh/bin/strata-vision-hip"; do
|
||||
DATA=() # the kernel data once
|
||||
done
|
||||
cp "$OUT/b/strata" "$OUT/bv/bin/strata-vision" "$OUT/bh/bin/strata-vision-hip" "$STAGE/"
|
||||
[ "$DSV41" = 1 ] && cp "$OUT/bd/strata-dsv41" "$STAGE/"
|
||||
for f in "$STAGE"/*.so "$STAGE"/*.so.*; do [ -f "$f" ] && [ ! -L "$f" ] && patchelf --set-rpath '$ORIGIN' "$f"; done
|
||||
for f in "$STAGE/strata" "$STAGE/strata-vision" "$STAGE/strata-vision-hip"; do
|
||||
for f in "$STAGE/strata" "$STAGE/strata-vision" "$STAGE/strata-vision-hip" $([ "$DSV41" = 1 ] && echo "$STAGE/strata-dsv41"); do
|
||||
st "RUNPATH $(basename "$f"): $(readelf -d "$f" | grep -E 'RPATH|RUNPATH' | cut -d'[' -f2 | tr -d ']' | paste -sd' ')"
|
||||
done
|
||||
# the hipBLASLt version of this ROCm into BUILD.json, and the tuning tables of tools/hip that match it (architecture and version) into tuning/
|
||||
@@ -96,8 +108,9 @@ st "tuning tables rc=$?: $(tail -n 1 "$OUT/stage_tuning.log")"
|
||||
[ -n "${NO_PACKAGE:-}" ] && { st "STAGE-DONE"; exit 0; }
|
||||
rm -rf "$OUT/components"; mkdir -p "$OUT/components/engine"
|
||||
ARCHARGS=""; for a in $ARCHLIST; do ARCHARGS="$ARCHARGS --arch $a"; done
|
||||
REQ=""; [ "$DSV41" = 1 ] && REQ="--require-dsv41"
|
||||
python3 packaging/package_engine.py --src "$STAGE" --backend hip --version "$PKGVER" --out "$OUT/components/engine" $ARCHARGS \
|
||||
--variant "$V" --build-id "$COMMIT+rocm" --tree --notes "AMD $V build: engine, CPU picture reader, GPU picture reader${NOTE_EXTRA:-}" > "$OUT/package.log" 2>&1
|
||||
--variant "$V" --build-id "$COMMIT+rocm" --tree $REQ --notes "AMD $V build: engine, CPU picture reader, GPU picture reader$([ "$DSV41" = 1 ] && echo ", DeepSeek-V4.1 engine")${NOTE_EXTRA:-}" > "$OUT/package.log" 2>&1
|
||||
st "packaged rc=$?"
|
||||
cat "$OUT/package.log" >> "$S"
|
||||
st "BUILD-DONE"
|
||||
Reference in new issue
Block a user