The source-port runtime no longer builds on macOS, so the pure arithmetic and its
golden tests live in a platform-independent crate shared by the driver and runtime.
leleka_runtime::{rope_scaling,memory_plan,context_policy} stay as re-exports.
geometry.rs derives every frozen 262144-cell byte literal from the cell count.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
20 lines
1.2 KiB
Bash
Executable File
20 lines
1.2 KiB
Bash
Executable File
#!/bin/sh
|
|
# Regenerates rope_golden.json from the Original's host code (macOS or Linux, any C++17 compiler).
|
|
# usage: gen_rope_golden.sh [extra compiler flags]
|
|
# The committed fixture is built with -O2 -ffp-contract=off (Rust never fuses multiply-adds) and
|
|
# -fno-builtin-sinf/-cosf: Apple clang otherwise merges a sinf+cosf pair into __sincosf_stret, whose sinf
|
|
# differs from a separate sinf call by 1-2 ULP, and Rust (like the CUDA device code) calls them separately.
|
|
# Only the float32 analytic path is affected; the float64 tables are identical either way.
|
|
set -eu
|
|
here=$(cd "$(dirname "$0")" && pwd)
|
|
strata="$here/../../../../engine/strata"
|
|
work=$(mktemp -d)
|
|
trap 'rm -rf "$work"' EXIT
|
|
# extract the two build_rope_table definitions from rope.cu verbatim (up to the next anonymous namespace)
|
|
awk '/^void build_rope_table\(int n_rot, double theta/ {on=1} on && /^namespace \{/ {exit} on {print}' \
|
|
"$strata/src/kernels/cuda/rope.cu" > "$work/rope_table_original.inc"
|
|
test -s "$work/rope_table_original.inc"
|
|
${CXX:-clang++} -std=c++17 -O2 -ffp-contract=off -fno-builtin-sinf -fno-builtin-cosf "$@" -I"$strata/include" -I"$work" \
|
|
"$here/gen_rope_golden.cpp" -o "$work/gen_rope_golden"
|
|
"$work/gen_rope_golden" > "$here/rope_golden.json"
|