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/aien-sovereign-core-mv/blob/main/om/qwen-native/blocks/tests/probe.om # 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 Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aien-sovereign-core-mv / om / qwen-native / blocks / tests / probe.om` 132 lines ยท 2622 bytes Raw Blame History 1 note Test-only binary transport. Header model, absolute layer, token position, then x and w. 2 global qt_wire uchar 164736 3 4 fn qt_read n ulong to void 5 offset = ulong 0 6 while lt offset n bound 164737 7 got = read 0 qt_wire offset sub n offset 8 if le got 0 9 exit 2 10 end 11 offset = add offset ulong got 12 end 13 end 14 15 fn qt_word j ulong to uint 16 p = mul j 4 17 v = uint get qt_wire p 18 for k ulong 3 19 v = or v shl uint get qt_wire add add p 1 k uint mul add k 1 8 20 end 21 ret v 22 end 23 24 fn qt_load a edit f32 * to void 25 qt_read mul len a 4 26 for j ulong len a 27 put a j bitcast f32 qt_word j 28 end 29 end 30 31 fn qt_output a view f32 6144 to void 32 for j ulong 6144 33 bits = bitcast uint get a j 34 for k ulong 4 35 put qt_wire add mul j 4 k uchar and shr bits uint mul k 8 255 36 end 37 end 38 offset = ulong 0 39 while lt offset 24576 bound 24577 40 got = write 1 qt_wire offset sub 24576 offset 41 if le got 0 42 exit 3 43 end 44 offset = add offset ulong got 45 end 46 end 47 48 note Emit 128 state/cache probes after each output, in the same fixed frame format. 49 fn qt_matrix slot ulong heads ulong j ulong to f32 50 h = rem j heads 51 r = rem mul j 23 128 52 v = rem add mul j 37 1 128 53 idx = add mul rem slot 16 48 h 54 idx = add mul idx 16384 mul r 128 55 idx = add idx v 56 ret qd_state_get div slot 16 idx 57 end 58 59 fn qt_delta_state m ulong l ulong y edit f32 6144 to void 60 slot = sub l div l 4 61 heads = ulong 48 62 if eq m 35 63 heads = ulong 32 64 end 65 for j ulong 64 66 put y j qt_matrix slot heads j 67 idx = add mul slot 30720 mul rem j 3 10240 68 idx = add idx rem mul j 7919 add 4096 mul heads 128 69 put y add j 64 get qd_tail idx 70 end 71 qt_output y 72 end 73 74 fn qt_att_state m ulong l ulong p ulong y edit f32 6144 to void 75 nk = ulong 4 76 if eq m 35 77 nk = ulong 2 78 end 79 slot = div l 4 80 for j ulong 64 81 idx = qa_row_offset slot p nk rem j nk 82 idx = add idx rem mul j 19 256 83 pair = qa_cache_get div slot 2 idx 84 put y j bitcast f32 and pair `4294901760` 85 put y add j 64 bitcast f32 shl pair 16 86 end 87 qt_output y 88 end 89 90 fn qt_delta m ulong l ulong p ulong to void 91 x = new f32 16480 0.0f32 92 w = new f32 41184 0.0f32 93 y = new f32 6144 0.0f32 94 qt_load x 95 qt_load w 96 qwen_delta_step m l p x w y 97 qt_output y 98 qt_delta_state m l y 99 end 100 101 fn qt_attention m ulong l ulong p ulong to void 102 x = new f32 14336 0.0f32 103 w = new f32 512 0.0f32 104 y = new f32 6144 0.0f32 105 qt_load x 106 qt_load w 107 note For the boundary fixture only, install a known prefix of all-zero KV rows. 108 if eq p 8191 109 put qb_model l m 110 put qb_next l p 111 end 112 qwen_attention_step m l p x w y 113 qt_output y 114 qt_att_state m l p y 115 end 116 117 fn main to int 118 qt_read 4 119 count = ulong qt_word 0 120 for j ulong count 121 qt_read 12 122 m = ulong qt_word 0 123 l = ulong qt_word 1 124 p = ulong qt_word 2 125 if eq rem l 4 3 126 qt_attention m l p 127 else 128 qt_delta m l p 129 end 130 end 131 ret 0 132 end