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 / raw / amd-launch-gap / card / run3 / final / logs / gap-verdict.py
| 1 | # Instrument (not Omega): per-run ids and timing verdicts for the launch-gap card run. |
| 2 | # Usage: gap-verdict.py LOGDIR PUBLISHED_IDS.json Prints one line per run and writes verdict.json. |
| 3 | import json,re,statistics,sys |
| 4 | from pathlib import Path |
| 5 | d=Path(sys.argv[1]);pub=json.loads(Path(sys.argv[2]).read_text())['ids'] |
| 6 | rows=[];ok=True |
| 7 | for f in sorted(d.glob('omega-*.txt')): |
| 8 | t=f.read_text() |
| 9 | steps=[(int(a),int(b),int(c)) for a,b,c in re.findall(r'^OMEGA_STEP (\d+) tok=(-?\d+) us=(\d+)$',t,re.M)] |
| 10 | m=re.search(r'^OMEGA_PLAN ids=\[([0-9,-]+)\]$',t,re.M) |
| 11 | ids=[int(x) for x in m.group(1).split(',')] if m else None |
| 12 | us=[u for _,_,u in steps] |
| 13 | row=dict(run=f.stem,steps=len(steps),complete='OMEGA_PLAN complete' in t,ids_equal_published=ids==pub, |
| 14 | first_difference=None if ids is None or ids==pub else next((i for i,(a,b) in enumerate(zip(ids,pub)) if a!=b),len(ids)), |
| 15 | prefill_us=sum(us[:30]),decode_us=us[30:],decode_median_us=statistics.median(us[30:]) if len(us)>30 else None) |
| 16 | control='control' in f.stem |
| 17 | row['verdict']=('CAUGHT' if control and ids is not None and ids!=pub else 'ESCAPED' if control else |
| 18 | 'PASS' if ids==pub and len(steps)==285 else 'FAIL') |
| 19 | ok&=row['verdict'] in ('PASS','CAUGHT');rows.append(row) |
| 20 | for f in sorted(d.glob('hip-*.json')): |
| 21 | v=json.loads(f.read_text()) |
| 22 | row=dict(run=f.stem,ids_equal_published=v['ids']==pub,decode_ms=v['decode_ms'],decode_median_ms=v['decode_ms_median']) |
| 23 | row['verdict']='PASS' if v['ids']==pub and len(v['decode_ms'])==255 else 'FAIL' |
| 24 | ok&=row['verdict']=='PASS';rows.append(row) |
| 25 | for r in rows: |
| 26 | print('VERDICT',r['run'],r['verdict'],'ids_equal_published=%s'%r['ids_equal_published'], |
| 27 | 'decode_median=%s'%(r.get('decode_median_us') if 'decode_median_us' in r else r.get('decode_median_ms'))) |
| 28 | (d/'verdict.json').write_text(json.dumps(dict(ok=ok,rows=rows))+'\n') |
| 29 | print('GAP_VERDICT','PASS' if ok else 'FAIL',len(rows),'runs') |