diff options
| author | qhukz13 <v.onashchuk@gmail.com> | 2026-11-24 16:39:32 +0200 |
|---|---|---|
| committer | qhukz13 <v.onashchuk@gmail.com> | 2026-11-24 16:39:32 +0200 |
| commit | adc25699fdd6ae0bc33f7c535ebb6f8ad117eac8 (patch) | |
| tree | 0fb6309b3eb229129e662d45e7ae981499c012ca /runtime/src/thread_stacks.cpp | |
| parent | d0da7dade8b688f2e0f7f23f4155d6cbb438809e (diff) | |
spirv_mini_interp: binary64 Sqrt/InverseSqrt stay binary64, and OpFAdd/OpFSub/OpFDiv run on doubles (TEST-MINI-INTERP-F64)
GLSL.std.450 Sqrt and InverseSqrt rounded a double result to binary32: the translated v_sqrt_f64 of 2.0 gave
0x3ff6a09e60000000 instead of 0x3ff6a09e667f3bcd, and v_rsq_f64 likewise. OpFAdd, OpFSub and OpFDiv on binary64 raised
UnsupportedConstruct, so v_add_f64 and v_rcp_f64 could not run in this interpreter at all.
A double Sqrt is math.sqrt (correctly rounded). A double InverseSqrt is the new rsqrt_f64, rounded once from the
exact value through an integer square root: 1.0 / math.sqrt(x) rounds twice and misses by an ulp on about a quarter
of random doubles (5,219 of 20,008, checked against a 90-digit decimal; rsqrt_f64 matched all of them). Binary64
OpFAdd/OpFSub/OpFDiv follow the binary32 path's rules: a division by zero is still refused as undefined, and a NaN
made from non-NaN operands goes through ieee_nan.
tests/semantic/test_mini_interp_f64.py translates v_sqrt_f64, v_rsq_f64, v_rcp_f64 and v_add_f64 and checks the
pair against Python's binary64 operations and, for the inverse root, a 60-digit decimal reference; against main's
interpreter it gives 2 failures and 14 errors.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'runtime/src/thread_stacks.cpp')
0 files changed, 0 insertions, 0 deletions