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_total.om
| 1 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | fn vc_total eff view uint * zz view ulong 4 bs ulong to ulong |
| 3 | r = ulong 0 |
| 4 | for jj ulong get zz 1 |
| 5 | i = add get zz 0 jj |
| 6 | v = ulong get eff i |
| 7 | if ne v 0 |
| 8 | r = add r div add v sub bs 1 bs |
| 9 | end |
| 10 | end |
| 11 | ret r |
| 12 | end |
| 13 | fn av_total eff view uint * n ulong bs ulong to ulong |
| 14 | zz = new ulong 4 0 |
| 15 | put zz 2 n |
| 16 | r = ulong 0 |
| 17 | for bb ulong add div n 1000000 1 |
| 18 | put zz 0 mul bb 1000000 |
| 19 | cnt = sub n get zz 0 |
| 20 | if gt cnt 1000000 |
| 21 | cnt = ulong 1000000 |
| 22 | end |
| 23 | put zz 1 cnt |
| 24 | rr = vc_total eff zz bs |
| 25 | r = add r rr |
| 26 | end |
| 27 | ret r |
| 28 | end |