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/omega-gpu-driver/blob/main/tests/arena_large.py # omega-gpu-driver aien-dev/omega-gpu-driver 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 `omega-gpu-driver / tests / arena_large.py` 93 lines ยท 4280 bytes Raw Blame History 1 """Check offline GB20B composition against the pinned vendor bytes and radix layout.""" 2 import argparse 3 import hashlib 4 import struct 5 import subprocess 6 from pathlib import Path 7 8 PAGE = 4096 9 BASE = `1048576` 10 FW = "`32cb7cf3e77f97e92f6e92135939ccb3ba382748144569c0dfccf3338d43d963`" 11 PARTS = { 12 "bl.img": "`6da8510c912ccd5a8b73f9a5cce9e0f4ea657aa430431d2f8e4874834aeadb94`", 13 "fmc.img": "`b92f83c1250019af11162d9ee471b8fb74081ea598cf6added0bee7a3663e2be`", 14 "fmc.hash": "`4a5854c785fa7a9ea4aaabb52f6c9838242f81506659ff413da0f4b8ac1f40bf`", 15 "fmc.pubkey": "`54076b108ad3da65e09f675d88efd553340a0c0653cf13372f4e30dd6ab17e7c`", 16 "fmc.sig": "`6c5fbbf096efff9d0f47d4cc70096898f059579154464e6c3b972d2e606f1334`", 17 } 18 19 20 def sha(data): 21 return hashlib.sha256(data).hexdigest() 22 23 24 def span(path, digest): 25 body = path.read_bytes() 26 if sha(body) != digest: 27 raise ValueError(f"wrong firmware input {path.name}") 28 return body 29 30 31 def check(exe, fw, inputs): 32 firmware = span(fw, FW) 33 image = firmware[64:64 + `74969088`] 34 signature = firmware[`74969199`:`74969199` + 4096] 35 boot, fmc, fmc_hash, pubkey, signed = [span(inputs / k, v) for k, v in PARTS.items()] 36 source = b"".join([image, signature, boot, fmc, fmc_hash, pubkey, signed]) 37 def run(mode, data): 38 return subprocess.run([exe], input=bytes([mode]) + data, capture_output=True, timeout=120) 39 small = run(1, source) 40 assert (small.returncode, small.stdout) == (3, b""), "old capacity must refuse before output" 41 for bad in (source[:-1], source + b"x"): 42 refused = run(0, bad) 43 assert (refused.returncode, refused.stdout) == (2, b""), "incomplete or surplus input admitted" 44 regular = run(0, source) 45 assert regular.returncode == 0, regular.returncode 46 dirty = run(2, source) 47 assert dirty.returncode == 0 and regular.stdout == dirty.stdout, "uncleared reused arena" 48 aligned = run(3, source) 49 assert aligned.returncode == 0 and regular.stdout == aligned.stdout, "aligned and unaligned inputs differ" 50 out = memoryview(regular.stdout) 51 arena, cot = out[:-868], out[-868:] 52 def word(data, offset): 53 return struct.unpack_from("