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 / FLASH-NEXT-NATIVE-SURVIVORS-20261118 / check.py
| 1 | import hashlib,json,struct,subprocess,sys,tempfile,os |
| 2 | from pathlib import Path |
| 3 | erc_path, model, results = (Path(arg).resolve(strict=True) for arg in sys.argv[1:]) |
| 4 | work = tempfile.TemporaryDirectory() |
| 5 | os.chdir(work.name) |
| 6 | count = 0 |
| 7 | for p in sorted(results.glob("*.jsonl")): |
| 8 | failed=[r for line in p.open() if (r:=json.loads(line)).get("flip_detected")==0] |
| 9 | if not failed: continue |
| 10 | shard=model/p.name[:-6] |
| 11 | with shard.open("rb") as f: |
| 12 | hsize=struct.unpack("<Q",f.read(8))[0] |
| 13 | header=json.loads(f.read(hsize)) |
| 14 | for row in failed: |
| 15 | name=row["name"] |
| 16 | rows,cols=row["rows"],row["cols"] |
| 17 | lo,hi=header[name]["data_offsets"] |
| 18 | offset=8+hsize+lo |
| 19 | f.seek(offset) |
| 20 | original=f.read(hi-lo) |
| 21 | def erc(*args): |
| 22 | return subprocess.run([erc_path,*map(str,args)],capture_output=True) |
| 23 | assert erc("encode",shard,offset,rows,cols,"tmp.erc").returncode==0,name |
| 24 | packed=bytearray(Path("tmp.erc").read_bytes()) |
| 25 | assert len(packed)==row["coded"]+40+2*rows,name |
| 26 | assert erc("decode","tmp.erc","clean").returncode==0,name |
| 27 | assert Path("clean").read_bytes()==original,name |
| 28 | start=552+6*rows |
| 29 | packed[start+(len(packed)-start)//2]^=16 |
| 30 | Path("corrupt").write_bytes(packed) |
| 31 | rc=erc("decode","corrupt","out") |
| 32 | assert rc.returncode!=0,name |
| 33 | count+=1 |
| 34 | print(name,hashlib.sha256(original).hexdigest(),rc.returncode,(rc.stderr+rc.stdout).decode().strip(),flush=True) |
| 35 | assert count==104,count |
| 36 | print("PASS native clean byte comparison and corrupted stream refusal for all 104 prototype survivors") |