interplane.Get Omega
Read in your language

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

branch main Branches Tags History

CUDApp / om / moe / moe_group.om

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