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_group.om
| 1 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | note Reuse OMEGA_DEC_GROUP groups=9 one CTA; no new GPU executor or inter-CTA protocol. |
| 3 | note req: ids,tgu,tdn,sgu,sdn,xmap,ymap,stride,tokens,seg_entries,map_entries, |
| 4 | note directory_slots,session_generation,current_generation,admitted,shared_id. |
| 5 | note admitted is the external selector/cache admission verdict, NOT qualification here. |
| 6 | note Router directories must be the existing q36 router outputs including shared slot 8. |
| 7 | note seg_entries must cover ALL R descriptors, including GROUP trailing zero writes. |
| 8 | note Output is exact OMEGA_DEC_GR_WORDS u32 constant-bank words, little endian pairs. |
| 9 | fn moe_word o edit uchar 64 p ulong v ulong to void |
| 10 | for b ulong 4 |
| 11 | put o add mul p 4 b uchar and shr v mul b 8 255 |
| 12 | end |
| 13 | end |
| 14 | fn moe_pair o edit uchar 64 p ulong v ulong to void |
| 15 | moe_word o p and v 4294967295 |
| 16 | moe_word o add p 1 shr v 32 |
| 17 | end |
| 18 | fn moe_extent r view ulong 16 i ulong to ulong |
| 19 | if lt i 3 |
| 20 | width = mul ulong 9 16 |
| 21 | if eq i 0 |
| 22 | width = mul ulong 8 4 |
| 23 | end |
| 24 | ret add mul sub get r 8 1 get r 7 width |
| 25 | end |
| 26 | if lt i 5 |
| 27 | ret mul mul get r 8 9 32 |
| 28 | end |
| 29 | ret mul add mul get r 8 9 8 4 |
| 30 | end |
| 31 | fn moe_overlap a ulong al ulong b ulong bl ulong to bool |
| 32 | if ge a add b bl |
| 33 | ret false |
| 34 | end |
| 35 | ret lt b add a al |
| 36 | end |
| 37 | fn moe_alias r view ulong 16 to bool |
| 38 | for i ulong 7 |
| 39 | n = moe_extent r i |
| 40 | if gt get r i sub ulong 18446744073709551615 n |
| 41 | ret true |
| 42 | end |
| 43 | end |
| 44 | for j ulong 4 |
| 45 | for i ulong add j 3 |
| 46 | n = moe_extent r i |
| 47 | m = moe_extent r add j 3 |
| 48 | if moe_overlap get r i n get r add j 3 m |
| 49 | ret true |
| 50 | end |
| 51 | end |
| 52 | end |
| 53 | ret false |
| 54 | end |
| 55 | fn moe_group r view ulong 16 o edit uchar 64 to ulong |
| 56 | if gt get r 8 128 |
| 57 | ret 1 |
| 58 | end |
| 59 | rows = mul get r 8 9 |
| 60 | if or eq get r 8 0 gt rows 128 |
| 61 | ret 1 |
| 62 | end |
| 63 | if or ne get r 11 9 ne get r 15 256 |
| 64 | ret 1 |
| 65 | end |
| 66 | if lt get r 9 rows |
| 67 | ret 2 |
| 68 | end |
| 69 | if lt get r 10 add rows 8 |
| 70 | ret 2 |
| 71 | end |
| 72 | if or eq get r 7 0 gt get r 7 4294967295 |
| 73 | ret 2 |
| 74 | end |
| 75 | if lt get r 7 mul ulong 9 16 |
| 76 | ret 2 |
| 77 | end |
| 78 | if ne rem get r 7 16 0 |
| 79 | ret 3 |
| 80 | end |
| 81 | for i ulong 7 |
| 82 | if or eq get r i 0 ne rem get r i 8 0 |
| 83 | ret 3 |
| 84 | end |
| 85 | end |
| 86 | if ne get r 12 get r 13 |
| 87 | ret 4 |
| 88 | end |
| 89 | if ne get r 14 1 |
| 90 | ret 4 |
| 91 | end |
| 92 | if moe_alias r |
| 93 | ret 5 |
| 94 | end |
| 95 | for i ulong 7 |
| 96 | moe_pair edit o mul i 2 get r i |
| 97 | end |
| 98 | moe_word o 14 get r 7 |
| 99 | moe_word o 15 get r 8 |
| 100 | ret 0 |
| 101 | end |