interplane.Get Omega
Read in your language

omega-mv

Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.

Brought by drakestapleton

branch main Branches Tags History

omega-mv / core / rsi / tests / reuse-eval / stats-payback.om

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