gem/scripts/verify-llama-metal.sh
2026-08-30 18:24:55 -06:00

19 lines
733 B
Bash
Executable file

#!/bin/sh
# Verify that a llama.cpp executable was linked with Metal and contains DSV4 kernels.
set -eu
root=$(CDPATH='' cd -- "$(dirname -- "$0")/.." && pwd)
llama_dir=${GEM_LLAMA_CPP_DIR:-"$root/../qwen38-llama-bench/llama.cpp"}
bin_dir=${GEM_LLAMA_BIN_DIR:-"$llama_dir/build-gem-metal/bin"}
if ! otool -L "$bin_dir/llama-server" | grep -q 'libggml-metal'; then
echo "gem: llama-server is not linked to libggml-metal" >&2
exit 1
fi
if ! grep -q 'kernel_dsv4_hc_comb_f32' "$llama_dir/ggml/src/ggml-metal/ggml-metal.metal"; then
echo "gem: the configured llama.cpp source lacks the DSV4 Metal kernels" >&2
exit 1
fi
"$bin_dir/llama-server" --version
echo "gem: verified Metal linkage and DeepSeek-V4 Metal source"