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
omega-mv / om / gpu / inkling2 / arboris / hints-cli.om
| 1 | note SPDX-License-Identifier: AGPL-3.0-only |
| 2 | note Read one settled Arboris score frame for Inkling-2-Mini (128 experts). |
| 3 | note Header: "ARH1" u32le, pair count, hint budget (<= 128). |
| 4 | note Each pair is an expert ID (0..127, or 0xffffffff to ignore the node) |
| 5 | note followed by positive FP32 score bits in [0, 1]. Emit cache replay OP3 records. |
| 6 | fn ik_ah_read4 b edit uchar 4 to bool |
| 7 | pos = ulong 0 |
| 8 | while lt pos 4 bound 4 |
| 9 | r = read 0 b pos sub 4 pos |
| 10 | if le r 0 |
| 11 | ret false |
| 12 | end |
| 13 | pos = add pos ulong r |
| 14 | end |
| 15 | ret true |
| 16 | end |
| 17 | |
| 18 | fn ik_ah_word b view uchar 4 to uint |
| 19 | word = uint 0 |
| 20 | for i ulong 4 |
| 21 | word = or word shl uint get b i mul i 8 |
| 22 | end |
| 23 | ret word |
| 24 | end |
| 25 | |
| 26 | fn main to int |
| 27 | b = new uchar 4 0 |
| 28 | peak = new uint 128 0 |
| 29 | hints = new uint 256 0 |
| 30 | if not ik_ah_read4 b |
| 31 | ret 65 |
| 32 | end |
| 33 | if ne ik_ah_word b 0x31485241 |
| 34 | ret 65 |
| 35 | end |
| 36 | if not ik_ah_read4 b |
| 37 | ret 65 |
| 38 | end |
| 39 | n = ulong ik_ah_word b |
| 40 | if not ik_ah_read4 b |
| 41 | ret 65 |
| 42 | end |
| 43 | k = ulong ik_ah_word b |
| 44 | if gt k 128 |
| 45 | ret 65 |
| 46 | end |
| 47 | for i ulong n bound 0xffffffff |
| 48 | if not ik_ah_read4 b |
| 49 | ret 65 |
| 50 | end |
| 51 | id = ik_ah_word b |
| 52 | if not ik_ah_read4 b |
| 53 | ret 65 |
| 54 | end |
| 55 | if not ik_ar_vote_expert peak id ik_ah_word b |
| 56 | ret 65 |
| 57 | end |
| 58 | end |
| 59 | if ne read 0 b 0 1 0 |
| 60 | ret 65 |
| 61 | end |
| 62 | count = ik_ar_select_experts peak part hints 0 mul k 2 |
| 63 | if not ik_arboris_send_hints 1 hints ulong count |
| 64 | ret 74 |
| 65 | end |
| 66 | ret 0 |
| 67 | end |