test(context): accept any NaN for invalid-YaRN kernel args in the rope golden

rope_plan_golden compared kernel_args.corr_low/corr_high bit-for-bit, while the
corr_dims check right above already (correctly) treats NaN payload/sign as a libm
detail. For beta_slow=-1 the fixture, generated on arm64, holds 0x7fc00000, but
x86 SSE's default NaN is 0xffc00000, so the test failed on Linux x86_64. Compare
NaN-vs-NaN as equal for these two fields; all non-NaN bits stay exact.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Pavlo Ratushnyi
2026-10-14 16:47:56 +02:00
co-authored by Claude Sonnet 5.5
parent f334b66215
commit 58db6f44b2
2 changed files with 17 additions and 7 deletions
+14 -6
View File
@@ -97,6 +97,12 @@ fn cases() -> Vec<Value> {
root["cases"].as_array().unwrap().clone()
}
/// Bit-exact, except that any NaN matches any NaN: an invalid YaRN config yields NaN from log(<0) and the sign of
/// that default NaN is a platform detail (the fixture was generated on arm64: 0x7fc00000; x86 SSE produces 0xffc00000).
fn same_f32(a: f32, b: f32) -> bool {
a.to_bits() == b.to_bits() || (a.is_nan() && b.is_nan())
}
fn check_scalars(c: &Value, sc: &RopeScaling, n_rot: i32) {
let name = c["name"].as_str().unwrap();
// validity message, exactly
@@ -132,15 +138,17 @@ fn check_scalars(c: &Value, sc: &RopeScaling, n_rot: i32) {
bits32(&w["freq_scale"]).to_bits(),
"{name}: args.freq_scale"
);
assert_eq!(
assert!(
same_f32(a.corr_low, bits32(&w["corr_low"])),
"{name}: args.corr_low: {:#010x} vs {:#010x}",
a.corr_low.to_bits(),
bits32(&w["corr_low"]).to_bits(),
"{name}: args.corr_low"
bits32(&w["corr_low"]).to_bits()
);
assert_eq!(
assert!(
same_f32(a.corr_high, bits32(&w["corr_high"])),
"{name}: args.corr_high: {:#010x} vs {:#010x}",
a.corr_high.to_bits(),
bits32(&w["corr_high"]).to_bits(),
"{name}: args.corr_high"
bits32(&w["corr_high"]).to_bits()
);
assert_eq!(
a.ext_factor.to_bits(),
+3 -1
View File
@@ -84,7 +84,9 @@ for pkg in "${packages[@]}"; do
log="$logdir/$pkg.log"
start=$SECONDS
# --no-fail-fast: keep running every test binary even when one fails.
docker_run cargo test --locked --no-fail-fast --features leleka-cuda-driver/cuda-driver -p "$pkg" -- ${extra[@]+"${extra[@]}"} 2>&1 | tee "$log" | awk -v v="${LELEKA_TEST_VERBOSE:-}" 'v { print; next } /^warning/ { skip=1 } /^$/ { skip=0 } !skip { print }'
features=()
case "$pkg" in leleka-cuda-driver|leleka-runtime|leleka-native-cpu-expert) features=(--features leleka-cuda-driver/cuda-driver) ;; esac
docker_run cargo test --locked --no-fail-fast ${features[@]+"${features[@]}"} -p "$pkg" -- ${extra[@]+"${extra[@]}"} 2>&1 | tee "$log" | awk -v v="${LELEKA_TEST_VERBOSE:-}" 'v { print; next } /^warning/ { skip=1 } /^$/ { skip=0 } !skip { print }'
status=${PIPESTATUS[0]}
elapsed=$((SECONDS - start))
# Sum libtest "test result:" lines across all binaries of this package.