Files
leleka/crates/experimental-ref/oracle/gen_cvec_golden.sh
T
Pavlo RatushnyiandClaude Sonnet 5.5 7bd31abdb2 feat(experimental-ref): keyless routing, control vectors and attention references; emulated kernel scenarios
keyless.rs: SKLROUT1 artifact admission (layout cross-read against prepare-keyless-routing.py),
fmaf-order query routing, positional key reconstruction. cvec.rs: GGUF v3 parsing and the
load_control_vectors table builder (19 golden cases incl. the Original's error texts,
bit-exact, from the Original function extracted verbatim) and a reduction-tree twin of
cvec_kernel. attn.rs: scratch arithmetic and an f64 GQA reference. The emulated kernel
text reproduces routing and cvec bit for bit and attention modes 2/3/4 (incl. M-RoPE) to
1.6e-7 relative L2.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-14 15:31:44 +02:00

20 lines
1.1 KiB
Bash
Executable File

#!/bin/sh
# Regenerates tests/fixtures/cvec_golden.json from generate.cpp's own load_control_vectors (extracted verbatim)
# running on synthetic control-vector GGUF files. Host-only; `cvec_upload` is a recorder.
# crates/experimental-ref/oracle/gen_cvec_golden.sh
set -eu
here=$(cd "$(dirname "$0")" && pwd)
strata="$here/../../../engine/strata"
out="$here/../tests/fixtures"
work=$(mktemp -d)
trap 'rm -rf "$work"' EXIT
awk '/^bool load_control_vectors\(const Options& o, const strata::core::ModelGeometry& g, std::string& summary, std::string& err\) \{/ {on=1} on {print} on && /^}/ {exit}' \
"$strata/src/program/generate.cpp" > "$work/fragment_load_control_vectors.inc"
test -s "$work/fragment_load_control_vectors.inc"
# -ffp-contract=off: the Original's host build has no FMA, `data += scale * src` is a multiply then an add
${CXX:-clang++} -std=c++17 -O1 -ffp-contract=off -Wno-unused-function -Wno-unused-variable -I"$strata/include" -I"$work" \
"$here/gen_cvec_golden.cpp" -o "$work/gen_cvec"
mkdir -p "$out"
"$work/gen_cvec" > "$out/cvec_golden.json"
echo "wrote $out/cvec_golden.json"