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
CUDApp / om / moe / moe_windows_wide.om
| 1 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | note moe_windows with the contribution count read from cfg instead of the literal 9. |
| 3 | note Profiles (H,EI,contributions): (2048,512,9) Qwen3.6-35B; (2560,640,11) Qwen3.8-Flash-Next. |
| 4 | note GROUP has 128 rows: take = 128/contributions tokens per window (14 or 11). |
| 5 | note All windows stay in ONE existing session/cmdlist; GROUP/GU/SWIGLU/DN complete in list order. |
| 6 | note Input version 1,tokens,H,EI,contributions,router_stride,window_capacity,reserved. |
| 7 | note Each output8: token0,tokens,rows,XP bytes,GU bytes,ACT bytes,DN bytes,router bytes. |
| 8 | note Meta windows,total_tokens,total_rows,version. Refusals preserve output/meta. |
| 9 | fn mw_woff c view ulong 8 o edit ulong 1024 z ulong first ulong to void |
| 10 | b = mul z 8 |
| 11 | v = mul first get c 2 |
| 12 | put o add b 3 mul v 4 |
| 13 | v = mul first get c 4 |
| 14 | v = mul v get c 3 |
| 15 | put o add b 4 mul v 8 |
| 16 | put o add b 5 mul v 4 |
| 17 | v = mul first get c 4 |
| 18 | v = mul v get c 2 |
| 19 | put o add b 6 mul v 4 |
| 20 | put o add b 7 mul first get c 5 |
| 21 | end |
| 22 | fn mw_wrow c view ulong 8 o edit ulong 1024 z ulong first ulong count ulong to void |
| 23 | b = mul z 8 |
| 24 | rows = mul count get c 4 |
| 25 | put o b first |
| 26 | put o add b 1 count |
| 27 | put o add b 2 rows |
| 28 | mw_woff c o z first |
| 29 | end |
| 30 | fn mw_wshape c view ulong 8 to ulong |
| 31 | if eq get c 4 9 |
| 32 | if eq get c 2 2048 |
| 33 | if eq get c 3 512 |
| 34 | ret 0 |
| 35 | end |
| 36 | end |
| 37 | end |
| 38 | if eq get c 4 11 |
| 39 | if eq get c 2 2560 |
| 40 | if eq get c 3 640 |
| 41 | ret 0 |
| 42 | end |
| 43 | end |
| 44 | end |
| 45 | ret 1 |
| 46 | end |
| 47 | fn moe_windows_wide c view ulong 8 o edit ulong 1024 m edit ulong 4 to ulong |
| 48 | if or ne get c 0 1 gt get c 1 128 |
| 49 | ret 1 |
| 50 | end |
| 51 | if ne mw_wshape c 0 |
| 52 | ret 1 |
| 53 | end |
| 54 | if or eq get c 5 0 gt get c 5 4294967295 |
| 55 | ret 1 |
| 56 | end |
| 57 | if ne rem get c 5 16 0 |
| 58 | ret 1 |
| 59 | end |
| 60 | if or gt get c 6 128 ne get c 7 0 |
| 61 | ret 1 |
| 62 | end |
| 63 | take = div ulong 128 get c 4 |
| 64 | nw = div add get c 1 sub take 1 take |
| 65 | if gt nw get c 6 |
| 66 | ret 2 |
| 67 | end |
| 68 | first = ulong 0 |
| 69 | for z ulong nw |
| 70 | count = sub get c 1 first |
| 71 | if gt count take |
| 72 | count = take |
| 73 | end |
| 74 | mw_wrow c o z first count |
| 75 | first = add first count |
| 76 | end |
| 77 | put m 0 nw |
| 78 | put m 1 get c 1 |
| 79 | put m 2 mul get c 1 get c 4 |
| 80 | put m 3 1 |
| 81 | ret 0 |
| 82 | end |