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 / checks / arest-pfhost.om
| 1 | note SPDX-License-Identifier: Apache-2.0 |
| 2 | note gpu/nvidia/checks/arest-pfhost.om: pfreg and pfcount (gpu/nvidia/om/apirest/pfhost.om) through the root arpfreg |
| 3 | note (pfreg.om), as CUDApp tests/test_prefill_host_rest.c calls them. Unit pfreg: Q w, d. Unit pfcount: Q n, over |
| 4 | note the test's x (eleven bit patterns in turn); the answer is the count of -999.0f. Unit pfsweep: Q the largest n; |
| 5 | note the answer is the digest of the counts for every n from 0 up to it, the test's whole loop. Composed before |
| 6 | note arestg.om. |
| 7 | text t_name "AREST-PFHOST" |
| 8 | text t_pfreg "pfreg" |
| 9 | text t_pfcount "pfcount" |
| 10 | text t_pfsweep "pfsweep" |
| 11 | fn ax_cls k ulong to uint |
| 12 | if eq k 0 |
| 13 | ret 0 |
| 14 | end |
| 15 | if eq k 1 |
| 16 | ret 0x80000000 |
| 17 | end |
| 18 | if eq k 2 |
| 19 | ret 1 |
| 20 | end |
| 21 | if eq k 3 |
| 22 | ret 0x80000001 |
| 23 | end |
| 24 | if eq k 4 |
| 25 | ret 0x7f800000 |
| 26 | end |
| 27 | if eq k 5 |
| 28 | ret 0xff800000 |
| 29 | end |
| 30 | if eq k 6 |
| 31 | ret 0x7fc00000 |
| 32 | end |
| 33 | if eq k 7 |
| 34 | ret 0x7f800001 |
| 35 | end |
| 36 | if eq k 8 |
| 37 | ret 0xc479c000 |
| 38 | end |
| 39 | if eq k 9 |
| 40 | ret 0xc479bfff |
| 41 | end |
| 42 | ret 0xc479c001 |
| 43 | end |
| 44 | fn ax_cnt q view ulong 256 sweep bool to ulong |
| 45 | n = get q 0 |
| 46 | if gt n 4096 |
| 47 | ckbad |
| 48 | end |
| 49 | x = new f32 4096 0.0f32 |
| 50 | for i ulong 4096 |
| 51 | put x i bitcast f32 ax_cls rem i 11 |
| 52 | end |
| 53 | if not sweep |
| 54 | ret pfcount part x 0 n |
| 55 | end |
| 56 | h = ardg0 |
| 57 | for k ulong add n 1 bound 4097 |
| 58 | h = ardg h pfcount part x 0 k |
| 59 | end |
| 60 | ret h |
| 61 | end |
| 62 | fn arop q view ulong 256 nq ulong ny ulong o edit ulong 256 to ulong |
| 63 | if ckis 0 t_pfreg |
| 64 | if ne nq 2 |
| 65 | ckbad |
| 66 | end |
| 67 | ret arpfreg uint get q 0 uint get q 1 |
| 68 | end |
| 69 | if ne nq 1 |
| 70 | ckbad |
| 71 | end |
| 72 | if ckis 0 t_pfcount |
| 73 | ret ax_cnt q false |
| 74 | end |
| 75 | if ckis 0 t_pfsweep |
| 76 | ret ax_cnt q true |
| 77 | end |
| 78 | ckbad |
| 79 | ret 0 |
| 80 | end |