okami.mom/strata

git clone https://git.nkp.pet/okami.mom/strata

Niko1221Merge f-mmq-default-off: build the engine without llama.cpp's MMQ kernels by default (-DSTRATA_MMQ=ON keeps the old path; linux-aarch64 unchanged)5649b9e52

main
2.7 KiB40 linesraw
1#!/bin/bash
2# Linux HIP engine package for the Radeon 780M (gfx1103), built on the mini PC (P2006). Needs the source tree as $HOME/split-tq/tq3-src.tar.gz
3# (git archive; ggml is its vendored third_party/strata-ggml) and the TheRock gfx110X-all SDK at $HOME/strata-poc/rocm/install; edit the paths for another box.
4# ROCm = TheRock gfx110X-all SDK of ~/strata-poc (as the earlier P2006 builds). Shared box lock for the build; nice.
5R=$HOME/split-tq
6S=$R/build.status
7st() { echo "$* $(date +%T)" >> $S; }
8SDK=$HOME/strata-poc/rocm/install
9export ROCM_PATH=$SDK HIP_PATH=$SDK HIP_PLATFORM=amd
10export PATH=$SDK/bin:$SDK/lib/llvm/bin:$PATH
11export LD_LIBRARY_PATH=$SDK/lib:$SDK/lib/rocm_sysdeps/lib:$SDK/lib/llvm/lib:${LD_LIBRARY_PATH:-}
12mkdir -p $R; cd $R || exit 1
13: > $S
14st "start"
15rm -rf src stage components; mkdir src; tar xzf $R/tq3-src.tar.gz -C src
16cd src
17cmake -S . -B b1103 -G Ninja -DCMAKE_BUILD_TYPE=Release -DSTRATA_ENABLE_HIP=ON -DSTRATA_ENABLE_CUDA=OFF -DSTRATA_PREFILL_MMQ=ON -DSTRATA_BUILD_TESTS=OFF -DSTRATA_PORTABLE=ON \
18  -DSTRATA_MMQ=OFF -DCMAKE_HIP_ARCHITECTURES=gfx1103 \
19  -DCMAKE_HIP_COMPILER=$SDK/lib/llvm/bin/clang++ -DCMAKE_HIP_COMPILER_ROCM_ROOT=$SDK \
20  "-DCMAKE_PREFIX_PATH=$SDK;$SDK/lib/rocm_sysdeps;$SDK/lib/llvm" \
21  "-DCMAKE_HIP_FLAGS=--rocm-path=$SDK --rocm-device-lib-path=$SDK/lib/llvm/amdgcn/bitcode" > $R/cfg.log 2>&1
22st "configured rc=$?"
23flock -s $HOME/gpu.lock nice -n 10 cmake --build b1103 --target strata -j 8 > $R/build.log 2>&1
24st "built rc=$?"
25[ -x b1103/strata ] || { st "ABORT no exe"; tail -5 $R/build.log >> $S; exit 1; }
26STAGE=$R/stage; mkdir -p $STAGE
27cp b1103/strata $STAGE/
28echo '{"version": "0.1.45", "source": "f-split-tq 322e3fdfb", "archs": ["gfx1103"], "rocm": "TheRock gfx110X-all 7.14.1", "portable": true, "experimental": "Radeon 780M, unvalidated; GPU resets seen (notes-minipc.md)"}' > $STAGE/BUILD.json
29python3 packaging/collect_libs.py --binary b1103/strata --search $SDK/lib --search $SDK/lib/rocm_sysdeps/lib --search $SDK/lib/llvm/lib \
30  --also 'libamd_comgr.so*' --also 'libhiprtc*.so*' --out $STAGE \
31  --data $SDK/lib/rocblas/library=rocblas/library --data $SDK/lib/hipblaslt/library=hipblaslt/library --data-arch gfx1103 > $R/collect.log 2>&1
32st "collected rc=$?"
33python3 packaging/stage_tuning.py --stage $STAGE --archs gfx1103 --rocm $SDK >> $R/stage_tuning.log 2>&1   # hipblaslt_version in BUILD.json + the matching tuning table
34st "tuning tables rc=$?: $(tail -n 1 $R/stage_tuning.log)"
35mkdir -p $R/components/engine
36python3 packaging/package_engine.py --src $STAGE --backend hip --version 0.1.45 --out $R/components/engine \
37  --arch gfx1103 --build-id 322e3fdfb+rocm7.14.1-gfx110X --tree > $R/package.log 2>&1
38st "packaged rc=$?"
39cat $R/package.log >> $S
40st "BUILD-DONE"