CUDApp
CUDA++: AIEN’s GPU machine-code toolchain, runtime and driver client for NVIDIA GPUs without the CUDA toolkit. Hardware coverage and driver replacement limits are explicit.
Brought by drakestapleton
CUDApp / evidence / amd-speed-20261114 / recompute / build_numbers.py
| 1 | #!/usr/bin/env python3 |
| 2 | # Merge out/<topic>.json into ../numbers.json, plus the quoted constants (constants.json). |
| 3 | # The output depends only on the evidence and these scripts: no clock, no dependence on the previous file, and the file is |
| 4 | # rewritten only when its bytes would change. A source whose sha256 differs from the previous numbers.json is printed |
| 5 | # (STALE), not stored. |
| 6 | import json |
| 7 | from common import HERE, OUT |
| 8 | |
| 9 | p = HERE.parent / 'numbers.json' |
| 10 | old = p.read_text() if p.exists() else None |
| 11 | prev = {} |
| 12 | if old: |
| 13 | for n in json.loads(old)['numbers']: |
| 14 | for s in n.get('sources', []): |
| 15 | prev[(n['id'], s['path'])] = s.get('sha256') |
| 16 | nums = [] |
| 17 | for t in ['baseline', 'launcher', 'kernels', 'fourbit', 'specdecode', 'combined', 'sessions']: |
| 18 | nums += json.loads((OUT / f'{t}.json').read_text()) |
| 19 | for c in json.loads((HERE / 'constants.json').read_text()): |
| 20 | c = dict(c) |
| 21 | c['recompute'] = 'quoted, not recomputed' |
| 22 | nums.append(c) |
| 23 | changed = sorted({f'{n["id"]} {s["path"]}' for n in nums for s in n.get('sources', []) |
| 24 | if (n['id'], s['path']) in prev and prev[(n['id'], s['path'])] != s.get('sha256')}) |
| 25 | doc = dict(note='Every number checked in REPORT.md, with its label, unit, source files and the script that recomputes it. ' |
| 26 | 'Source paths are relative to the evidence root: raw/ in the publication folder (the handoff folder where the ' |
| 27 | 'report was built). A source with "base": "report folder" is relative to the folder that holds REPORT.md. ' |
| 28 | 'MEASURED: read from a raw card or CPU log. DERIVED: arithmetic on MEASURED values. MODELED: computed from ' |
| 29 | 'stated assumptions. COUNT: integer bookkeeping. RECORD: state or hash. QUOTED: a figure taken from a named ' |
| 30 | 'source file and not recomputed here (constants.json). Where that source is a lane\'s notes (amd-launch-gap/RCCA.md, ' |
| 31 | 'a lane\'s RESULT.md, spec-decode/model/), the file is not in the publication folder.', |
| 32 | numbers=nums) |
| 33 | new = json.dumps(doc, indent=1) + '\n' |
| 34 | if new != old: |
| 35 | p.write_text(new) |
| 36 | print(f'NUMBERS {len(nums)} {"unchanged" if new == old else "written"}; sources changed since last build: {len(changed)}') |
| 37 | for c in changed: |
| 38 | print(' STALE', c) |