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 / prefill-shape / order.om

53 lines · 1388 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2note Grouped work order: adjacent column jobs reuse one weight panel across row tiles.
3note Private plan: grid x, grid y, record count, then records of opcode,dst,src1,src2,immediate.
4note Registers 0=cx,1=cy,2=temporary,3=tile count. Opcodes are private adapter operations.
5fn qgo_put plan edit ulong 64 at ulong op ulong regs ulong imm ulong to ulong
6put plan at op
7put plan add at 1 rem regs 4
8put plan add at 2 rem div regs 4 4
9put plan add at 3 div regs 16
10put plan add at 4 imm
11ret add at 5
12end
13
14fn qgo_emit plan edit ulong 64 group ulong guard ulong to ulong
15size = shl ulong 1 group
16at = qgo_put plan 3 1 2 sub size 1
17at = qgo_put plan at 2 0 group
18at = qgo_put plan at 3 37 size
19if eq guard 1
20note Tile count is constant-bank argument word11, byte896+44=940.
21at = qgo_put plan at 4 3 940
22at = qgo_put plan at 5 52 0
23at = qgo_put plan at 6 0 0
24end
25put plan 2 div sub at 3 5
26ret 1
27end
28
29fn native_qgorder plan edit ulong 64 group ulong cols ulong tiles ulong guard ulong to ulong
30put plan 0 0
31put plan 1 0
32put plan 2 0
33if or gt group 5 gt guard 1
34ret 0
35end
36if or eq cols 0 gt cols 65535
37ret 0
38end
39if or eq tiles 0 gt tiles 65535
40ret 0
41end
42size = shl ulong 1 group
43gx = mul cols size
44if gt gx 65535
45ret 0
46end
47put plan 0 gx
48put plan 1 div add tiles sub size 1 size
49if eq group 0
50ret 1
51end
52ret qgo_emit plan group guard
53end