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_max.om
| 1 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | fn vc_max s view uint * zz view ulong 4 to ulong |
| 3 | r = ulong 1 |
| 4 | for jj ulong get zz 1 |
| 5 | i = add get zz 0 jj |
| 6 | if gt ulong get s i r |
| 7 | r = ulong get s i |
| 8 | end |
| 9 | end |
| 10 | ret r |
| 11 | end |
| 12 | fn av_max s view uint * n ulong to ulong |
| 13 | zz = new ulong 4 0 |
| 14 | put zz 2 n |
| 15 | r = ulong 1 |
| 16 | for bb ulong add div n 1000000 1 |
| 17 | put zz 0 mul bb 1000000 |
| 18 | cnt = sub n get zz 0 |
| 19 | if gt cnt 1000000 |
| 20 | cnt = ulong 1000000 |
| 21 | end |
| 22 | put zz 1 cnt |
| 23 | rr = vc_max s zz |
| 24 | if gt rr r |
| 25 | r = rr |
| 26 | end |
| 27 | end |
| 28 | ret r |
| 29 | end |
| 30 | note Preserve the cut-F float polynomial, scalar order and empty-split handling. |