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 / components / cm_route.om
| 1 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | note Residual model routing and SHA block planning. Sizes are supplied by the C ABI shell. |
| 3 | note Binary64 prediction, fit, tables and admission already live in cm_* units from CUDApp#291. |
| 4 | fn cm_route mode ulong data edit ulong 16 to ulong |
| 5 | if eq mode 0 |
| 6 | note SHA256 block cursor; floor division and remainder preserve every size_t input. |
| 7 | nbytes = get data 0 |
| 8 | put data 1 div nbytes 64 |
| 9 | put data 2 rem nbytes 64 |
| 10 | put data 3 mul div nbytes 64 64 |
| 11 | ret 1 |
| 12 | end |
| 13 | if eq mode 1 |
| 14 | note Blob body size is a sum of ABI object sizes, not a reimplementation of their layouts. |
| 15 | total = ulong 0 |
| 16 | for i ulong 6 |
| 17 | total = add total get data i |
| 18 | end |
| 19 | ret total |
| 20 | end |
| 21 | if eq mode 2 |
| 22 | if lt get data 0 get data 1 |
| 23 | ret 1 |
| 24 | end |
| 25 | ret 0 |
| 26 | end |
| 27 | if eq mode 3 |
| 28 | ret add get data 0 get data 1 |
| 29 | end |
| 30 | if eq mode 4 |
| 31 | ret sub get data 0 get data 1 |
| 32 | end |
| 33 | ret 0 |
| 34 | end |