interplane.Get Omega
Read in your language

omega-mv

Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.

Brought by drakestapleton

branch main Branches Tags History

omega-mv / gpu / nvidia / om / api / attn_host.om

50 lines · 1095 bytes Raw Blame History
1om2
2note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
3note q inputs rows, query heads, head dim, rows per launch, max blocks, has ids.
4note q 10 is row cursor; q 11..22 describe one existing launch without new admission policy.
5fn ah_plan q edit ulong 32 op uint to ulong
6if eq op 0
7v = and add uint get q 2 31 4294967264
8put q 8 ulong v
9put q 9 ulong mul v 16
10ret 0
11end
12if eq op 1
13put q 8 mul get q 1 get q 2
14idw = ulong 1
15if ne get q 5 0
16idw = mul get q 3 get q 4
17end
18put q 9 add add mul get q 3 4 get q 1 idw
19put q 10 0
20ret 0
21end
22if eq op 3
23put q 10 get q 22
24ret 0
25end
26if ge get q 10 get q 0
27ret 0
28end
29nr = sub get q 0 get q 10
30if gt nr get q 3
31nr = get q 3
32end
33put q 11 nr
34put q 12 and mul nr 4 4294967295
35put q 13 and add mul nr 4 get q 1 4294967295
36words = ulong 1
37if ne get q 5 0
38words = mul nr get q 4
39end
40put q 14 add get q 13 words
41put q 15 mul get q 10 get q 8
42put q 16 mul mul nr get q 8 4
43put q 17 mul get q 14 4
44put q 18 mul get q 10 get q 4
45put q 19 mul mul nr get q 4 4
46put q 20 mul get q 1 4
47put q 21 ulong mul uint get q 12 4
48put q 22 add get q 10 get q 3
49ret 1
50end