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

55 lines · 1228 bytes Raw Blame History
1om2
2note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
3note q={m,n,np,set-as-uint32,poison-f32-bits}; one last-real word per 16x8 output tile.
4note Public view transports uint bits for the native OM2 integer ABI; equality remains private f32 equality.
5fn st_last tile ulong width ulong lim ulong to ulong
6x = add mul tile width sub width 1
7if ge x lim
8ret sub lim 1
9end
10ret x
11end
12fn st_one q view ulong 5 c edit uint * idx ulong to ulong
13poison = uint get q 4
14if ne get q 3 0
15put c idx poison
16ret ulong 1
17end
18if eq bitcast f32 get c idx bitcast f32 poison
19ret ulong 1
20end
21ret ulong 0
22end
23fn st_row q view ulong 5 c edit uint * ti ulong to ulong
24row = st_last ti 16 get q 0
25count = ulong 0
26nt = div and add get q 1 7 4294967295 8
27for tj ulong nt
28col = st_last tj 8 get q 1
29idx = add mul row get q 2 col
30count = add count st_one q c idx
31end
32ret count
33end
34fn sentin q view ulong 5 c edit uint * to ulong
35for i ulong 5
36if gt get q i 4294967295
37ret ulong 0
38end
39end
40if gt get q 1 get q 2
41ret ulong 0
42end
43if lt len c mul get q 0 get q 2
44ret ulong 0
45end
46if or eq get q 0 0 eq get q 1 0
47ret ulong 0
48end
49count = ulong 0
50mt = div and add get q 0 15 4294967295 16
51for ti ulong mt
52count = add count st_row q c ti
53end
54ret count
55end