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 / graph / final_batch.om
| 1 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | note cfg N,max-xbatch,argmax-ctas,H. VAs hidden,logits,token,amv,ami. All xbatch launches precede per-head argmax pairs. |
| 3 | fn mg_finb c view ulong 16 v view ulong 16 d edit ulong 64 p ulong to ulong |
| 4 | a = new ulong 16 0 |
| 5 | for i ulong 64 |
| 6 | put d i 0 |
| 7 | end |
| 8 | chunks = div add get c 0 sub get c 1 1 get c 1 |
| 9 | if lt p chunks |
| 10 | h = mul p get c 1 |
| 11 | put d 0 7 |
| 12 | put d 7 sub get c 0 h |
| 13 | if gt get d 7 get c 1 |
| 14 | put d 7 get c 1 |
| 15 | end |
| 16 | put d 11 graph_slot get v 0 h get c 3 |
| 17 | put d 13 mul get c 2 2048 |
| 18 | put d 12 graph_slot get v 1 h get d 13 |
| 19 | ret 1 |
| 20 | end |
| 21 | j = sub p chunks |
| 22 | h = div j 2 |
| 23 | if ge h get c 0 |
| 24 | put d 0 255 |
| 25 | ret 1 |
| 26 | end |
| 27 | put d 0 8 |
| 28 | put d 1 5 |
| 29 | put d 2 get c 2 |
| 30 | put d 3 1 |
| 31 | put d 4 mul get c 2 2048 |
| 32 | put d 5 8 |
| 33 | put a 0 graph_slot get v 1 h get d 4 |
| 34 | put a 2 get v 3 |
| 35 | put a 3 get v 4 |
| 36 | if ne rem j 2 0 |
| 37 | put d 1 6 |
| 38 | put d 2 1 |
| 39 | put d 4 2048 |
| 40 | put a 0 get v 3 |
| 41 | put a 1 get v 4 |
| 42 | put a 3 add get v 2 mul h 256 |
| 43 | put a 2 add get a 3 4 |
| 44 | end |
| 45 | ret gr_pack a d 3 |
| 46 | end |