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/linear/standalone.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 / linear / standalone.om` 197 lines ยท 2926 bytes Raw Blame History 1 note SPDX-License-Identifier: AGPL-3.0-only 2 global lqio uchar 65536 3 global lqhead ulong 9 4 fn lqread n ulong to bool 5 i = ulong 0 6 while lt i n 7 r = read 0 lqio i sub n i 8 if le r 0 9 ret false 10 end 11 i = add i ulong r 12 end 13 ret true 14 end 15 fn lqload h long off ulong n ulong to uint 16 r = mapread h off lqio 0 n 17 if ne r long n 18 exit 5 19 end 20 v = uint get lqio 0 21 if eq n 2 22 v = or v shl uint get lqio 1 8 23 end 24 ret v 25 end 26 fn lqwgt fmt uint idx ulong si ulong to f32 27 if eq fmt 0 28 u = lqload get lqmap 0 mul idx 2 2 29 ret bitcast f32 shl u 16 30 end 31 u = lqbits lqload get lqmap 0 idx 1 32 w = bitcast f32 u 33 u = lqload get lqmap 1 mul si 2 2 34 ret mul w bitcast f32 shl u 16 35 end 36 fn lqrow fmt uint row ulong k uint sc uint to f32 37 sumv = f64 0 38 base = mul row ulong k 39 sb = mul div row 128 ulong sc 40 for col ulong ulong k 41 w = lqwgt fmt add base col add sb div col 128 42 u = uint mapget get lqmap 2 mul col 4 4 43 v = bitcast f32 u 44 sumv = add sumv mul f64 v f64 w 45 end 46 ret f32 sumv 47 end 48 fn lqref fmt uint m uint k uint sc uint to void 49 for row ulong ulong m 50 v = lqrow fmt row k sc 51 r = mapset get lqmap 3 mul row 4 4 ulong bitcast uint v 52 end 53 end 54 fn lqcase gpu bool shape bool to int 55 if not lqread 72 56 ret 2 57 end 58 for i ulong 9 59 v = ulong 0 60 for j ulong 8 61 v = or v shl ulong get lqio add mul i 8 j mul j 8 62 end 63 put lqhead i v 64 if and lt i 5 gt v `4294967295` 65 ret 2 66 end 67 end 68 fmt = uint get lqhead 0 69 m = uint get lqhead 1 70 k = uint get lqhead 2 71 sr = uint get lqhead 3 72 sc = uint get lqhead 4 73 for i ulong 4 74 put lqlen i get lqhead add i 5 75 end 76 if not lqgeom fmt m k sr sc 77 ret 2 78 end 79 if shape 80 if ne read 0 lqio 0 1 0 81 ret 2 82 end 83 ret 0 84 end 85 if gpu 86 if not lqopen 87 ret 3 88 end 89 end 90 for i ulong 4 91 n = get lqlen i 92 if gt n 0 93 h = long 0 94 if gpu 95 h = nvalloc n true 96 else 97 h = mapnew neg int 1 0 n 3 34 98 end 99 if le h 0 100 ret 3 101 end 102 put lqmap i h 103 off = ulong 0 104 while and lt i 3 lt off n 105 sz = sub n off 106 if gt sz len lqio 107 sz = len lqio 108 end 109 if not lqread sz 110 ret 2 111 end 112 if ne mapwrite h off lqio 0 sz long sz 113 ret 3 114 end 115 off = add off sz 116 end 117 end 118 end 119 if ne read 0 lqio 0 1 0 120 ret 2 121 end 122 if gpu 123 if not lqrun fmt m k sr sc 124 ret 4 125 end 126 else 127 lqref fmt m k sc 128 end 129 off = ulong 0 130 while lt off get lqlen 3 131 sz = sub get lqlen 3 off 132 if gt sz len lqio 133 sz = len lqio 134 end 135 if ne mapread get lqmap 3 off lqio 0 sz long sz 136 ret 5 137 end 138 pos = ulong 0 139 while lt pos sz 140 r = write 1 lqio pos sub sz pos 141 if le r 0 142 ret 5 143 end 144 pos = add pos ulong r 145 end 146 off = add off sz 147 end 148 ret 0 149 end 150 fn main to int 151 if ne argcnt 2 152 exit 2 153 end 154 if ne argread 1 lqio 0 4 1 155 exit 2 156 end 157 c = get lqio 0 158 if or eq c 98 eq c 102 159 fmt = uint 0 160 if eq c 102 161 fmt = 1 162 end 163 n = lqemit fmt 164 r = write 1 gkcode mul ulong fmt 16384 n 165 if ne r long n 166 exit 5 167 end 168 exit 0 169 end 170 if eq c 116 171 for b uint 256 172 v = lqbits b 173 for j uint 4 174 put lqio add mul b 4 j uchar and shr v mul j 8 255 175 end 176 end 177 r = write 1 lqio 0 1024 178 if ne r 1024 179 exit 5 180 end 181 exit 0 182 end 183 if eq c 114 184 exit lqcase false false 185 end 186 if eq c 115 187 exit lqcase false true 188 end 189 if ne c 103 190 exit 2 191 end 192 rc = lqcase true false 193 if not lqclose 194 exit 6 195 end 196 exit rc 197 end