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 / om / ribbon / check_native.py
| 1 | #!/usr/bin/env python3 |
| 2 | # SPDX-License-Identifier: Apache-2.0 |
| 3 | """Verify the generated Omega Bridge call boundary against the same oracle.""" |
| 4 | import ctypes |
| 5 | import importlib.util |
| 6 | from pathlib import Path |
| 7 | import sys |
| 8 | |
| 9 | from check import Oracle, cases |
| 10 | |
| 11 | binding = Path(sys.argv[1]) / 'omega_native.py' |
| 12 | spec = importlib.util.spec_from_file_location('ribbon_native', binding) |
| 13 | native = importlib.util.module_from_spec(spec) |
| 14 | spec.loader.exec_module(native) |
| 15 | count = 0 |
| 16 | for seq in cases(): |
| 17 | state = (ctypes.c_uint64 * 4096)() |
| 18 | oracle = Oracle() |
| 19 | for q in seq: |
| 20 | request = (ctypes.c_uint64 * 8)(*q) |
| 21 | answer = (ctypes.c_uint64 * 8)() |
| 22 | result = ctypes.c_uint64() |
| 23 | status = native.omega_pipeline(ctypes.byref(result), state, 4096, request, 8, answer, 8) |
| 24 | assert status == 0, status |
| 25 | got = [result.value, *answer] |
| 26 | assert got == oracle.step(q), (q, got) |
| 27 | count += 1 |
| 28 | |
| 29 | # The native boundary must reject accidental aliasing and a wrong state extent. |
| 30 | state = (ctypes.c_uint64 * 4096)() |
| 31 | q = (ctypes.c_uint64 * 8)(1,4,256,2,0,0,0,0) |
| 32 | out = (ctypes.c_uint64 * 8)() |
| 33 | result = ctypes.c_uint64(99) |
| 34 | assert native.omega_pipeline(ctypes.byref(result),state,4095,q,8,out,8) == 32 |
| 35 | assert result.value == 99 |
| 36 | assert native.omega_pipeline(ctypes.byref(result),state,4096,q,8,state,8) == 32 |
| 37 | assert result.value == 99 |
| 38 | print(f'PASS native attachment: {count} oracle commands plus wrong-extent/alias refusals') |