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