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 / seed / spirv / vk.unit.om
| 1 | note Data-parallel fixtures for the Vulkan GLCompute path (gate-vkspirv.sh). |
| 2 | note One invocation computes one element; inputs and outputs are canonical ulong words. |
| 3 | fn vadd a ulong b ulong to ulong |
| 4 | ret add a b |
| 5 | end |
| 6 | note Integer saxpy: signed, so an overflowing row traps (status 101) instead of wrapping. |
| 7 | fn saxpy a long x long y long to long |
| 8 | ret add mul a x y |
| 9 | end |
| 10 | note SplitMix64 finaliser, the element generator for the reduce fixture. |
| 11 | fn mix x ulong to ulong |
| 12 | z = add x 11400714819323198485 |
| 13 | z = mul xor z shr z 30 13787848793156543929 |
| 14 | z = mul xor z shr z 27 10723151780598845931 |
| 15 | ret xor z shr z 31 |
| 16 | end |
| 17 | note Reduce stage 1: one invocation sums n generated u32 elements starting at base. |
| 18 | note Stage 2 combines partials pairwise with vadd, one dispatch per tree level. |
| 19 | fn rsum seed ulong base ulong n ulong to ulong |
| 20 | s = ulong 0 |
| 21 | for i ulong n |
| 22 | e = and mix add seed add base i 4294967295 |
| 23 | s = add s e |
| 24 | end |
| 25 | ret s |
| 26 | end |