interplane.Get Omega
Read in your language

omega-tool-model

First-party Omega tool-use model source, serving harnesses, and verification records

Brought by drakestapleton

branch main Branches Tags History

omega-tool-model / deployment / fast / build_rows.py

43 lines · 1951 bytes Raw Blame History
1import os
2"""External construction of two isolated inference-only optimization trials."""
3from pathlib import Path
4import json,hashlib,subprocess,difflib
5R=Path(__file__).resolve().parent
6C=(Path(os.path.expanduser('~')) / '/handoffs/omega-llm-20261101/omega-mv/seed/out/omc'.lstrip('/'))
7src=(R/'server-cache.om').read_text()
8upload='''
9note Inference consumes input tokens only. Targets and backward counting-sort data are not read.
10fn gsupload to void
11h = get gbmem 5
12xo = get gga 2
13for i ulong get og 1
14m = mapset h add xo mul i 4 4 get obx i
15end
16put gkinv 0 1
17end
18'''
19a='fn gsnext to ulong\nput cslot 0 0\nggupb'
20assert src.count(a)==1
21lean=src.replace(a,'fn gsnext to ulong\nput cslot 0 0\ngsupload')+upload
22rows='global sactive ulong 1\n'+lean
23a='fn ggr to ulong\nret mul get og 6 get og 1\nend'
24assert rows.count(a)==1
25rows=rows.replace(a,'''fn ggr to ulong
26if ne get sactive 0 0
27ret mul div add get og 9 31 32 32
28end
29ret mul get og 6 get og 1
30end''')
31a='fn gsnext to ulong\nput cslot 0 0'
32rows=rows.replace(a,'fn gsnext to ulong\nput sactive 0 1\nput cslot 0 0')
33receipt={}
34for name,text in [('server-lean',lean),('server-rows',rows),('server-rows-check',rows.replace('const CACHECHK ulong 0','const CACHECHK ulong 1'))]:
35 (R/(name+'.om')).write_text(text)
36 p=subprocess.run([str(C)],input=text.encode(),capture_output=True,timeout=60)
37 (R/(name+'.stderr')).write_bytes(p.stderr)
38 assert p.returncode==0,(name,p.returncode,p.stderr.decode())
39 (R/name).write_bytes(p.stdout);(R/name).chmod(0o700)
40 receipt[name]=dict(source_sha256=hashlib.sha256(text.encode()).hexdigest(),binary_sha256=hashlib.sha256(p.stdout).hexdigest())
41(R/'rows-build.json').write_text(json.dumps(receipt,indent=2)+'\n')
42(R/'rows.diff').write_text(''.join(difflib.unified_diff(src.splitlines(True),rows.splitlines(True),fromfile='cached-launch',tofile='active-rows')))
43print('Built inference-only upload and active-row variants, including checked launch-cache variant.')