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 / codegen / cg_pfhost_rl.om

147 lines · 3360 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2note Router config cf[0..7]: k,e,t,mutant,warps,passes,chunks,group-bytes.
3fn ph_rl_meta cf view ulong 64 meta edit ulong 512 to void
4nv = add add 21 get cf 2 get cf 5
5put meta 1 nv
6put meta 2 1
7put meta 320 2
8for v ulong nv
9sz = ulong 1
10if lt v 3
11sz = ulong 2
12end
13if ge v 15
14sz = ulong 4
15if and ge v 17 lt v add 17 get cf 2
16sz = ulong 1
17end
18end
19put meta add 64 v sz
20end
21end
22fn ph_rl_head ins edit ulong 8192 st edit ulong 16 cf view ulong 64 to void
23ph_imm ins st 7 0 856 4
24ph_imm ins st 5 0 896 2
25ph_imm ins st 5 1 904 2
26ph_imm ins st 5 2 912 2
27ph_imm ins st 3 3 33 2
28ph_imm ins st 3 4 37 2
29ph_imm ins st 2 7 1 0
30ph_base st 17 5 3 PHNONE
31put st 14 5
32ph_emit ins st 0
33ph_base st 18 6 3 PHNONE
34put st 14 31
35ph_emit ins st 0
36ph_imad ins st 8 4 get cf 2 5
37ph_wide ins st 0 8 mul get cf 0 4 0
38ph_wide ins st 0 6 16 0
39ph_imad ins st 9 5 512 PHNONE
40ph_imad ins st 9 6 16 9
41ph_wide ins st 1 3 16 1
42ph_imad ins st 10 4 mul get cf 2 get cf 1 3
43ph_wide ins st 2 10 4 2
44for t ulong get cf 2
45ph_imm ins st 2 add 17 t 2147483648 0
46end
47ph_load ins st 15 1 0 11
48ph_imm ins st 2 11 get cf 6 0
49end
50fn ph_rl_stage ins edit ulong 8192 st edit ulong 16 cf view ulong 64 to void
51ph_imm ins st 48 PHNONE 0 0
52for p ulong get cf 5
53d = add add 21 get cf 2 p
54off = mul mul mul p get cf 4 get cf 0 4
55kind = ulong 3
56if eq p 0
57kind = ulong 2
58end
59ph_load ins st d 0 off kind
60end
61for p ulong get cf 5
62for q ulong 4
63off = add mul mul p get cf 4 512 mul 4 q
64ph_imad ins st 10 7 off 9
65ph_base st 50 PHNONE 10 add add 21 get cf 2 p
66put st 15 shl q 32
67ph_emit ins st 5
68end
69end
70ph_imm ins st 48 PHNONE 0 0
71ph_wide ins st 0 7 512 0
72ph_imm ins st 2 13 0 0
73ph_imm ins st 2 12 16 0
74end
75fn ph_rl_math ins edit ulong 8192 st edit ulong 16 cf edit ulong 64 b0 ulong nb ulong rv ulong to void
76for i ulong nb
77for q ulong 4
78put cf 8 add add 17 b0 i
79put cf 9 0
80put cf 10 14
81put cf 11 rv
82put cf 12 add add 17 get cf 2 i
83put cf 13 q
84put cf 14 q
85ph_muladd ins st cf
86end
87end
88end
89fn ph_rl_compute ins edit ulong 8192 st edit ulong 16 cf edit ulong 64 rv ulong imm ulong to void
90b0 = ulong 0
91while lt b0 get cf 2 bound 4
92nb = sub get cf 2 b0
93if gt nb 4
94nb = ulong 4
95end
96for i ulong nb
97ph_base st 58 add add 17 get cf 2 i 13 PHNONE
98put st 14 add mul add b0 i 512 imm
99kind = ulong 3
100if eq i 0
101kind = ulong 2
102end
103ph_emit ins st kind
104end
105ph_rl_math ins st cf b0 nb rv
106b0 = add b0 4
107end
108end
109fn ph_rl_iter ins edit ulong 8192 st edit ulong 16 cf edit ulong 64 to void
110ph_consume st
111ph_load ins st 16 1 get cf 7 11
112ph_rl_compute ins st cf 15 0
113ph_consume st
114ph_load ins st 15 1 mul 2 get cf 7 11
115ph_rl_compute ins st cf 16 16
116ph_wide ins st 1 7 mul 2 get cf 7 1
117ph_imad ins st 13 7 32 13
118ph_imad ins st 12 7 4294967295 12
119ph_base st 28 PHNONE 12 7
120ph_emit ins st 1
121end
122fn ph_rl_body ins edit ulong 8192 st edit ulong 16 cf edit ulong 64 meta edit ulong 512 to void
123ph_rl_head ins st cf
124outer = get st 0
125ph_rl_stage ins st cf
126inner = get st 0
127ph_rl_iter ins st cf
128ph_branch ins st inner
129put meta 16 inner
130put meta 17 sub get st 0 1
131ph_imad ins st 11 7 4294967295 11
132ph_base st 28 PHNONE 11 7
133ph_emit ins st 1
134ph_branch ins st outer
135put meta 18 outer
136put meta 19 sub get st 0 1
137put meta 5 2
138ph_consume st
139for t ulong get cf 2
140ph_base st 12 PHNONE 2 add 17 t
141put st 13 0
142put st 14 mul mul t get cf 1 4
143ph_emit ins st 5
144end
145ph_tail ins st
146put meta 0 get st 0
147end