#!/usr/bin/env bash # Build the ROCmFPX runtime that serves frank-dragoon on Dankclaw. # # bash scripts/build-rocmfpx.sh # clone/fetch + build the pin # bash scripts/build-rocmfpx.sh --verify # only check the installed tree # # Runtime: kingjones30/ROCmFPX — charlie12345/ROCmFPX plus the model-card # patches, i.e. the fork that owns the ROCmFPx tensor formats. frank-dragoon's # payload is ftype 115 (`Q8_0_ROCMFPX_AGENT`): 311 tensors of # GGML_TYPE_Q8_0_ROCMFPX (103), a type that exists ONLY in this fork, so # stock llama.cpp, gufo and every other loader on the host reject the file. # This is the same tree that served the Qwen3.8-Flash-Next ROCmFP4 STRIX # endpoint 2026-08-30 → 09-11 (see the kingjones runbook), rebuilt here so a # fresh host can be brought up from the repo alone. # # Why this commit and not a newer one: 36e9acd (2026-08-28) is what was # qualified against this payload on 2026-10-02 — it loads ftype 115, survives # warmup, and drafts with the MTP head at acceptance 0.65. The five legacy # builds of 2026-08-25 crashed this same file in ggml_compute_forward_set_rows # (see kingjones-q8agent-rocmfpx.md), so the pin is load-bearing: do not bump # it without re-running that crash test. # # Host notes: # * -DLLAMA_BUILD_WEBUI=OFF is REQUIRED on this box. The tree provisions its # embedded UI assets via npm or the HF llama-ui bucket; npm is absent here # and the bucket download half-failed, aborting the link at 98%. The API # server is unaffected. # * The build links against the host ROCm (/opt/rocm); no bundled toolchain # like the gfx1201 R9700 build needed. set -euo pipefail ROCMFPX_REPO="${ROCMFPX_REPO:-https://github.com/kingjones30/ROCmFPX.git}" # The commit frank-dragoon was qualified with (measured 2026-10-02). ROCMFPX_COMMIT="${ROCMFPX_COMMIT:-36e9acd40e10a87cd3c3ef8ec734668757dc8520}" SRC_DIR="${ROCMFPX_SRC_DIR:-/home/dank/GitPackages/kingjones-ROCmFPX}" BUILD_DIR="${ROCMFPX_BUILD_DIR:-$SRC_DIR/build}" GPU_TARGET="${ROCMFPX_GPU_TARGET:-gfx1151}" JOBS="${JOBS:-$(nproc)}" # check_pin — refuse a source tree that is not the qualified commit. A moved # fork means different kernels under the same path, and on this model line a # wrong build is a segfault at first request, not a clean error. check_pin() { local commit commit="$(git -C "$SRC_DIR" rev-parse HEAD 2>/dev/null || true)" if [[ -n "$commit" && "$commit" != "$ROCMFPX_COMMIT" ]]; then echo "ROCMFPX_COMMIT mismatch: $SRC_DIR is at $commit, pinned $ROCMFPX_COMMIT" >&2 exit 1 fi } if [[ "${1:-}" == "--verify" ]]; then check_pin [[ -x "$BUILD_DIR/bin/llama-server" ]] || { echo "no ROCmFPX llama-server at $BUILD_DIR/bin/llama-server" >&2 exit 1 } # The format the endpoint exists for: the fork must carry the ROCmFPx # tensor type, or the payload cannot load at all. "$BUILD_DIR/bin/llama-server" --help 2>&1 | grep -q -- '--spec-type' || { echo "$BUILD_DIR/bin/llama-server has no --spec-type: MTP drafting is impossible" >&2 exit 1 } "$BUILD_DIR/bin/llama-server" --version | head -1 exit 0 fi echo "== source: $ROCMFPX_REPO @ $ROCMFPX_COMMIT ==" if [[ ! -d "$SRC_DIR/.git" ]]; then mkdir -p "$(dirname "$SRC_DIR")" git clone "$ROCMFPX_REPO" "$SRC_DIR" fi git -C "$SRC_DIR" fetch --quiet origin "$ROCMFPX_COMMIT" || true git -C "$SRC_DIR" checkout -q --detach "$ROCMFPX_COMMIT" check_pin echo " $(git -C "$SRC_DIR" rev-parse HEAD)" echo "== configure + build (release, HIP $GPU_TARGET) ==" cmake -S "$SRC_DIR" -B "$BUILD_DIR" \ -DGGML_HIP=ON \ -DGPU_TARGETS="$GPU_TARGET" \ -DGGML_NATIVE=ON \ -DCMAKE_BUILD_TYPE=Release \ -DLLAMA_BUILD_WEBUI=OFF cmake --build "$BUILD_DIR" --target llama-server llama-quantize -j "$JOBS" echo "== verify ==" "$BUILD_DIR/bin/llama-server" --version | head -1 echo "frank-dragoon runtime ready: $BUILD_DIR/bin/llama-server ($ROCMFPX_COMMIT)"