interplane.Get Omega
Read in your language

benchmarks-mv

Measurement harnesses and evidence bundles for AIEN on the NVIDIA DGX Spark GB10. Speed is reported against the machine's physical limit and my own previous run. Attachment of AienOS.

Brought by drakestapleton

branch main Branches Tags History

benchmarks-mv / native / queueflow / oracle.wl

85 lines · 5309 bytes Raw Blame History
1(* SPDX-License-Identifier: Apache-2.0
2 oracle.wl (DRA-190): independent Wolfram Language replay of the five arms of flow.om, written
3 from PREREG.md section 4, not from flow.om. qfLines[rows, d0] returns the QF lines that flow.om
4 must print byte for byte (the gate compares them). rows: list of 11-integer rows of an
5 export-windows.sh TSV. Evaluated through the hosted Wolfram evaluator; the raw call and result
6 are kept in evidence/wolfram/. *)
7qfLines[rows_, d0_] := Module[
8 {n = Length[rows], a, s, e, l, c, v, o, held, el, sv, ac, d, an = 0, f, rc, nr = 0, p, ar, gp, g, sq,
9 svc, drop, acc, fcfs, elig, arms, names = {"A", "B", "Cr", "Ch", "C"}, cfg, line, met, K,
10 kl, cmp, ovl, mq, w, nm},
11 a = rows[[All, 1]]; s = rows[[All, 2]]; e = rows[[All, 3]]; l = rows[[All, 4]];
12 c = rows[[All, 7]]; v = rows[[All, 8]]; o = rows[[All, 9]];
13 held = Map[# > 0 &, s];
14 el = ConstantArray[0, n]; sv = ConstantArray[0, n]; ac = ConstantArray[0, n];
15 ar = ConstantArray[0, n]; gp = ConstantArray[0, n]; sq = ConstantArray[0, n];
16 d = d0;
17 Do[g = a[[i]] - d; ar[[i]] = a[[i]];
18 If[d > 0 && 0 <= g <= 3, gp[[i]] = g;
19 If[i > 1, ar[[i]] = ar[[i - 1]]; If[o[[i]] == o[[i - 1]], sq[[i]] = 1]]];
20 f = Max[a[[i]], d];
21 If[held[[i]],
22 If[s[[i]] < f, an++]; el[[i]] = If[s[[i]] > f, s[[i]], ar[[i]]];
23 sv[[i]] = e[[i]] - s[[i]]; If[e[[i]] < s[[i]], an++];
24 ac[[i]] = Boole[c[[i]] == 0 && v[[i]] != 1]; d = e[[i]],
25 el[[i]] = ar[[i]]; sv[[i]] = 0; ac[[i]] = 0; If[e[[i]] > f, d = e[[i]]]], {i, n}];
26 rc = ConstantArray[0, n];
27 Do[p = SelectFirst[Range[i - 1, 1, -1], o[[#]] == o[[i]] &, 0];
28 If[p > 0 && ac[[p]] == 0 && 0 <= a[[i]] - e[[p]] <= 3600, rc[[i]] = rc[[p]] + 1; nr++],
29 {i, n}];
30 svc[i_, cap_] := If[cap == 1 && l[[i]] > 0 && sv[[i]] > l[[i]], l[[i]], sv[[i]]];
31 drop[i_, r_] := r == 1 && rc[[i]] > 1;
32 acc[i_, cap_, r_] := Boole[ac[[i]] == 1 && ! drop[i, r] && ! (cap == 1 && l[[i]] > 0 && sv[[i]] > l[[i]])];
33 fcfs[cap_, r_] := Module[{dd = d0, h = 0, xs = ConstantArray[0, n], xd = ConstantArray[0, n],
34 xv = ConstantArray[0, n], xa = ConstantArray[0, n], ff, st, t},
35 Do[If[drop[i, r], xd[[i]] = a[[i]],
36 ff = Max[ar[[i]], dd + gp[[i]]];
37 If[held[[i]],
38 st = Max[ff, el[[i]]]; h += st - ff; t = st + svc[i, cap];
39 xs[[i]] = st; xd[[i]] = t; xv[[i]] = 1; xa[[i]] = acc[i, cap, r]; dd = t,
40 If[e[[i]] > ff, h += e[[i]] - ff; dd = e[[i]]]; xd[[i]] = e[[i]]]], {i, n}];
41 {xs, xd, xv, xa, h}];
42 elig[cap_, r_] := Module[{t = d0, xs = ConstantArray[0, n], xd = ConstantArray[0, n],
43 xv = ConstantArray[0, n], xa = ConstantArray[0, n], pend, ct, b},
44 Do[Which[drop[i, r], xd[[i]] = a[[i]], held[[i]], xv[[i]] = -1, True, xd[[i]] = e[[i]]], {i, n}];
45 While[(pend = Flatten[Position[xv, -1]]) =!= {},
46 ct = Map[Function[j, If[sq[[j]] == 1,
47 If[xv[[j - 1]] == -1, Infinity, Max[t, ar[[j]], el[[j]], xd[[j - 1]] + gp[[j]]]],
48 Max[t, ar[[j]], el[[j]]]]], pend];
49 b = pend[[First[Flatten[Position[ct, Min[ct]]]]]];
50 xs[[b]] = Min[ct]; xd[[b]] = xs[[b]] + svc[b, cap]; xv[[b]] = 1; xa[[b]] = acc[b, cap, r];
51 t = xd[[b]]];
52 {xs, xd, xv, xa, 0}];
53 cfg = {{0, 0, False}, {1, 0, False}, {1, 1, False}, {1, 0, True}, {1, 1, True}};
54 arms = Map[If[#[[3]], elig[#[[1]], #[[2]]], fcfs[#[[1]], #[[2]]]] &, cfg];
55 ovl[x_] := Module[{srv = Flatten[Position[x[[3]], 1]]},
56 Count[Subsets[srv, {2}], {i_, j_} /; x[[1, i]] < x[[2, j]] && x[[1, j]] < x[[2, i]]]];
57 mq[x_] := Max[Table[Count[Range[n], j_ /; ar[[j]] <= ar[[i]] && ar[[i]] < x[[2, j]]], {i, n}]];
58 met[m_] := Module[{x = arms[[m]], r = cfg[[m, 2]], srv},
59 srv = Flatten[Position[x[[3]], 1]];
60 StringJoin["QF arm=", names[[m]],
61 " served=", ToString[Length[srv]],
62 " acc=", ToString[Total[x[[4]]]],
63 " dropped=", ToString[Count[Range[n], i_ /; drop[i, r]]],
64 " lostacc=", ToString[Count[Range[n], i_ /; ac[[i]] == 1 && x[[4, i]] == 0]],
65 " busy=", ToString[Total[x[[2, srv]] - x[[1, srv]]]],
66 " useful=", ToString[Total[Map[If[x[[4, #]] == 1, x[[2, #]] - x[[1, #]], 0] &, Range[n]]]],
67 " hol=", ToString[x[[5]]],
68 " mina=", ToString[Min[a]],
69 " maxdep=", ToString[Max[x[[2]]]],
70 " soj=", ToString[Total[x[[2]] - ar]],
71 " viol=", ToString[Count[x[[2]] - ar, _?Negative]],
72 " overlap=", ToString[ovl[x]],
73 " maxq=", ToString[mq[x]],
74 " replayerr=", ToString[If[m == 1, Count[Range[n], i_ /; held[[i]] && x[[1, i]] != s[[i]]], 0]]]];
75 K = Select[Range[n], Function[i, AllTrue[arms, #[[4, i]] == 1 &]]];
76 kl[m_] := Module[{ww = Sort[arms[[m, 1, K]] - a[[K]]], k = Length[K]},
77 StringJoin["QF K arm=", names[[m]], " n=", ToString[k], " sumw=", ToString[Total[ww]],
78 If[k > 0, StringJoin[" p95=", ToString[Quantile[ww, 95/100]], " maxw=", ToString[Max[ww]]], ""]]];
79 cmp[x_, y_] := Module[{dx = arms[[x, 1, K]] - arms[[y, 1, K]]},
80 StringJoin["QF cmp x=", names[[x]], " y=", names[[y]],
81 " worse60=", ToString[Count[dx, _?(# > 60 &)]], " better60=", ToString[Count[dx, _?(# < -60 &)]]]];
82 nm = Count[held, True];
83 Join[{StringJoin["QF trace rows=", ToString[n], " held=", ToString[nm], " anomalies=", ToString[an],
84 " retries=", ToString[nr], " d0=", ToString[d0]]},
85 Map[met, Range[5]], Map[kl, Range[5]], {cmp[5, 2], cmp[4, 2], cmp[2, 1]}]]