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/CUDApp/blob/main/om/moe/moe_segs32.om # CUDApp CUDA++: AIEN’s GPU machine-code toolchain, runtime and driver client for NVIDIA GPUs without the CUDA toolkit. Hardware coverage and driver replacement limits are explicit. 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 `CUDApp / om / moe / moe_segs32.om` 72 lines · 1529 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 2 note Existing Seg32 exactly: weight VA,scale VA,row0 u32,count u32,reserved zero u64. 3 note Directory is the existing 257 pairs (weight,scale); shared expert is index256. 4 note Call once for gate/up, once for down; no quant descriptor format is defined here. 5 fn moe_s64 out edit uchar 8224 p ulong v ulong to void 6 for b ulong 8 7 put out add p b uchar and shr v mul b 8 255 8 end 9 end 10 fn moe_dir dir view ulong 514 e ulong to ulong 11 for k ulong 2 12 v = get dir add mul e 2 k 13 if or eq v 0 ne rem v 8 0 14 ret 3 15 end 16 end 17 ret 0 18 end 19 fn moe_svalid sg view ulong 1028 m view ulong 8 dir view ulong 514 to ulong 20 if or gt get m 1 257 gt get m 0 1152 21 ret 1 22 end 23 pos = ulong 0 24 for z ulong get m 1 25 p = mul z 4 26 e = get sg p 27 if gt e 256 28 ret 2 29 end 30 if ne get sg add p 1 pos 31 ret 2 32 end 33 if eq get sg add p 2 0 34 ret 2 35 end 36 if gt get sg add p 2 get m 0 37 ret 2 38 end 39 pos = add pos get sg add p 2 40 if gt pos get m 0 41 ret 2 42 end 43 if ne moe_dir dir e 0 44 ret 3 45 end 46 end 47 if ne pos get m 0 48 ret 2 49 end 50 ret 0 51 end 52 fn moe_srow sg view ulong 1028 dir view ulong 514 out edit uchar 8224 z ulong to void 53 p = mul z 32 54 e = get sg mul z 4 55 moe_s64 out p get dir mul e 2 56 moe_s64 out add p 8 get dir add mul e 2 1 57 v = get sg add mul z 4 1 58 cnt = get sg add mul z 4 2 59 v = or v shl cnt 32 60 moe_s64 out add p 16 v 61 moe_s64 out add p 24 0 62 end 63 fn moe_segs32 sg view ulong 1028 m view ulong 8 dir view ulong 514 out edit uchar 8224 to ulong 64 rc = moe_svalid sg m dir 65 if ne rc 0 66 ret rc 67 end 68 for z ulong get m 1 69 moe_srow sg dir out z 70 end 71 ret 0 72 end