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 / src / tensor / omega_tensor_gb10.om
| 1 | note SPDX-License-Identifier: Apache-2.0 |
| 2 | note omega_tensor_gb10.om -- Pure seeded OM-2 GB10 realization descriptor and op-mapping table. |
| 3 | note Refuses unmapped ops with OMEGA_NUMERIC_ERR_NOT_ENCODED (-4) before opening any device. |
| 4 | note No silent CPU fallback. |
| 5 | |
| 6 | const OT_GB10_ERR_NOT_ENCODED long -4 |
| 7 | const OT_GB10_ERR_BAD_ARGS long -1 |
| 8 | const OT_GB10_ERR_OPERANDS long -2 |
| 9 | const OT_GB10_REDUCE_MAX_N ulong 32768 |
| 10 | |
| 11 | note Returns E1 GB10 SIMT op id (>= 1) if encoded on GB10, or 0 if refused. |
| 12 | fn ot_gb10_simt_op_id op ulong to ulong |
| 13 | if le op OT_TB_SEL_NEU |
| 14 | ret add op 1 |
| 15 | end |
| 16 | ret 0 |
| 17 | end |
| 18 | |
| 19 | note Returns E1 row-10 transc kernel id (0..10) if encoded on GB10, or -1 if refused. |
| 20 | fn ot_gb10_transc_kernel op ulong to long |
| 21 | if eq op OT_TU_EXP2 |
| 22 | ret 0 |
| 23 | end |
| 24 | if eq op OT_TU_LOG2 |
| 25 | ret 1 |
| 26 | end |
| 27 | if eq op OT_TU_SIGMOID |
| 28 | ret 2 |
| 29 | end |
| 30 | if eq op OT_TU_TANH |
| 31 | ret 3 |
| 32 | end |
| 33 | if eq op OT_TU_SIN |
| 34 | ret 4 |
| 35 | end |
| 36 | if eq op OT_TU_COS |
| 37 | ret 5 |
| 38 | end |
| 39 | if eq op OT_TU_ERF |
| 40 | ret 6 |
| 41 | end |
| 42 | if eq op OT_TU_GELU |
| 43 | ret 7 |
| 44 | end |
| 45 | if eq op OT_TU_RSQRT |
| 46 | ret 8 |
| 47 | end |
| 48 | if eq op OT_TU_EXP |
| 49 | ret 9 |
| 50 | end |
| 51 | if eq op OT_TU_LOG |
| 52 | ret 10 |
| 53 | end |
| 54 | ret -1 |
| 55 | end |
| 56 | |
| 57 | fn ot_gb10_check_reduce op ulong n ulong to long |
| 58 | if gt n OT_GB10_REDUCE_MAX_N |
| 59 | ret OT_GB10_ERR_OPERANDS |
| 60 | end |
| 61 | if or ge op OT_TR_COUNT eq n 0 |
| 62 | ret OT_GB10_ERR_BAD_ARGS |
| 63 | end |
| 64 | ret 0 |
| 65 | end |