interplane.Get Omega
Read in your language

omega-gpu-bench

First-party Omega GPU kernel benchmark harness and receipts

Brought by drakestapleton

branch main Branches Tags History

omega-gpu-bench / tools / board.py

126 lines · 7367 bytes Raw Blame History
1#!/usr/bin/env python3
2# tools/board.py -- build the static leaderboard (site/index.html, site/receipts.json) from receipts/*.json.
3# Only receipts that pass tools/validate.py are shown; the page states how many were left out.
4# board.py [OUT_DIR] (default: site)
5# INTERIM host glue (Python); Omega successor: the page generated by an omc-built program, the way
6# aienos.com pages are rendered from seeded Omega (skill render-page-from-omega).
7import glob, html, json, os, sys
8
9ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
10sys.path.insert(0, os.path.join(ROOT, "tools"))
11import receipt as R # noqa: E402
12import validate as V # noqa: E402
13
14BLOB = "https://github.com/%s/blob/main/" % R.REPO
15CMD = "git clone https://github.com/%s && cd omega-gpu-bench && ./run" % R.REPO
16E = html.escape
17
18
19def best(rec):
20 rates = [r["gbps"] for r in rec["results"] if r["verdict"] == "PASS" and r["gbps"]]
21 return max(rates) if rates else None
22
23
24def kernels(rec):
25 cells = []
26 for r in rec["results"]:
27 ok = r["verdict"] in ("PASS", "NEG_DETECTED")
28 sm = r["cubin"].split("_")[1]
29 cells.append('<span class="%s" title="%s">%s %s %s</span>' % (
30 "ok" if ok else "bad", E(r["error"] or "%s of %s words differ" % (r["mismatches"], r["checked"])),
31 E(r["kind"]), E(sm), E(r["verdict"])))
32 return " ".join(cells)
33
34
35def main():
36 out = sys.argv[1] if len(sys.argv) > 1 else os.path.join(ROOT, "site")
37 c = V.Checker(ROOT, os.path.join(ROOT, "kernels", "SHA256SUMS"),
38 os.path.join(ROOT, "receipts", "imports.sha256"), False)
39 good, rejected = [], []
40 for path in sorted(glob.glob(os.path.join(ROOT, "receipts", "*.json"))):
41 try:
42 rec = json.load(open(path))
43 errs = c.check(rec)
44 except ValueError as x:
45 errs = [str(x)]
46 (rejected if errs else good).append((os.path.relpath(path, ROOT), rec if not errs else None))
47 ran = [(p, r) for p, r in good if r["results"]]
48 ran.sort(key=lambda pr: (pr[1]["origin"] != "kit-run", -(best(pr[1]) or 0), pr[1]["run"]["utc"]))
49 rows = []
50 for i, (p, r) in enumerate(ran, 1):
51 m, g = r["machine"], best(r)
52 origin = ("kit run, self-reported" if r["origin"] == "kit-run"
53 else "imported CloudKernels run (before the kit)")
54 rows.append("<tr><td>%d</td><td>%s<br><small>sm_%s</small></td><td>%s<br><small>CUDA driver API %s</small></td>"
55 "<td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td><a href=\"%s\">%s</a></td></tr>" % (
56 i, E(m["gpu"]), E(m["cc"].replace(".", "")), E(m["driver_version"] or "?"),
57 E(str(m["cuda_driver_api"])), E(r["provider"]), E(origin), kernels(r),
58 ("%.1f GB/s<br><small>%.3f ms per launch</small>" % (
59 g, min(x["kernel_ms"] for x in r["results"] if x["gbps"] == g)) if g else "not timed"),
60 E(r["run"]["utc"][:10]), E(BLOB + p), E(r["receipt_sha256"][:12])))
61 waiting = ["<li>%s (sm_%s), driver %s: %s</li>" % (E(r["machine"]["gpu"]), E(r["machine"]["cc"].replace(".", "")),
62 E(r["machine"]["driver_version"] or "?"), E(r["not_run"]))
63 for p, r in good if not r["results"]]
64 page = TEMPLATE.format(
65 cmd=E(CMD), repo=E(R.REPO), path=E(R.PATH_LABEL), rows="\n".join(rows) or
66 '<tr><td colspan="9">No receipts yet.</td></tr>',
67 waiting=("<h2>Cards without a kernel yet</h2><ul>%s</ul>" % "".join(waiting)) if waiting else "",
68 nvalid=len(good), nrej=len(rejected))
69 os.makedirs(out, exist_ok=True)
70 with open(os.path.join(out, "index.html"), "w") as f:
71 f.write(page)
72 with open(os.path.join(out, "receipts.json"), "w") as f:
73 json.dump([r for _, r in good], f, indent=1, sort_keys=True)
74 print("board: %d receipts shown, %d rejected -> %s" % (len(good), len(rejected), out))
75 for p, _ in rejected:
76 print(" rejected " + p)
77
78
79TEMPLATE = """<!doctype html>
80<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
81<title>Omega GPU bench: bring your own NVIDIA GPU</title>
82<style>
83body{{font:15px/1.5 system-ui,sans-serif;max-width:72rem;margin:2rem auto;padding:0 1rem;color:#111;background:#fff}}
84code,pre{{font:13px ui-monospace,monospace;background:#f3f3f3;padding:.1rem .3rem;border-radius:3px}}
85pre{{padding:.7rem;overflow-x:auto}} table{{border-collapse:collapse;width:100%;font-size:14px}}
86th,td{{border-bottom:1px solid #ddd;padding:.45rem;text-align:left;vertical-align:top}} small{{color:#555}}
87.ok{{color:#065f46;white-space:nowrap}} .bad{{color:#b91c1c;font-weight:600;white-space:nowrap}}
88.note{{border-left:3px solid #999;padding:.2rem .8rem;color:#333}}
89@media (prefers-color-scheme:dark){{body{{background:#111;color:#eee}}code,pre{{background:#222}}
90th,td{{border-color:#333}}small,.note{{color:#bbb}}.ok{{color:#6ee7b7}}.bad{{color:#fca5a5}}}}
91</style></head><body>
92<h1>Omega GPU bench</h1>
93<p>Run kernels whose machine code was written by Omega on your own NVIDIA GPU, check every output word
94against a CPU reference, and put your card on this board. You need an NVIDIA driver, Python 3 and git.
95No CUDA toolkit, no compiler, no pip install.</p>
96<p class="note"><b>Kernels withdrawn.</b> The six v7 cubins and the cubin writer that produced them were
97removed pending clean-room rewrite (CudaLicenseRisk Q6). Until it lands, <code>./run</code> reports NOT_RUN
98on every GPU and writes no receipt. The rows below are kept unchanged as historical records; the kernels they
99hash are withdrawn, and no new run of them is accepted.</p>
100<pre>{cmd}</pre>
101<p>Once the kit ships kernels again, it writes a receipt under <code>receipts/</code>. Open a pull request
102with it to <a href="https://github.com/{repo}">github.com/{repo}</a>; CI checks it and, once merged, it shows
103up here.</p>
104<p class="note"><b>What runs where.</b> The withdrawn kernels were SASS assembled by Omega's <code>asm2</code>
105from a hand-written listing and wrapped into a cubin. They reached the GPU through {path}. Receipts are
106self-reported: CI checks the kernel hashes, counts, verdicts, every reported reference value (recomputed from
107the public seed), the output hash of a clean run, and the GB/s arithmetic, but nobody re-ran your GPU. The
108three seed rows are my own rentals on vast through OpenResearch on 2026-10-26, run before this kit existed;
109they were not timed.</p>
110<h2>Board</h2>
111<table><thead><tr><th>#</th><th>GPU</th><th>Driver</th><th>Where</th><th>Origin</th><th>Kernels</th>
112<th>vecadd speed (2<sup>26</sup> words)</th><th>Date</th><th>Receipt</th></tr></thead>
113<tbody>
114{rows}
115</tbody></table>
116<p><small>vecadd: c[i] = a[i] + b[i] on 2<sup>20</sup> + 7 words, every word compared. neg: the same kernel with one
117register changed, which must be caught (NEG_DETECTED). Speed: median of 5 rounds of 20 launches timed with CUDA
118events, 12 bytes moved per word. {nvalid} receipts shown, {nrej} rejected by the validator.</small></p>
119{waiting}
120<p><small>Source, rules and validator: <a href="https://github.com/{repo}">github.com/{repo}</a>.
121Machine-readable: <a href="receipts.json">receipts.json</a>.</small></p>
122</body></html>
123"""
124
125if __name__ == "__main__":
126 main()