Repository navigation
simd(wasm): certify the F64x8::mul_add domain, keep exact-product lanes in the vector - #378
Conversation
… domain The wasm F64x8::mul_add vector path (Dekker product, two-sum, round-to-odd) is exact only for 2^-460 <= |a|, |b| <= 2^460, |c| <= 2^960; other v128 pairs go lane by lane to the integer FMA. The 0x11xx group reached the fallback only through random bit patterns: widening the lower bound to 2^-600 left it green. Round 5 of the f64 loop puts lanes on both sides of every bound, |c| == 2^960, mixed pairs (one lane in, one out), products below the subnormal range and above f64::MAX, and infinities, NaN and zeros. Three new anti-vacuity codes: 0x11F2 needs >= 256 lanes where the emulation without its guard (a scalar copy) differs from the exact oracle, 0x11F3 >= 256 pairs on the vector path, 0x11F4 >= 256 mixed pairs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XAqKMPh2Seh2WLccCksAdY
The underflow witness shared its v128 with the overflow witness, so the pair always took the lane fallback and a widened lower bound could never send it to the vector path. Lanes 5 and 7 are now inside the domain, so pairs (4, 5) and (6, 7) are mixed and a widened guard reaches the witnesses. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XAqKMPh2Seh2WLccCksAdY
A lane whose a or b is a zero, an infinity or NaN sent its whole v128 pair to the per-lane integer FMA, although its product is exact and a * b + c already rounds once (the identity simd_fma::fma_f64 starts with). On V8, 10% zeros in a put 19% of pairs on the lane path; 50% zeros (ReLU-like data) put 75% there, at ~50-75 ns per element against ~6-9 ns on the vector path. Such lanes now take a * b + c, selected per lane, and only pairs with a finite nonzero operand outside 2^-460..2^460 (or |c| > 2^960) go lane by lane. The in-domain path is unchanged. The module notes record the measured margin of the bounds and why the c bound is kept. Parity: lane 6 of the edge round puts a zero, infinity or NaN in a or b against every kind of c; 0x11F5 needs >= 128 pairs on the repaired path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XAqKMPh2Seh2WLccCksAdY
… item closed The 2026-10-11 open item and coresearch row X11 predate #374, which made wasm mul_add round once and was never recorded here. New entry: fast domains, the measured margin of the F64 guard, the edge fixtures and their disable runs, V8 timings before and after the exact-product repair, and what is not claimed. X11 regraded CLOSED. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XAqKMPh2Seh2WLccCksAdY
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
- scripts/masking-parity.sh wasm-relaxed and a CI step: the parity program built with +simd128,+relaxed-simd. Its code section is byte-identical to the +simd128 build (no source path selects on relaxed-simd, no relaxed opcode emitted; a control with f64x2_relaxed_madd shows the scan can fire). The arm guards against a relaxed path appearing later. - .claude/knowledge/wasm-fma-proof-obligations.md: proven, cited, tested and open obligations for F32x16/F64x8 mul_add, including the special-value repair, bit-select and mixed pairs. The measured guard margin is labelled as a measurement, not proof. - simd_wasm.rs module note: proven sufficient condition vs measured onset; comment only. - Coresearch X11: current status first; the superseded wording is kept in the blackboard audit entry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XAqKMPh2Seh2WLccCksAdY
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Follow-up to #374, which made wasm
F32x16::mul_addandF64x8::mul_addround once.What changes
Edge fixtures for the F64 guard (
crates/simd-masking-parity). The wasmF64x8::mul_addvector path (Dekker product, two-sum, round-to-odd) is exact only for2^-460 <= |a|, |b| <= 2^460,|c| <= 2^960. Each v128 pair outside that range goes lane by lane to the integer FMA insimd_fma.rs. Until now the0x11xxgroup reached that fallback only through random bit patterns. Widening the lower bound to2^-600stayed green.Round 5 (
edge_lanes_f64) adds lanes on both sides of every bound, plus:|c| == 2^960;f64::MAX;aorb, against every kind ofc.Each lane the emulation gets wrong shares its pair with an in-range lane, so a widened guard sends it to the vector path. The reference is still the 4608-bit integer oracle. New anti-vacuity codes:
0x11F2: lanes where a scalar copy of the unguarded emulation is wrong;0x11F3: pairs on the vector path;0x11F4: mixed pairs;0x11F5: pairs on the repaired path.Exact-product repair (
src/simd_wasm.rs). A lane whoseaorbis a zero, an infinity or NaN has an exact product, soa * b + crounds once. That is the IEEE result, and it is the identitysimd_fma::fma_f64starts with. Such pairs now stay in the vector with a per-lane select. Before, one zero sent the whole pair to the integer FMA. The in-domain path is unchanged.Relaxed SIMD (
scripts/masking-parity.sh wasm-relaxed, one CI step). No source path selects onrelaxed-simd. The parity wasm built with+simd128,+relaxed-simdhas a code section byte-identical to the+simd128build, with 0 relaxed-SIMD opcodes. A control that callsf64x2_relaxed_maddshows the opcode scan can fire. The new arm runs the parity program in that configuration, so a relaxed path cannot appear later unnoticed. It does not exercise an engine executing relaxed instructions, because none are emitted.Proof obligations (
.claude/knowledge/wasm-fma-proof-obligations.md). Each obligation is marked by kind of evidence:e_a + e_b >= -970against the guard's-920), TwoSum, round-to-odd through the midpoint argument (subnormal intermediates included), near-zero cancellation, the exact-product repair, bit-select and mixed pairs.The measured margin of the guard is labelled as a measurement, not proof, and the guard is unchanged.
Board. New blackboard entries for the fix and for this audit. Coresearch row X11 now states its current status first; its superseded wording is kept in the audit entry.
Evidence
masking-parity.sh wasm,wasm-scalar,wasm-relaxedand native (AVX-512 host with hardware FMA), plusscripts/wasm-parity.sh. Parity crateclippy -D warningsis clean.2^-520; a/b upper bound2^530; per-pairall_true→any_true; f32 round-to-odd dropped; f64 round-to-odd dropped; round-to-odd step always up; repair returnsc; repair dropsc; tinyatreated as an exact product; large or non-finitectreated as an exact product.2^-500: inside the proven condition.cbound2^1023: no counterexample exists given the a/b bounds.a * b + c;a: 9–13 → ~7.0;Not claimed
reduce_sumis a separate contract. Its summation order differs per backend.lance-graph is untouched. D-WFL-DET may rely on a verified single-rounding
mul_addacross realizations. D-OIF-4's kernel is defined as multiply then add, and must not become a fused FMA.🤖 Generated with Claude Code
https://claude.ai/code/session_01XAqKMPh2Seh2WLccCksAdY