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-mv/blob/main/gpu/nvidia/native/arboris/commit.om # omega-mv Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance. Brought by drakestapleton Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / gpu / nvidia / native / arboris / commit.om` 267 lines ยท 7377 bytes Raw Blame History 1 note SPDX-License-Identifier: AGPL-3.0-only 2 note The supervisor holds the per-world writer lock through submission, signature 3 note verification and publication. Its provisioned Ed25519 key is an argument 4 note of this trusted boundary. Request/arena bytes cannot select a key. 5 note ARBSTP02 signs 184 bytes: eight little-endian words (domain, model, subject, 6 note grant id, generation, starting epoch, input bank, channel sequence), 7 note three SHA-256 digests, and the output norm, traversed arc count and packed dispatch controls. 8 fn ar_wire_word body edit uchar 65536 i ulong v ulong to void 9 for k ulong 8 10 put body add mul i 8 k uchar and shr v mul k 8 255 11 end 12 end 13 14 fn ar_encode_step body edit uchar 65536 claims view ulong 8 hashes view uchar 96 norm ulong arcs ulong to void 15 for i ulong 8 16 ar_wire_word body i get claims i 17 end 18 for i ulong 96 19 put body add 64 i get hashes i 20 end 21 ar_wire_word body 20 norm 22 ar_wire_word body 21 arcs 23 ar_wire_word body 22 get ar_fenced_claim 6 24 end 25 26 fn ar_policy_word policy edit uchar 136 index ulong word ulong to void 27 for j ulong 8 28 put policy add mul index 8 j uchar and shr word mul j 8 255 29 end 30 end 31 32 note Trusted dispatcher policy for the separate world signer, derived before 33 note QMD publication under the per-world lock. No output enters this channel. 34 fn ar_signing_policy table long subject ulong h view ulong 2 m view ulong 16 controls ulong policy edit uchar 136 to bool 35 if or ne get ar_fenced_seq 0 0 ne get nvput 0 get nvret 0 36 ret false 37 end 38 if or ne get ar_code_model 0 get m 0 eq get nvput 0 0xffffffffffffffff 39 ret false 40 end 41 if not caproot_validate table subject h m 42 ret false 43 end 44 if not ar_snapshot_matches m 45 ret false 46 end 47 hashes = new uchar 96 0 48 if not ar_input_code_digests m hashes 49 ret false 50 end 51 words = new ulong 8 0 52 put words 0 0x3230505453425241 53 put words 1 get m 0 54 put words 2 subject 55 put words 3 get h 0 56 put words 4 get h 1 57 put words 5 get m 7 58 put words 6 get m 6 59 put words 7 add get nvput 0 1 60 for i ulong 8 61 ar_policy_word policy i get words i 62 end 63 for i ulong 64 64 put policy add 64 i get hashes i 65 end 66 ar_policy_word policy 16 controls 67 ret true 68 end 69 70 fn ar_norm_word w ulong gated bool sum f64 to f64 71 if gated 72 if or eq and w 0x7c00 0x7c00 eq and w 0x7c000000 0x7c000000 73 ret neg 1.0f64 74 end 75 x = f64 f32of f16to32 and w 65535 76 y = f64 f32of f16to32 shr w 16 77 ret add add sum mul x x mul y y 78 end 79 if gt w 0x3f800000 80 ret neg 1.0f64 81 end 82 x = f64 f32of w 83 ret add sum mul x x 84 end 85 86 note Deterministic L2 norm. Visit logical output coordinates in dense order, 87 note accumulate in binary64, take sqrt, truncate to unsigned Q32.32. Refuse 88 note nonfinite values and a result outside the wire format. 89 fn ar_norm m view ulong 16 metrics edit ulong 3 to bool 90 tok = get ar_maps sub ulong 4 get m 6 91 gated = eq get m 0 arboris_magic 92 count = div get m 11 4 93 if gated 94 count = div mul get m 1 get m 4 2 95 end 96 sum = f64 0 97 for i ulong count bound 0x4000000000 98 w = mapget tok mul i 4 4 99 sum = ar_norm_word w gated sum 100 if lt sum 0.0f64 101 ret false 102 end 103 end 104 v = fsqrt sum 105 if ge v `4294967296`.0f64 106 ret false 107 end 108 put metrics 0 ulong mul v `4294967296`.0f64 109 if gated 110 put metrics 1 get m 2 111 put metrics 2 get m 3 112 else 113 put metrics 1 0 114 arcs = mul get m 2 get m 3 115 if ne get ar_wave_spec 1 0 116 arcs = mul arcs get ar_wave_spec 1 117 end 118 put metrics 2 arcs 119 end 120 ret true 121 end 122 123 fn ar_step_message m view ulong 16 subject ulong handle view ulong 2 body edit uchar 65536 metrics edit ulong 3 to bool 124 seq = get ar_fenced_seq 0 125 if or ne subject get ar_fenced_claim 0 ne get handle 0 get ar_fenced_claim 1 126 ret false 127 end 128 if or ne get handle 1 get ar_fenced_claim 2 ne get m 0 get ar_fenced_claim 3 129 ret false 130 end 131 if or ne get m 7 get ar_fenced_claim 4 ne get m 6 get ar_fenced_claim 5 132 ret false 133 end 134 hashes = new uchar 96 0 135 if or eq get m 7 0xffffffffffffffff not ar_step_digests m seq hashes 136 ret false 137 end 138 if not ar_norm m metrics 139 ret false 140 end 141 claims = new ulong 8 0 142 put claims 0 0x3230505453425241 143 put claims 1 get m 0 144 put claims 2 subject 145 put claims 3 get handle 0 146 put claims 4 get handle 1 147 put claims 5 get m 7 148 put claims 6 get m 6 149 put claims 7 seq 150 ar_encode_step body claims hashes get metrics 0 get metrics 2 151 ret true 152 end 153 154 fn ar_publish m view ulong 16 body view uchar 65536 metrics view ulong 3 to bool 155 if not ar_snapshot_matches m 156 ret false 157 end 158 if not ar_device_receipt get ar_maps 5 get ar_fenced_seq 0 159 ret false 160 end 161 tok = get ar_maps 5 162 tag = ulong 0 163 for i ulong 8 164 tag = or tag shl ulong get body add 128 i mul i 8 165 end 166 if ne mapset tok 8 8 get metrics 1 0 167 ret false 168 end 169 if ne mapset tok 16 8 get metrics 2 0 170 ret false 171 end 172 if ne mapset tok 24 8 get metrics 0 0 173 ret false 174 end 175 if ne mapset tok 40 8 tag 0 176 ret false 177 end 178 note Single aligned, system-ordered store makes the next state visible. 179 if ne mapset tok 32 8 add get m 7 1 0 180 ret false 181 end 182 put ar_fenced_seq 0 0 183 ar_drop_compute 184 ret true 185 end 186 187 fn ar_commit_step table long subject ulong handle view ulong 2 m view ulong 16 trusted_pk view uchar 32 sig view uchar 64 to bool 188 if not caproot_validate table subject handle m 189 ret false 190 end 191 body = new uchar 65536 0 192 metrics = new ulong 3 0 193 if not ar_step_message m subject handle body metrics 194 ret false 195 end 196 if ne edverify trusted_pk body 184 sig 0 1 197 ret false 198 end 199 if not caproot_validate table subject handle m 200 ret false 201 end 202 ret ar_publish m body metrics 203 end 204 205 note Synchronous local signer channel. The supervisor supplies the connected 206 note write/read descriptors and pinned public key. The signer accepts a 184-byte execution 207 note claim, records the signed claim, then replies with its 64-byte signature. 208 note A refused or disconnected signer leaves the completed bank pending. 209 fn ar_signer_write fd int body view uchar 65536 to bool 210 offset = ulong 0 211 while lt offset 184 212 n = write fd body offset sub ulong 184 offset 213 if ne n neg long 4 214 if le n 0 215 ret false 216 end 217 offset = add offset ulong n 218 end 219 end 220 ret true 221 end 222 223 fn ar_signer_read fd int signature edit uchar 64 to bool 224 offset = ulong 0 225 while lt offset 64 226 n = read fd signature offset sub ulong 64 offset 227 if ne n neg long 4 228 if le n 0 229 ret false 230 end 231 offset = add offset ulong n 232 end 233 end 234 ret true 235 end 236 237 fn ar_seal_step table long grant view ulong 3 m view ulong 16 signer view int 2 pk view uchar 32 signed_receipt edit uchar 248 to bool 238 subject = get grant 0 239 handle = new ulong 2 0 240 put handle 0 get grant 1 241 put handle 1 get grant 2 242 if not caproot_validate table subject handle m 243 ret false 244 end 245 body = new uchar 65536 0 246 metrics = new ulong 3 0 247 if not ar_step_message m subject handle body metrics 248 ret false 249 end 250 if not ar_signer_write get signer 0 body 251 ret false 252 end 253 signature = new uchar 64 0 254 if not ar_signer_read get signer 1 signature 255 ret false 256 end 257 if not ar_commit_step table subject handle m pk signature 258 ret false 259 end 260 for i ulong 184 261 put signed_receipt i get body i 262 end 263 for i ulong 64 264 put signed_receipt add 184 i get signature i 265 end 266 ret true 267 end