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/model/project.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 / model / project.om` 160 lines ยท 2771 bytes Raw Blame History 1 note GB10 matrix layer. Preserve weight residency across tokens, one read-only host fd per shard. 2 global qgpu long 66 3 global qxy long 2 4 global qbuf uchar `1048576` 5 fn qtransfer fd int origin ulong n ulong dev long to void 6 off = ulong 0 7 while lt off n bound 65536 8 w = sub n off 9 if gt w len qbuf 10 w = len qbuf 11 end 12 if ne pread fd qbuf 0 w long add origin off long w 13 qwfail 48 14 end 15 if ne mapwrite dev off qbuf 0 w long w 16 qwfail 48 17 end 18 off = add off w 19 end 20 end 21 22 fn qresident id ulong to long 23 s = ulong get qwfile id 24 h = get qgpu s 25 if gt h 0 26 ret h 27 end 28 origin = ulong 0 29 n = get qwsize s 30 if eq s 64 31 if ne id ulong get qrole 1021 32 qwfail 49 33 end 34 origin = get qwoff id 35 n = mul get qwcount id 2 36 end 37 h = nvalloc n true 38 if le h 0 39 qwfail 50 40 end 41 qrestat s 42 qtransfer int get qwfd s origin n h 43 qrestat s 44 put qgpu s h 45 ret h 46 end 47 48 fn qgpuopen to void 49 if not lqopen 50 qwfail 50 51 end 52 x = nvalloc `1048576` true 53 if le x 0 54 qwfail 50 55 end 56 put qxy 0 x 57 y = nvalloc `1048576` true 58 if le y 0 59 qwfail 50 60 end 61 put qxy 1 y 62 end 63 64 fn qbf j ulong to f32 65 a = mul j 2 66 bits = or uint get qbuf a shl uint get qbuf add a 1 8 67 ret bitcast f32 shl bits 16 68 end 69 70 fn qreadrow id ulong first ulong buf edit f32 * pos ulong n ulong to void 71 if ne get qwdtype id 2 72 qwfail 51 73 end 74 if or gt first get qwcount id gt pos len buf 75 qwfail 51 76 end 77 if or gt n sub get qwcount id first gt n sub len buf pos 78 qwfail 51 79 end 80 h = qwhandle id 81 bytes = mul n 2 82 if gt bytes len qbuf 83 qwfail 51 84 end 85 if ne mapread h add get qwoff id mul first 2 qbuf 0 bytes long bytes 86 qwfail 51 87 end 88 for j ulong n 89 put buf add pos j qbf j 90 end 91 end 92 93 fn qfillinput x view f32 * n ulong to void 94 if gt n len x 95 qwfail 52 96 end 97 for j ulong n 98 bits = bitcast uint get x j 99 if ne mapset get qxy 0 mul j 4 4 ulong bits 0 100 qwfail 52 101 end 102 end 103 end 104 105 fn qbindmatrix id ulong to void 106 h = qresident id 107 put lqmap 0 h 108 off = get qwoff id 109 if eq get qwfile id 64 110 off = ulong 0 111 end 112 put lqoff 0 off 113 put lqlen 0 mul get qwcount id ulong get qwdtype id 114 put lqlen 1 0 115 s = ulong get qscale id 116 if ne s 0 117 if ne get qwfile s get qwfile id 118 qwfail 52 119 end 120 put lqmap 1 h 121 put lqoff 1 get qwoff s 122 put lqlen 1 mul get qwcount s 2 123 end 124 end 125 126 fn qdispatch id ulong m uint k uint to void 127 s = ulong get qscale id 128 ok = false 129 if eq s 0 130 ok = lqrun 0 m k 0 0 131 else 132 a = mul s 4 133 ok = lqrun 1 m k uint get qwshape a uint get qwshape add a 1 134 end 135 if not ok 136 qwfail 53 137 end 138 end 139 140 fn qproject id ulong x view f32 * y edit f32 * pos ulong to void 141 a = mul id 4 142 m = uint get qwshape a 143 k = uint get qwshape add a 1 144 if or gt pos len y gt ulong m sub len y pos 145 qwfail 52 146 end 147 qfillinput x ulong k 148 qbindmatrix id 149 put lqmap 2 get qxy 0 150 put lqmap 3 get qxy 1 151 put lqoff 2 0 152 put lqoff 3 0 153 put lqlen 2 mul ulong k 4 154 put lqlen 3 mul ulong m 4 155 qdispatch id m k 156 for j ulong ulong m 157 bits = uint mapget get qxy 1 mul j 4 4 158 put y add pos j bitcast f32 bits 159 end 160 end