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 / tests / attention_ollm.om

114 lines · 1843 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2text AOOK "ATTENTION OLLM PASS (36 resident KV wires; 2 fused kernel streams equal existing oracle-checked roots; future-token mask; invalid shape refusals)\n"
3fn aowire h ulong cap ulong bf ulong last bool to bool
4shape = new ulong 4 0
5tab = new uint 64 0
6args = new uint 32 0
7put shape 0 h
8put shape 1 cap
9pos = ulong 0
10if last
11pos = sub cap 1
12end
13put shape 2 pos
14put shape 3 bf
15put args 0 1234
16if ne attention_ollm_wire shape tab args 0
17ret false
18end
19if ne get tab 0 0
20ret false
21end
22if ne get tab 1 uint add pos 1
23ret false
24end
25if ne get tab 2 uint add h 4
26ret false
27end
28if ne get args 0 1234
29ret false
30end
31esize = ulong 4
32if eq bf 1
33esize = ulong 2
34end
35headb = mul mul cap 64 esize
36for i ulong h
37if ne get tab add i 4 uint mul i headb
38ret false
39end
40end
41if ne get args 12 uint mul h headb
42ret false
43end
44if ne get args 11 uint mul 64 esize
45ret false
46end
47put shape 2 cap
48if eq attention_ollm_wire shape tab args 0
49ret false
50end
51put shape 2 0
52put shape 0 7
53if eq attention_ollm_wire shape tab args 0
54ret false
55end
56ret true
57end
58fn aokernel bf ulong to bool
59ins = new ulong 8192 0
60ref = new ulong 8192 0
61meta = new ulong 512 0
62rm = new ulong 512 0
63if ne attention_ollm_ir bf ins meta 0
64ret false
65end
66kind = ulong 3
67if eq bf 1
68kind = ulong 2
69end
70if ne attention_ir kind 64 31 0 ref rm 0
71ret false
72end
73for i ulong 8192
74if ne get ins i get ref i
75ret false
76end
77end
78for i ulong 512
79if ne get meta i get rm i
80ret false
81end
82end
83ret gt get meta 0 0
84end
85fn main to int
86for bf ulong 2
87if not aokernel bf
88ret 1
89end
90for s ulong 3
91h = ulong 6
92if eq s 1
93h = ulong 8
94end
95if eq s 2
96h = ulong 16
97end
98for t ulong 3
99cap = shl ulong 512 mul t 2
100if not aowire h cap bf false
101ret 2
102end
103if not aowire h cap bf true
104ret 3
105end
106end
107end
108end
109n = write 1 AOOK 0 len AOOK
110if ne n long len AOOK
111ret 4
112end
113ret 0
114end