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.om
| 1 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | note Existing GROUP has 128 rows and nine contributions/token: reuse bounded token windows. |
| 3 | note All windows stay in ONE existing session/cmdlist; GROUP/GU/SWIGLU/DN complete in list order. |
| 4 | note Reuse descriptor/maps only after preceding DN via existing recorder barriers, never inter-CTA spin. |
| 5 | note Input version,tokens,H,EI,contributions,router_stride,window_capacity,reserved. |
| 6 | note Each output8: token0,tokens,rows,XP bytes,GU bytes,ACT bytes,DN bytes,router bytes. |
| 7 | note Meta windows,total_tokens,total_rows,version. Refusals preserve output/meta. |
| 8 | fn moe_woff c view ulong 8 o edit ulong 1024 z ulong first ulong to void |
| 9 | b = mul z 8 |
| 10 | v = mul first get c 2 |
| 11 | put o add b 3 mul v 4 |
| 12 | v = mul first get c 4 |
| 13 | v = mul v get c 3 |
| 14 | put o add b 4 mul v 8 |
| 15 | put o add b 5 mul v 4 |
| 16 | v = mul first get c 4 |
| 17 | v = mul v get c 2 |
| 18 | put o add b 6 mul v 4 |
| 19 | put o add b 7 mul first get c 5 |
| 20 | end |
| 21 | fn moe_wrow c view ulong 8 o edit ulong 1024 z ulong first ulong count ulong to void |
| 22 | b = mul z 8 |
| 23 | rows = mul count get c 4 |
| 24 | put o b first |
| 25 | put o add b 1 count |
| 26 | put o add b 2 rows |
| 27 | moe_woff c o z first |
| 28 | end |
| 29 | fn moe_windows c view ulong 8 o edit ulong 1024 m edit ulong 4 to ulong |
| 30 | if or ne get c 0 1 gt get c 1 128 |
| 31 | ret 1 |
| 32 | end |
| 33 | if or ne get c 2 2048 ne get c 3 512 |
| 34 | ret 1 |
| 35 | end |
| 36 | if ne get c 4 9 |
| 37 | ret 1 |
| 38 | end |
| 39 | if or eq get c 5 0 gt get c 5 4294967295 |
| 40 | ret 1 |
| 41 | end |
| 42 | if ne rem get c 5 16 0 |
| 43 | ret 1 |
| 44 | end |
| 45 | if or gt get c 6 128 ne get c 7 0 |
| 46 | ret 1 |
| 47 | end |
| 48 | take = div ulong 128 9 |
| 49 | nw = div add get c 1 sub take 1 take |
| 50 | if gt nw get c 6 |
| 51 | ret 2 |
| 52 | end |
| 53 | first = ulong 0 |
| 54 | for z ulong nw |
| 55 | count = sub get c 1 first |
| 56 | if gt count take |
| 57 | count = take |
| 58 | end |
| 59 | moe_wrow c o z first count |
| 60 | first = add first count |
| 61 | end |
| 62 | put m 0 nw |
| 63 | put m 1 get c 1 |
| 64 | put m 2 mul get c 1 9 |
| 65 | put m 3 1 |
| 66 | ret 0 |
| 67 | end |