okami.mom/strata

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

Niko1221Merge f-ds-out ac306afb2 into f-own-intaff3a132f

main
1.2 KiB27 linesraw
1#!/usr/bin/env bash
2# tests/quant/check_no_ggml.sh - with STRATA_OWN_CPU_QUANT the CPU expert pool and the --mtp-q4 requantizer must call no ggml function.
3#
4#   tests/quant/check_no_ggml.sh <build dir> [extra object-name patterns...]
5#
6# Looks at the undefined symbols of the pool's objects (strata_kernels_cpu, strata_quant, mtp.cpp, and any extra pattern) and fails if one
7# starts with ggml_ or is one of ggml-cpu's quantizer / dot entry points.  The tests that use ggml-cpu as the oracle are not looked at.
8set -u
9B=${1:?usage: check_no_ggml.sh <build dir> [pattern...]}
10shift
11PATS=("strata_kernels_cpu.dir/.*\.o$" "strata_quant.dir/.*\.o$" "/mtp\.cpp\.o$" "$@")
12bad=0
13n=0
14while IFS= read -r o; do
15  ok=0
16  for p in "${PATS[@]}"; do [[ $o =~ $p ]] && ok=1; done
17  [ $ok = 1 ] || continue
18  n=$((n + 1))
19  syms=$(nm -u "$o" 2>/dev/null | awk '{print $2}' | grep -E '^(ggml_|quantize_row_|dequantize_row_|ggml_vec_dot)' || true)
20  if [ -n "$syms" ]; then
21    echo "GGML symbols in $o:"; echo "$syms" | sed 's/^/   /'
22    bad=1
23  fi
24done < <(find "$B" -name '*.o' -o -name '*.obj')
25echo "check_no_ggml: $n objects looked at, $([ $bad = 0 ] && echo clean || echo 'ggml symbols found')"
26[ $n -gt 0 ] || { echo "no objects matched"; exit 2; }
27exit $bad