interplane.Get Omega
Read in your language

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

branch main Branches Tags History

aien-sovereign-core-mv / om / qwen-native / model / attest.om

153 lines · 2502 bytes Raw Blame History
1note Build-time seeded Omega attestor. Emits host bindings only after hashing each opened file and comparing stats on the same descriptor.
2global qa_path uchar 4300
3global qa_root uchar 4096
4global qa_input uchar 65536
5global qa_stat uchar 128
6global qa_before ulong 7
7global qa_info ulong 3
8text qa_declare "global qdiskpin ulong 910"
9text qa_f27 "fn qdisk27 to void"
10text qa_f35 "fn qdisk35 to void"
11text qa_end "end"
12text qa_put "put qdiskpin "
13text qa_layer "/layers-"
14text qa_suffix ".safetensors"
15text qa_out "/outside.safetensors"
16fn qa_print s view uchar * to void
17for i ulong len s
18tkpc ulong get s i
19end
20end
21fn qa_word off ulong to ulong
22v = ulong 0
23for i ulong 8
24v = or v shl ulong get qa_stat add i off mul i 8
25end
26ret v
27end
28fn qa_value j ulong to ulong
29if eq j 0
30ret qa_word 0
31end
32if eq j 1
33ret qa_word 8
34end
35if eq j 2
36ret qa_word 48
37end
38ret qa_word add 88 mul sub j 3 8
39end
40fn qa_cat p ulong s view uchar * to ulong
41for i ulong len s
42put qa_path add p i get s i
43end
44ret add p len s
45end
46fn qa_name j ulong to ulong
47n = get qa_info 0
48for i ulong n
49put qa_path i get qa_root i
50end
51if eq j 64
52ret qa_cat n qa_out
53end
54p = qa_cat n qa_layer
55if ge j 10
56put qa_path p uchar add 48 div j 10
57p = add p 1
58end
59put qa_path p uchar add 48 rem j 10
60ret qa_cat add p 1 qa_suffix
61end
62fn qa_hash fd int to void
63hreset
64while true bound 1048577
65r = read fd qa_input 0 len qa_input
66if lt r 0
67exit 3
68end
69if eq r 0
70break
71end
72for i ulong ulong r
73if not hpush get qa_input i
74exit 3
75end
76end
77end
78if not hfinal
79exit 3
80end
81end
82fn qa_shard j ulong to void
83n = qa_name j
84fd = fopen qa_path 0 n 557056 0
85if lt fd 0
86exit 2
87end
88if ne fstat int fd qa_stat 0 128 0
89exit 3
90end
91for i ulong 7
92put qa_before i qa_value i
93end
94qa_hash int fd
95index = j
96if eq j 64
97index = get qa_info 1
98end
99for c ulong 64
100if ne get hd c qa_expected get qa_info 1 index c
101exit 4
102end
103end
104if ne fstat int fd qa_stat 0 128 0
105exit 3
106end
107for i ulong 7
108if ne get qa_before i qa_value i
109exit 5
110end
111qa_print qa_put
112tcpu add add get qa_info 2 mul j 7 i
113tkpc 32
114tcpu get qa_before i
115tkpc 10
116end
117r = fclose int fd
118if ne r 0
119exit 3
120end
121end
122fn qa_model arg ulong layers ulong base ulong to void
123n = argread arg qa_root 0 4095
124if le n 0
125exit 2
126end
127put qa_info 0 ulong n
128put qa_info 1 layers
129put qa_info 2 base
130if eq arg 1
131qa_print qa_f27
132else
133qa_print qa_f35
134end
135tkpc 10
136for j ulong layers
137qa_shard j
138end
139qa_shard 64
140qa_print qa_end
141tkpc 10
142end
143fn main to int
144if ne argcnt 3
145ret 2
146end
147qa_print qa_declare
148tkpc 10
149qa_model 1 64 0
150qa_model 2 40 455
151tkpfl
152ret 0
153end