aien-sovereign-core-mv
AienOS host runtime: inference scheduling, paged KV state, the aien CLI and Spark verification tooling. Its inference engine is in alpha testing (DGX Spark GB10); Omega is the implementation destination.
Brought by drakestapleton
aien-sovereign-core-mv / crates / aien-omega-q38 / om / mutants.py
| 1 | # SPDX-License-Identifier: Apache-2.0 |
| 2 | # External fault controls for the Omega implementation. |
| 3 | from pathlib import Path |
| 4 | import os,subprocess,tempfile |
| 5 | p=Path(__file__).resolve().parent |
| 6 | source=(p/'plan.om').read_text() |
| 7 | mutants={'always_requested_header': ['if le add left right whole\nret header', 'if eq whole whole\nret header'], 'drop_short_tail_guard': ['if lt sub total header min', 'if eq min 0'], 'drop_short_prefix_guard': ['if and gt sub header from 0 lt sub header from min', 'if eq min 0'], 'introduce_decode_prefix': ['ret add from mul div sub header from chunk chunk', 'ret add from 1'], 'accept_empty_remainder': ['if or gt from header ge header total', 'if gt from header'], 'accept_oversized_chunk': ['if or lt chunk mul min 2 gt chunk 32768', 'if lt chunk mul min 2']} |
| 8 | |
| 9 | env=dict(os.environ,OMEGA_SEEDED_OMC=os.environ['OMEGA_OMC']) |
| 10 | with tempfile.TemporaryDirectory(prefix='q38-prefill-mutants-') as tmp: |
| 11 | tmp=Path(tmp) |
| 12 | for name,(old,new) in mutants.items(): |
| 13 | assert source.count(old)==1 |
| 14 | om=tmp/(name+'.om');om.write_text(source.replace(old,new));c=tmp/(name+'.c');so=tmp/(name+'.so') |
| 15 | with c.open('w') as f:subprocess.run(['sh',str(Path(os.environ['OMEGA_BRIDGE'])/'tools/bridge-seeded'),'c',str(om)],env=env,stdout=f,check=True) |
| 16 | subprocess.run([os.environ.get('CC','cc'),'-O2','-fPIC','-shared',str(c),'-o',str(so)],check=True) |
| 17 | r=subprocess.run(['python3',str(p/'check.py'),str(so)],capture_output=True,text=True) |
| 18 | assert r.returncode and 'AssertionError' in r.stderr,(name,r.stdout,r.stderr) |
| 19 | print(name+': caught',flush=True) |