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 / prime-drag-race / CONTRACT.md

135 lines · 8114 bytes Raw Blame History Rendered
1# AIEN Prime Drag Race: benchmark contract (version 1)
2
3This contract is frozen. Any change to a rule below is a new contract version.
4The runner in this directory enforces it. Contract version string: `1`.
5
6Amendment of 2026-10-15: the CUDA yardstick class and the CUDA mirror label were removed. AIEN does
7not compare itself with other people's systems: speed is measured against the machine's physical
8limit, and correctness against our own reference. The rules the runner enforces did not change, so
9the contract version string stays `1`.
10
11## What is measured
12
13Sieve all primes up to a limit (default 1,000,000), over and over, for at least a minimum time
14(default 5 seconds), and count how many complete passes finish. The score is passes per second.
15Higher is faster.
16
17## The canonical result
18
19For limit L, only odd numbers are stored. Bit k (word k/64, bit k%64, little-endian 64-bit words,
20which is the same bytes as little-endian 32-bit words) is set exactly when 2k+1 is prime, for
210 <= k < (L+1)/2. All bits past that range are zero. The prime 2 is implicit when L >= 2. The count
22of primes is the number of set bits plus 1 when L >= 2. For L = 1,000,000 the count is 78,498.
23
24The runner builds this result itself with an independent reference: deterministic Miller-Rabin on
25every odd number up to L (bases 2, 3, 5, 7 below 3,215,031,751, otherwise the first 12 primes, with
26128-bit multiplication). The reference is checked against trial division and the known prime counts
27(10:4, 100:25, 1,000:168, 10,000:1,229, 100,000:9,592, 1,000,000:78,498, 10,000,000:664,579).
28
29## What one pass includes
30
31Everything needed to go from nothing to a complete result that the host can read: reset or allocate
32the sieve state, compute the base primes up to sqrt(L) (for GPUs, on the host, written into a
33device-visible buffer), launch the work, wait for confirmed completion, and have the result sitting
34in host-readable memory. Excluded: process start, one-time setup (opening a GPU session, uploading
35kernel code, allocating persistent buffers), and the final export and checking of the answer.
36A CPU pass allocates a fresh zeroed sieve each time (faithful). A GPU pass that keeps persistent
37buffers is marked not faithful.
38
39## Implementation interface
40
41`<impl> [--limit N] [--min-seconds S] [--bitmap-out PATH] [--report-out PATH] [--audit-passes K]`
42
43- Timed mode: loop passes against a monotonic clock until S seconds have passed. Elapsed is the
44 actual time spent. After the loop, outside the timing, export the last pass's canonical bitmap and
45 write the report. Print exactly one line on stdout, and only on success:
46 `<label>;<passes>;<elapsed %.6f>;<threads>;algorithm=..,faithful=..,bits=..`
47 The label is `aien-` followed by the implementation name. Everything else goes to stderr.
48- Audit mode (K passes): run K full passes and append each pass's canonical bitmap to the bitmap
49 file in order. This proves each pass recomputes the answer and does not reuse an old one.
50- Failure: no stdout line, report status `EXEC_FAILED`, exit code 2. Usage errors exit 64.
51- Report: JSON, schema `aien-prime-race/impl-report/v1`, with fields impl, label, algorithm,
52 faithful, bits, threads, environment, limit, min_seconds, mode (`timed` or `audit`), passes,
53 elapsed_s, status (`COMPLETE`), error, build, and an implementation-specific detail object.
54
55## Labels
56
57Each implementation declares its tags to the runner (`--declare`). The runner rejects any run whose
58line or report differs from the declaration or from each other. Known declarations:
59
60- `cpu-c-base`: algorithm=base, faithful=yes, bits=1, threads=1.
61- `gb10-native`: algorithm=other, faithful=no, bits=1, threads = launched GPU threads.
62
63## Timing rules
64
65Monotonic clock only. GPU work counts only after completion is confirmed. Kernel-only time is
66recorded as a diagnostic and is never the score.
67
68## Trial protocol
69
70Sequential, one machine, under the owner's quiet flag with nothing else running. Per implementation:
71one audit run (K=5), one discarded warm-up run, then 10 timed trials of at least 5 seconds each.
72Trials are interleaved round-robin across implementations (A,B,C,A,B,C,...) to spread drift.
73Per trial the runner records passes per second, the raw line, the report, and the load average
74before and after. Statistics (median, min, max, mean, sample standard deviation, coefficient of
75variation of passes per second) are computed only when every audit and trial passed.
76
77`prime_race run` emits qualification receipts only for the frozen counts and requested minimum:
78exactly K=5, one warm-up, 10 timed trials and a finite minimum of at least 5 seconds, with at
79least one implementation. A timed run fails unless the runner's own monotonic wall time is at
80least both the requested minimum and the elapsed time the implementation reported, so a
81self-reported duration alone cannot qualify. The runner also refuses a missing or empty operator
82quiet flag before writing evidence, records the marker it checked, and fails the run if the marker
83is removed or changed by the end. A nonempty, unchanged file is necessary recorded context,
84**not** proof of an actually exclusive machine; the owner must authorize and maintain that window
85separately, and the receipt says so in `conditions.quiet_flag_semantics`. Use
86`prime_race verify` for a bounded correctness check rather than calling an audit-only run PASS.
87
88## Correctness gates (before any speed number)
89
901. Exit code 0, exactly one valid stdout line, status COMPLETE, passes >= 1, elapsed >= min seconds.
912. Line fields equal report fields. Label and tags equal the declaration.
923. Bitmap length exact and byte-for-byte equal to the reference. A mismatch reports the first
93 differing odd number, or tail garbage.
944. Audit mode: every one of the K bitmaps equals the reference.
955. Sweep (`prime_race verify`): limits 0 to 5, 8, 9, 15, 25, 31 to 34, 49, 63 to 66, 95 to 97, 121,
96 127 to 130, 169, 255 to 258, 289, 361, 961, 1023 to 1025, 1999 to 2001, 4095 to 4097, word and
97 block boundaries plus and minus 1, every prime square p^2 and p^2 plus or minus 1 up to p = 997,
98 999,983 to 1,000,003, and 1,000,000. The 10,000,000 limit is a scaling check run separately.
99
100A failing run produces a FAIL receipt with all evidence kept, and no statistics.
101
102## Receipts
103
104Schema `aien-prime-race/receipt/v1`. One JSON file named by the SHA-256 of its own bytes, mode 0444,
105never overwritten, never written inside a source checkout. Raw stdout, stderr, reports and bitmaps
106are stored as `blobs/<sha256>` and referenced by digest. A receipt records verdict and reason,
107implementation identity (binary SHA-256, source repo and commit, build command and flags),
108runner commit and binary hash, hardware (CPU model, GPU name, UUID and driver, kernel), conditions
109(quiet flag contents, load averages, CPU governor), correctness evidence, every raw trial, summary
110statistics (PASS only), the upstream-style lines, and reproduction commands.
111
112## Environment classes
113
114Results are only comparable inside one class:
115
1161. Host CPU (`linux-host-cpu`).
1172. Linux-hosted GB10, native AIEN path (`linux-hosted-gb10-native`).
1183. AIENOS booted natively: not yet measured.
119
120## Upstream relationship
121
122The format follows the upstream Drag Race, PlummersSoftwareLLC/Primes `drag-race`, pinned at
123commit a2899c96752b65ac1b08a0e1418ab7e708040ed0. Our entries are NONCONFORMING for upstream:
124our license is Apache-2.0 where upstream requires BSD-3-Clause, and the native GPU entry
125uses a language upstream does not accept. They are published as experimental, never as upstream
126leaderboard entries. We do not compare our scores with upstream entries.
127
128## Running it
129
130 cargo build --release # in this directory
131 prime_race verify --impl ./cpu_base --name cpu-c-base \
132 --declare algorithm=base,faithful=yes,bits=1,threads=1
133 prime_race run --impl cpu-c-base=./cpu_base --declare cpu-c-base=algorithm=base,faithful=yes,bits=1,threads=1 \
134 --source cpu-c-base=aien-spark/omega@COMMIT --build 'cpu-c-base=cc -O3 -mcpu=native ...' \
135 --evidence-dir ~/workspace/evidence/prime-race