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/CUDApp/blob/main/evidence/amd-qwen38-native-compatible-20261113/verify.py # 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 Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `CUDApp / evidence / amd-qwen38-native-compatible-20261113 / verify.py` 47 lines · 3571 bytes Raw Blame History 1 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 2 # External evidence verifier, not a production dependency. 3 from pathlib import Path 4 import ast,hashlib,json,math,re,subprocess,sys,statistics 5 D=Path(__file__).resolve().parent 6 hashes=json.loads((D/'SHA256.json').read_text()) 7 actual={str(f.relative_to(D)) for f in D.rglob('*') if f.is_file() and f.name!='SHA256.json'} 8 assert actual==set(hashes),(actual-set(hashes),set(hashes)-actual) 9 for name,digest in hashes.items():assert hashlib.sha256((D/name).read_bytes()).hexdigest()==digest,name 10 for name,entry in json.loads((D/'oracle/ORIGINAL_SCRIPTS.json').read_text()).items(): 11 raw=(D/name).read_bytes();prefix=entry['portable_prefix'].encode();assert raw.startswith(prefix) 12 assert hashlib.sha256(raw[len(prefix):]).hexdigest()==entry['original_sha256'],name 13 v=json.loads((D/'native/state.json').read_text());h=json.loads((D/'numerical/graph.json').read_text());f=json.loads((D/'oracle/lighthouse256.json').read_text()) 14 assert h['capacity']==f['capacity']==131072 and len(h['ids'])==256 15 assert h['fixture_sha256']==hashlib.sha256((D/'oracle/lighthouse256.json').read_bytes()).hexdigest() 16 assert h['first_divergence']==109 17 for token,top in zip(h['ids'],h['top5']): 18 assert token==top[0][0] and all(math.isfinite(score) for _,score in top) 19 for label in ['control']+[r['label'] for r in v['rows']]: 20 row=v['control'] if label=='control' else next(r for r in v['rows'] if r['label']==label) 21 raw=(D/'native'/(label+'.stdout')).read_text() 22 steps=[tuple(map(int,t)) for t in re.findall(r'^OMEGA_STEP (\d+) tok=(\d+) us=(\d+)$',raw,re.M)] 23 ids=list(map(int,re.search(r'^OMEGA_PLAN ids=\[([\d, ]+)\]$',raw,re.M).group(1).split(','))) 24 assert row['exit']==0 and [i for i,t,u in steps]==list(range(285)) 25 assert math.isclose(sum(u for i,t,u in steps[:30])/1000,row['prefill_ms'],rel_tol=0,abs_tol=1e-9) 26 assert statistics.median(u/1000 for i,t,u in steps[30:])==row['decode_ms_median'] 27 assert ids==[t for i,t,u in steps[29:]]==row['ids'] 28 assert (ids==h['ids'])==(label!='control') 29 assert (ids==f['generated_ids'])==row['all_ids_equal'] 30 assert next((i for i,(a,b) in enumerate(zip(ids,f['generated_ids'])) if a!=b),None)==row['first_divergence'] 31 gold=next(ast.literal_eval(n.value) for n in ast.parse((D/'oracle/driver-real2.py').read_text()).body if isinstance(n,ast.Assign) and any(isinstance(t,ast.Name) and t.id=='GOLD' for t in n.targets)) 32 c=json.loads((D/'coding24/coding24.json').read_text());assert c['phase']=='complete' and c['expected']==gold['generated_ids'] 33 assert c['binary_sha256']==v['binary_sha256']==json.loads((D/'host/qualification.json').read_text())['binary_sha256'] 34 for row in c['rows']: 35 raw=(D/'coding24'/(row['label']+'.stdout')).read_text() 36 ids=list(map(int,re.search(r'^OMEGA_PLAN ids=\[([\d, ]+)\]$',raw,re.M).group(1).split(','))) 37 assert ids==row['ids'] and row['exit']==0 38 assert (ids==gold['generated_ids'])==(row['label']=='coding24') 39 for name in ('vadd.hsaco','vadd-lds.hsaco'): 40 raw=(D/'native'/(name+'.stdout')).read_text() 41 assert 'OMEGA vadd=PASS count=256' in raw 42 if name=='vadd-lds.hsaco':assert 'OMEGA diag group_segment_size 4096' in raw 43 assert json.loads((D/'native/job-state.json').read_text())['phase']=='complete' 44 assert json.loads((D/'native/candidate.json').read_text())['binary_sha256']==v['binary_sha256'] 45 calc=json.loads(subprocess.check_output([sys.executable,str(D/'calculate.py')])) 46 assert calc==json.loads((D/'calculations.json').read_text()) 47 print('EVIDENCE PASS',len(hashes),'hashed files; raw steps/IDs; independent graph; reference coding24; calculations')