spark-rsi-mv
Native Rust recursive self-improvement engine with paired bootstrap evaluation and cryptographic ledger
Brought by drakestapleton
spark-rsi-mv / tests / reuse-eval / stats-payback.om
| 1 | note units: stats |
| 2 | note SPDX-License-Identifier: Apache-2.0 |
| 3 | note stats-payback: payback with END round trips (K17), on globals stpay reads. Two groups, each |
| 4 | note BEGIN, QUERY, SET, QUERY; full and delta (arm 4) have equal start-to-ready and request round |
| 5 | note trips, so every pre-END (full - arm) difference is 0. acq(delta) = 150 ns. |
| 6 | note p1 (integrator counterexample): full END 100 ns per rep in group 0, arm END 0, so END |
| 7 | note savings 300 after group 0: payback is 2 QUERYs (after the group's last QUERY), never 0. |
| 8 | note p2 the same savings only in group 1: payback 4. |
| 9 | note p3 savings 150 (not above acq): never (2^64 - 1). |
| 10 | note p4 a request saving at group 0's first QUERY (full 900 instead of 500 ns, 3 reps): 1. |
| 11 | note Exit 0 = pass; otherwise the failing check's code. |
| 12 | |
| 13 | note two groups of 4 requests, equal costs for arms 1 and 4, END 0, acq(4) = 150 |
| 14 | fn tpbase to void |
| 15 | streset |
| 16 | put STNG 0 2 |
| 17 | for g ulong 2 |
| 18 | put STGO g mul g 4 |
| 19 | put STGN g 4 |
| 20 | end |
| 21 | for i ulong 8 |
| 22 | k = rem i 4 |
| 23 | if eq k 0 |
| 24 | put STRO i 1 |
| 25 | end |
| 26 | if eq k 2 |
| 27 | put STRO i 3 |
| 28 | end |
| 29 | if or eq k 1 eq k 3 |
| 30 | put STRO i 2 |
| 31 | end |
| 32 | end |
| 33 | for r ulong 3 |
| 34 | for g ulong 2 |
| 35 | for a ulong 2 |
| 36 | x = add mul add mul add mul a 3 1 3 r 128 g |
| 37 | put STPR x 1000 |
| 38 | put STPE x 0 |
| 39 | end |
| 40 | end |
| 41 | for i ulong 8 |
| 42 | for a ulong 2 |
| 43 | put STRT add mul add mul add mul a 3 1 3 r 65536 i 500 |
| 44 | end |
| 45 | end |
| 46 | end |
| 47 | put STAA 4 150 |
| 48 | end |
| 49 | |
| 50 | note full's END for group g, every rep, = e |
| 51 | fn tpend g ulong e ulong to void |
| 52 | for r ulong 3 |
| 53 | put STPE add mul add 3 r 128 g e |
| 54 | end |
| 55 | end |
| 56 | |
| 57 | fn main to int |
| 58 | tpbase |
| 59 | tpend 0 100 |
| 60 | if ne stpay 4 2 |
| 61 | ret 1 |
| 62 | end |
| 63 | tpbase |
| 64 | tpend 1 100 |
| 65 | if ne stpay 4 4 |
| 66 | ret 2 |
| 67 | end |
| 68 | tpbase |
| 69 | tpend 0 50 |
| 70 | if ne stpay 4 18446744073709551615 |
| 71 | ret 3 |
| 72 | end |
| 73 | tpbase |
| 74 | tpend 0 100 |
| 75 | for r ulong 3 |
| 76 | put STRT add mul add 3 r 65536 1 900 |
| 77 | end |
| 78 | if ne stpay 4 1 |
| 79 | ret 4 |
| 80 | end |
| 81 | ret 0 |
| 82 | end |