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_gdn_shape.om

65 lines · 1028 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2note GDN shape (omega_gdn_shape), shared by the builder unit cg_gdn and the policy unit cg_gdn_policy.
3fn omega_gd_pick c bool a ulong b ulong to ulong
4if c
5ret a
6end
7ret b
8end
9note The shape: ratio 0 means 3; 1..3 are valid; 0 returned for an invalid ratio.
10fn omega_gd_rr ra ulong to ulong
11r = ra
12if eq r 0
13r = 3
14end
15if or lt r 1 gt r 3
16ret 0
17end
18ret r
19end
20note Queries: 0 valid 1 r 2 vh 3 vdim 4 conv 5 par_scal 6 par_norm 7 par_bytes 8 tail_bytes 9 state_bytes 10 post_grid_y.
21fn omega_gd_shq q ulong ra ulong bf ulong to ulong
22r = omega_gd_rr ra
23if eq r 0
24ret 0
25end
26if eq q 0
27ret 1
28end
29vh = mul 16 r
30vdim = mul 128 vh
31conv = add 4096 vdim
32ps = mul 16 conv
33pn = add ps mul 8 vh
34if eq q 1
35ret r
36end
37if eq q 2
38ret vh
39end
40if eq q 3
41ret vdim
42end
43if eq q 4
44ret conv
45end
46if eq q 5
47ret ps
48end
49if eq q 6
50ret pn
51end
52if eq q 7
53ret add pn 512
54end
55if eq q 8
56ret mul 6144 vh
57end
58if eq q 9
59ret mul omega_gd_pick ne bf 0 32768 65536 vh
60end
61if eq q 10
62ret div vh 8
63end
64ret 0
65end