Files
leleka/crates/sampler-ref/oracle/build_oracle.sh
T
Pavlo RatushnyiandClaude Sonnet 5.5 45bad22b88 feat(sampler-ref): CPU reference of the Original sampler chain with host-oracle fixtures
New pure-Rust crate leleka-sampler-ref: Philox draw, penalties -> top_k ->
top_p -> min_p -> temperature -> inverse-CDF pick, greedy argmax, coupled-draft
counter/ring math, penalty_rows, exact-match acceptance, and the request-level
SamplingParams validation with the Original's GEN defaults and wire keys.

Golden fixtures come from compiling the Original's sampler_parity.cpp host
reference (included unmodified) and sampler/coupled_draft headers with clang++
(-ffp-contract=off), plus the verbatim StrataEngine.sampling_keys lifted from
server.py. No GPU, no speed or quality claim.

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

16 lines
785 B
Bash
Executable File

#!/bin/sh
# Rebuild the host oracle and regenerate the committed fixtures. macOS or Linux, clang++ or g++, no CUDA.
# crates/sampler-ref/oracle/build_oracle.sh [output_dir]
# -ffp-contract=off pins the host float evaluation to separate IEEE operations (no FMA), which is the
# contract the Rust reference documents. Compile flags are echoed into the fixture header.
set -eu
here=$(cd "$(dirname "$0")" && pwd)
root=$(cd "$here/../../.." && pwd)
out=${1:-"$here/../tests/fixtures"}
bin=${TMPDIR:-/tmp}/leleka_sampler_oracle.$$
${CXX:-clang++} -std=c++17 -O1 -ffp-contract=off -fno-fast-math -Wno-unused-function -Wno-unused-variable \
-I "$root/engine/strata/include" -I "$here/stub" "$here/gen_fixtures.cpp" -o "$bin"
mkdir -p "$out"
"$bin" "$out/sampler_oracle.json"
rm -f "$bin"