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 / api / attn_bfexp.om
| 1 | om2 |
| 2 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 3 | note Inner traversal blocks preserve the checked one-million-iteration guard. |
| 4 | fn vc_bfexp s view ushort * d edit f32 * q view ulong 4 to ulong |
| 5 | for zzj ulong get q 1 |
| 6 | i = add get q 0 zzj |
| 7 | put d i bitcast f32 shl uint get s i 16 |
| 8 | end |
| 9 | ret 0 |
| 10 | end |
| 11 | |
| 12 | fn av_bfexp s view ushort * d edit f32 * n ulong to ulong |
| 13 | q = new ulong 4 0 |
| 14 | r = ulong 0 |
| 15 | for zzb ulong add div n 1000000 1 |
| 16 | put q 0 mul zzb 1000000 |
| 17 | zzn = sub n get q 0 |
| 18 | if gt zzn 1000000 |
| 19 | zzn = ulong 1000000 |
| 20 | end |
| 21 | put q 1 zzn |
| 22 | rr = vc_bfexp s d q |
| 23 | r = rr |
| 24 | end |
| 25 | ret r |
| 26 | end |