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-qwen38-native-final-20261113 / oracle / run-all.py
| 1 | # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | from pathlib import Path |
| 3 | import hashlib,json,os,runpy,shutil,subprocess,sys,tarfile,traceback,zipfile |
| 4 | D=Path(__file__).resolve().parent;os.chdir(D) |
| 5 | job={'phase':'verify'} |
| 6 | def snapshot(): |
| 7 | files=[p for p in D.rglob('*') if p.is_file() and 'source' not in p.relative_to(D).parts and p.suffix in ('.py','.json','.stdout','.stderr','.txt','.mark')] |
| 8 | files += [D/'omega-launch',D/'vadd-lds.hsaco',D/'vadd.hsaco'] |
| 9 | tmp=D.parent/'rcca-results.tmp' |
| 10 | with zipfile.ZipFile(tmp,'w',zipfile.ZIP_DEFLATED) as z: |
| 11 | for p in files:z.write(p,str(p.relative_to(D))) |
| 12 | z.writestr('DELIVERY_SHA256.json',json.dumps({str(p.relative_to(D)):hashlib.sha256(p.read_bytes()).hexdigest() for p in files},indent=2)) |
| 13 | tmp.replace(D.parent/'omega-rcca-results.zip') |
| 14 | def save(): |
| 15 | (D/'job-state.json').write_text(json.dumps(job,indent=2));print(json.dumps(job),flush=True);snapshot() |
| 16 | try: |
| 17 | for n,h in json.loads((D/'MANIFEST.json').read_text()).items():assert hashlib.sha256((D/n).read_bytes()).hexdigest()==h,n |
| 18 | S=D/'source';S.mkdir(exist_ok=True) |
| 19 | with tarfile.open(D/'cap-data.tar.xz','r:xz') as z: |
| 20 | for m in z.getmembers(): |
| 21 | assert m.isfile() and Path(m.name).name==m.name |
| 22 | (S/m.name).write_bytes(z.extractfile(m).read()) |
| 23 | manifest=json.loads((S/'MANIFEST.json').read_text()) |
| 24 | for n,h in manifest.items():assert hashlib.sha256((S/n).read_bytes()).hexdigest()==h,n |
| 25 | (S/'MANIFEST.original.json').write_bytes((S/'MANIFEST.json').read_bytes()) |
| 26 | shutil.copytree(D/'code',S/'code',dirs_exist_ok=True);shutil.copyfile(D/'omega-launch',S/'omega-launch');(S/'omega-launch').chmod(0o755) |
| 27 | manifest['omega-launch']=hashlib.sha256((S/'omega-launch').read_bytes()).hexdigest();(S/'MANIFEST.json').write_text(json.dumps(manifest)) |
| 28 | job['phase']='checkpoint';save();runpy.run_path(str(D/'driver-real2.py'),run_name='prepare-import')['prepare']() |
| 29 | job['phase']='nonzero-LDS';save() |
| 30 | for name in ('vadd-lds.hsaco','vadd.hsaco'): |
| 31 | p=subprocess.run([str(S/'omega-launch'),'vadd',str(D/name),'vadd','10000000000'],capture_output=True,timeout=120) |
| 32 | (D/(name+'.stdout')).write_bytes(p.stdout);(D/(name+'.stderr')).write_bytes(p.stderr) |
| 33 | assert p.returncode==0 and b'OMEGA vadd=PASS count=256' in p.stdout,(name,p.returncode) |
| 34 | job['phase']='coding24';save() |
| 35 | with (D/'coding24-check.stdout').open('w') as o,(D/'coding24-check.stderr').open('w') as e: |
| 36 | p=subprocess.run([sys.executable,str(D/'coding24-check.py')],stdout=o,stderr=e,timeout=300) |
| 37 | assert p.returncode==0 and json.loads((D/'coding24.json').read_text())['phase']=='complete' |
| 38 | job['phase']='lighthouse-five';save() |
| 39 | env=dict(os.environ,SOURCE_PLAN_DIR=str(S),HIP_ORACLE_JSON=str(D/'independent-hip-graph.json')) |
| 40 | with (D/'benchmark.stdout').open('w') as o,(D/'benchmark.stderr').open('w') as e: |
| 41 | p=subprocess.run([sys.executable,str(D/'benchmark-qualified.py')],stdout=o,stderr=e,env=env,timeout=900) |
| 42 | assert p.returncode==0 and json.loads((D/'state.json').read_text())['phase']=='complete' |
| 43 | job['phase']='complete';save() |
| 44 | except BaseException: |
| 45 | job.update(phase='exception',detail=traceback.format_exc());save();raise |