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-feel/blob/main/tests/round40/compose.py # omega-feel This project has not described itself yet. 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-feel / tests / round40 / compose.py` 32 lines ยท 1568 bytes Raw Blame History 1 """Compose a test executable from the exact CPU engine and decision core used in this study.""" 2 import hashlib 3 import re 4 import sys 5 from pathlib import Path 6 7 here = Path(__file__).resolve().parent 8 engine = Path(sys.argv[1]).read_bytes() 9 if hashlib.sha256(engine).hexdigest() != "`c7ea882b0545bfec59beb6ff2d41c85364e32ad136da6f212dc9b9a9975353f2`": 10 sys.exit("The engine source must match the pinned CPU build in README.md") 11 engine = engine.decode() 12 core = (here.parent.parent / "feel.om").read_text() 13 core, delimiter, _ = core.partition("fn step ") 14 if not delimiter: 15 sys.exit("Missing trace-driver boundary") 16 17 core = re.sub(r"\boflush\b", "fflush", core) 18 core = re.sub(r"\bout\b", "outcome", core) 19 adapter = (here / "adapter.om").read_text() 20 if len(sys.argv) == 3 and sys.argv[2] == "--wrong-arm": 21 # Change one output bit only in the candidate. All timing and comparison code is identical. 22 term = "put oa add po c kdot1 z add z d mul c d" 23 if adapter.count(term) != 1: 24 sys.exit("Could not locate candidate output") 25 adapter = adapter.replace(term, term + "\nif eq c 0\nput oa po bitcast f64 xor bitcast ulong get oa po 1\nend") 26 elif len(sys.argv) != 2: 27 sys.exit("usage: compose.py ENGINE_SOURCE [--wrong-arm]") 28 anchor = "fn olast to void\n" 29 original = "klogit z get og 27 get og 0 d" 30 if engine.count(anchor) != 1 or engine.count(original) != 1: 31 sys.exit("Could not locate the unique CPU logits call") 32 sys.stdout.write(engine.replace(anchor, core + "\n" + adapter + "\n" + anchor).replace(original, "fkernel z get og 27 get og 0 d"))