Files
Strata/engine/tests/quant/make_golden.sh
T
Niko1221 4058aa782b Layout move for 0.2.16: the top level becomes app/, engine/, terminal/, docs/, tools/ and .github/
Made by tools/layout/move_0216.py (the commit before this one) on db8e0be9c, the final code head of 0.2.16:
- 75 git mv (renames, so `git log --follow` and blame keep working; packaging/acceptance_matrix.md shows as delete + add because its links
  changed too) and 3 removals: SETUP.bat, UPDATE.bat and update.sh (setup.py --update pulls the code now);
- 1,425 path edits in 307 files: root-relative paths in CI, Docker, .gitignore and the release scripts; Markdown links; Python and
  Node joins from a root that moved with its folder; explicit edits for code that computes a root or names a moved path; tables of
  repository paths inside tests.

engine/ holds what CMake builds (src, include, cmake, metal, sycl, spark, third_party, the C++ tests and benches). app/ is the desktop
app and its host (was apps/). terminal/ is the Terminal in the layout of the installed one (strata.py, setup.py, strata_cli,
strata_control, serve, bin, data, ref, crates, the Python tools and tests). docs/ has the documentation, docs/lang/ the translated
READMEs, docs/history and docs/bench-results. tools/ has the repository's own checks, packaging, docker, research and nix.
tests/core/test_tqp_ref.py is a pytest file and stays with the Python tests (terminal/tests/core/).
AGENTS.md, README.md, LICENSE, setup.sh and START-HERE.bat stay at the root.

No behaviour change: the same command lines, the same sources. For this head a replay of the script gave the same numbers and the path
scan (tools/layout/checks/path_scan.py) reports no hit; the suites and the builds run on this commit next.
2026-11-17 13:19:21 +01:00

26 lines
2.0 KiB
Bash

#!/usr/bin/env bash
# tests/quant/make_golden.sh - make tests/quant/golden_x86.txt, the reference digests of quant_parity's leg 1.
#
# tests/quant/make_golden.sh <folder with the MSVC fragments msvc-avx2.txt msvc-avx.txt msvc-none.txt>
#
# Run on x86 Linux with GCC 13.x as gcc / g++ (or CC / CXX): it builds the three flavours (tests/quant/run_oracle.sh, so the same flags) and writes
# each flavour's lines with `quant_parity --write-golden`, then merges them with the MSVC fragments (tests/quant/golden_merge.py).
# The MSVC fragments come from a Windows build of each flavour with MSVC 19.4x (the release toolchain): configure as the Windows oracle does
# (cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DSTRATA_BUILD_TESTS=ON -DSTRATA_ENABLE_CUDA=OFF -DSTRATA_ENABLE_HIP=OFF -DSTRATA_NATIVE_EXPERTS=ON
# plus -DSTRATA_PORTABLE=ON / -DSTRATA_ISA_FLOOR=avx / -DSTRATA_ISA_FLOOR=none), build quant_parity, run `quant_parity --write-golden msvc-<flavour>.txt`.
# Regenerate when the test's cases or the vendored ggml (third_party/strata-ggml) change; ctest quant_golden_regen checks the file under both toolchains.
set -u
cd "$(dirname "$0")/../.."
MSVC_DIR=${1:?usage: make_golden.sh <folder with msvc-avx2.txt msvc-avx.txt msvc-none.txt>}
CC_BIN=${CC:-gcc}
case "$($CC_BIN -dumpfullversion 2>/dev/null)" in 13.*) ;; *) echo "make_golden.sh: needs GCC 13.x (CC=$CC_BIN is $($CC_BIN -dumpfullversion 2>/dev/null))"; exit 2 ;; esac
case "$(uname -m)" in x86_64|i?86) ;; *) echo "make_golden.sh: x86 only"; exit 2 ;; esac
ROOT=${BUILD_ROOT:-$PWD/build-golden}
mkdir -p "$ROOT"
for f in avx2 avx none; do
BUILD_ROOT=$ROOT QUANT_PARITY_ARGS="--write-golden $ROOT/gcc-$f.txt" bash tests/quant/run_oracle.sh $f || { echo "make_golden.sh: flavour $f failed"; exit 1; }
done
PY=$(command -v python3 || command -v python)
"$PY" tests/quant/golden_merge.py --gcc "$ROOT/gcc-avx2.txt" "$ROOT/gcc-avx.txt" "$ROOT/gcc-none.txt" \
--msvc "$MSVC_DIR/msvc-avx2.txt" "$MSVC_DIR/msvc-avx.txt" "$MSVC_DIR/msvc-none.txt" -o tests/quant/golden_x86.txt