You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#7238 removed emit_i64_specializations because neither half of its contract
was provable: a number parameter is a double (the wrapper's fptosi
truncated fractional arguments), and nothing bounded any intermediate at 2^53
(where JS starts rounding and exact i64 arithmetic does not).
That removal has a measured cost. Interleaved A/B on a Mac mini, 9 pairs,
fixed arm slower in 9/9: benchmarks/suite/05_fibonacci.tsfib(40) went
450 ms → 555 ms, about 20%. 14_closure was within noise because its compute picked up a __typed_f64 clone instead; fib did not, because its
body is not straight-line and so does not qualify for the typed-f64 gate.
(Neither host was quiet — indicative, not controlled.)
The shape a sound version needs, which #7238 was not the place to build:
Guarded entry. The public f64 wrapper proves each argument is an exact
integer (sitofp(fptosi(x)) == x, and in range) before entering the
integer body, instead of assuming it.
A deopt edge. The ordinary f64 body must still be emitted — the removed
pass suppressed it, which is precisely why the wrapper had nowhere to fall
back to. A failed entry guard calls the f64 body.
A bounded interior, or a checked one. Either a static magnitude bound
in the style of i32_chain_magnitude_bits (fix(codegen): round JS arithmetic to f64 at every i32-chain step (#7232) #7237) — which needs a bounded
leaf, and a self-recursive parameter has none — or a per-operation |v| <= 2^53 check that deopts to the f64 body with the current (still
exact) arguments. The per-operation check is the only one that covers the
recursive accumulator, and it needs measuring: three branches per fib
call may well erase the 20% it is trying to recover.
Worth noting that the straight-line half of this is already solved by the
typed-ABI clones and the Phase-2 specialized ABI, which prove representations
from call sites rather than assuming them. The open ground is specifically self-recursive numeric functions whose body is not straight-line, which is
the one case where fib lands and no existing specializer reaches.
Acceptance: 05_fibonacci back to within noise of f8f1e7188, with test-files/test_gap_7238_i64_specialization_exactness.ts still byte-exact
against the pinned Node — that test already contains the fractional-argument,
2^53-boundary and past-2^63 shapes any such pass has to survive.
#7238 removed
emit_i64_specializationsbecause neither half of its contractwas provable: a
numberparameter is a double (the wrapper'sfptositruncated fractional arguments), and nothing bounded any intermediate at 2^53
(where JS starts rounding and exact i64 arithmetic does not).
That removal has a measured cost. Interleaved A/B on a Mac mini, 9 pairs,
fixed arm slower in 9/9:
benchmarks/suite/05_fibonacci.tsfib(40)went450 ms → 555 ms, about 20%.
14_closurewas within noise because itscomputepicked up a__typed_f64clone instead;fibdid not, because itsbody is not straight-line and so does not qualify for the typed-f64 gate.
(Neither host was quiet — indicative, not controlled.)
The shape a sound version needs, which #7238 was not the place to build:
integer (
sitofp(fptosi(x)) == x, and in range) before entering theinteger body, instead of assuming it.
pass suppressed it, which is precisely why the wrapper had nowhere to fall
back to. A failed entry guard calls the f64 body.
in the style of
i32_chain_magnitude_bits(fix(codegen): round JS arithmetic to f64 at every i32-chain step (#7232) #7237) — which needs a boundedleaf, and a self-recursive parameter has none — or a per-operation
|v| <= 2^53check that deopts to the f64 body with the current (stillexact) arguments. The per-operation check is the only one that covers the
recursive accumulator, and it needs measuring: three branches per
fibcall may well erase the 20% it is trying to recover.
Worth noting that the straight-line half of this is already solved by the
typed-ABI clones and the Phase-2 specialized ABI, which prove representations
from call sites rather than assuming them. The open ground is specifically
self-recursive numeric functions whose body is not straight-line, which is
the one case where
fiblands and no existing specializer reaches.Acceptance:
05_fibonacciback to within noise off8f1e7188, withtest-files/test_gap_7238_i64_specialization_exactness.tsstill byte-exactagainst the pinned Node — that test already contains the fractional-argument,
2^53-boundary and past-2^63 shapes any such pass has to survive.