Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/openaccel-lab/blob/main/bin/oal-board # openaccel-lab aien-dev/openaccel-lab Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `openaccel-lab / bin / oal-board` 126 lines ยท 5823 bytes Raw Blame History 1 #!/usr/bin/env python3 2 # SPDX-License-Identifier: Apache-2.0 3 # oal-board [--receipts DIR] RESULTS.jsonl... > site/data.json 4 # Fold oal-matrix results (and imported GPU receipts) into the dashboard data file. Distributions 5 # only: every timing cell is min/p10/p25/median/p75/p90/max with its sample count, never a mean. 6 # Exit 0, or 2 on a usage error. 7 # INTERIM host glue (Python + numpy). Successor: oal-board in seeded Omega. 8 import os 9 import sys 10 sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.realpath(__file__)))) 11 import argparse 12 import collections 13 import glob 14 import json 15 import time 16 17 import numpy as np 18 19 from oal import manifest 20 21 ap = argparse.ArgumentParser(prog="oal-board") 22 ap.add_argument("--receipts", default=os.path.join(manifest.ROOT, "receipts")) 23 ap.add_argument("files", nargs="*") 24 a = ap.parse_args() 25 26 QS = (0, 10, 25, 50, 75, 90, 100) 27 28 29 def dist(xs): 30 if not xs: 31 return None 32 v = np.asarray(xs, dtype=np.float64) 33 return {"n": int(v.size), "q": [float(x) for x in np.percentile(v, QS)]} 34 35 36 recs = [] 37 for path in a.files: 38 if path.endswith(".shrink.jsonl"): 39 continue 40 with open(path) as f: 41 recs += [json.loads(l) for l in f if l.strip()] 42 gpu_jsonl = sorted(glob.glob(os.path.join(a.receipts, "gpu", "*.jsonl"))) 43 for path in gpu_jsonl: 44 with open(path) as f: 45 for l in f: 46 if l.strip(): 47 r = json.loads(l) 48 r["_receipt"] = os.path.relpath(path, manifest.ROOT) 49 recs.append(r) 50 51 cells = collections.OrderedDict() 52 outs_by_case = collections.defaultdict(lambda: collections.defaultdict(set)) 53 for r in recs: 54 mach = r["machine"] 55 where = r["machine"].get("runner") or mach["arch"] 56 key = (r["workload"], r["backend"], where) 57 c = cells.setdefault(key, {"workload": r["workload"], "backend": r["backend"], "runner": where, 58 "arch": mach["arch"], "cpu": mach.get("cpu"), "control": r["control"], 59 "expect": r.get("expect", "pass"), "status": collections.Counter(), 60 "err": [], "time_default": [], "time_label": r.get("timing_label"), 61 "evidence": r.get("evidence"), "versions": set(), "toolchain": r.get("toolchain"), 62 "first_failure": None, "run_url": mach.get("run_url"), 63 "receipt": r.get("_receipt")}) 64 c["status"][r["status"]] += 1 65 if r.get("err_ratio") is not None: 66 c["err"].append(r["err_ratio"]) 67 for v in r.get("versions", []): 68 c["versions"].add(v) 69 m = manifest.load(r["workload"]) 70 if r["status"] == "PASS" and r["params"] == manifest.params_of(m): 71 c["time_default"] += r.get("times_ns", []) 72 if r["status"] not in ("PASS", "NO_SOURCE", "COMPILED") and c["first_failure"] is None: 73 bad = next((o.get("first_bad") for o in r.get("outputs", []) if not o.get("pass", True)), None) 74 c["first_failure"] = {"status": r["status"], "params": r["params"], "seed": r["seed"], 75 "first_bad": bad, "log": (r.get("log") or "")[-400:]} 76 if r.get("outputs_sha256"): 77 outs_by_case[(r["workload"], r["case_sha256"])][r["outputs_sha256"]].add(r["backend"]) 78 79 workloads = {} 80 for name in manifest.all_names(include_controls=True): 81 m = manifest.load(name) 82 workloads[name] = {"family": m.get("family"), "summary": m.get("summary"), "control": m["_control"], 83 "expect": m.get("expect", "pass"), "reference_from": m.get("reference_from"), 84 "params": manifest.params_of(m), "cases": len(m.get("cases", [{}])), 85 "tolerance": {k: {kk: vv for kk, vv in v.items()} for k, v in m["tolerance"].items()}, 86 "provenance": m.get("provenance")} 87 88 agree = {} 89 for (w, _), groups in outs_by_case.items(): 90 a_ = agree.setdefault(w, {"cases": 0, "distinct_hist": collections.Counter()}) 91 a_["cases"] += 1 92 a_["distinct_hist"][len(groups)] += 1 93 94 shrunk = [] 95 for path in sorted(glob.glob(os.path.join(a.receipts, "shrink", "*.jsonl"))) + [ 96 p for p in a.files if p.endswith(".shrink.jsonl")]: 97 with open(path) as f: 98 shrunk += [json.loads(l) for l in f if l.strip()] 99 100 imported = [] 101 for path in sorted(glob.glob(os.path.join(a.receipts, "imported", "*", "*.json"))): 102 rc = json.load(open(path)) 103 for res in rc.get("results", []): 104 imported.append({"gpu": rc["machine"].get("gpu"), "cc": rc["machine"].get("cc"), 105 "driver": rc["machine"].get("driver_version"), "provider": rc.get("provider"), 106 "kernel": res.get("cubin"), "kind": res.get("kind"), "verdict": res.get("verdict"), 107 "checked": res.get("checked"), "mismatches": res.get("mismatches"), 108 "kernel_ms": res.get("kernel_ms"), "receipt": os.path.relpath(path, manifest.ROOT), 109 "receipt_sha256": rc.get("receipt_sha256"), 110 "label": "rented GPU, imported receipt from aien-dev/omega-gpu-bench"}) 111 112 out_cells = [] 113 for c in cells.values(): 114 c = dict(c) 115 c["status"] = dict(c["status"]) 116 c["err"] = dist(c["err"]) 117 c["time_default"] = dist(c["time_default"]) 118 c["versions"] = sorted(c["versions"]) 119 out_cells.append(c) 120 121 json.dump({"schema": "oal-board/1", "generated": int(time.time()), 122 "lab_commit": next((r.get("lab_commit") for r in recs if r.get("lab_commit")), None), 123 "quantiles": list(QS), "workloads": workloads, "cells": out_cells, 124 "agreement": {w: {"cases": v["cases"], "distinct_hist": dict(v["distinct_hist"])} for w, v in agree.items()}, 125 "shrunk": shrunk, "imported_gpu": imported}, sys.stdout, indent=1, sort_keys=True) 126 sys.stdout.write("\n")