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_comp.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_comp s view uint * d edit uint * q view ulong 4 to ulong |
| 5 | j = get q 2 |
| 6 | for zzj ulong get q 1 |
| 7 | i = add get q 0 zzj |
| 8 | v = get s i |
| 9 | if lt v 2147483648 |
| 10 | put d j uint v |
| 11 | j = add j 1 |
| 12 | end |
| 13 | end |
| 14 | ret j |
| 15 | end |
| 16 | |
| 17 | fn av_comp s view uint * d edit uint * n ulong to ulong |
| 18 | q = new ulong 4 0 |
| 19 | r = ulong 0 |
| 20 | for zzb ulong add div n 1000000 1 |
| 21 | put q 0 mul zzb 1000000 |
| 22 | zzn = sub n get q 0 |
| 23 | if gt zzn 1000000 |
| 24 | zzn = ulong 1000000 |
| 25 | end |
| 26 | put q 1 zzn |
| 27 | put q 2 r |
| 28 | rr = vc_comp s d q |
| 29 | r = rr |
| 30 | end |
| 31 | ret r |
| 32 | end |