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_blks.om
| 1 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | fn vc_blks ids view uint * q view ulong 16 zz view ulong 4 to ulong |
| 3 | p = new ulong 16 0 |
| 4 | for j ulong 6 |
| 5 | put p j get q j |
| 6 | end |
| 7 | for jj ulong get zz 1 |
| 8 | i = add get zz 0 jj |
| 9 | put p 0 ulong get ids i |
| 10 | rc = api_at_plan 16 p |
| 11 | if ne rc 0 |
| 12 | ret rc |
| 13 | end |
| 14 | end |
| 15 | ret 0 |
| 16 | end |
| 17 | fn av_blks ids view uint * q view ulong 16 n ulong to ulong |
| 18 | zz = new ulong 4 0 |
| 19 | put zz 2 n |
| 20 | r = ulong 0 |
| 21 | for bb ulong add div n 1000000 1 |
| 22 | put zz 0 mul bb 1000000 |
| 23 | cnt = sub n get zz 0 |
| 24 | if gt cnt 1000000 |
| 25 | cnt = ulong 1000000 |
| 26 | end |
| 27 | put zz 1 cnt |
| 28 | rr = vc_blks ids q zz |
| 29 | if ne rr 0 |
| 30 | ret rr |
| 31 | end |
| 32 | end |
| 33 | ret r |
| 34 | end |