wasm build: relaxed-simd makes output depend on the user's JS engine — intended? #1094
Unanswered
grepfuldead
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
The wasm package is built with
+relaxed-simdonly (.cargo/config.toml).f32x4.relaxed_maddis spec-permitted to be fused or unfused per implementation, and the NNUE L1–L3 tail is f32, so the eval is exposed. Measured it: 150,000 random legal FENs x {V8/node, JSC/bun, SpiderMonkey} x {relaxed build, strict-simd128 build}, comparing rawevaluate()i32, plus 60 positions atgo depth 13(1 thread), all against the native avx2 build as reference.Results (one x86-64+FMA host):
relaxed_madd-> their evals match native avx2 exactly, 150,000/150,000.r1bqkbnr/pppppppp/n7/8/8/P1P3PB/1P1PPP1P/RNBQK1NR b KQkq - 0 4, depth 13, 1 thread → V8/SpiderMonkey playd7d5(−91); JSC playsg7g6(−79).Not a strength issue the bestmove flips are 7–24cp near-ties (one even favored JSC's choice). It's a reproducibility one: same version + same position → different analysis depending on the user's browser, which breaks cross-client repro of user reports. Related: CI's wasm job is build-only nothing ever executes the wasm build, so an engine-side lowering change would also go unnoticed.
For context, #1079's title mentions both a wasm32 and a wasm32-relaxed-simd target, but the config it landed defines only the relaxed one so this may just never have been decided.
Is runtime-dependent output acceptable for the web build, or would you prefer:
(a) strict-only deterministic everywhere, costs the native-parity of fused hosts; or
(b) build both artifacts what lichess's current stockfish-web does (relaxed alongside simd128 with feature detection, never relaxed-only), keeping relaxed as the native-parity fast path? (Frontend selection would be on your side I don't see the consumer in this repo.)
Happy to PR the build side of either, plus a small node-based CI leg that actually runs the wasm build against pinned eval fixtures (pinnable on the strict build, which is the only variant with an engine-independent expectation).
Beta Was this translation helpful? Give feedback.
All reactions