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 / gdn_admit.om
| 1 | note SPDX-License-Identifier: Apache-2.0 |
| 2 | note gpu/nvidia/checks/gdn_admit.om: the Omega port of CUDApp tests/gdn_admit_diff.c. Composed after gpu/nvidia/om/gdn/admit.om |
| 3 | note and gpu/nvidia/checks/lib.om; run with gpu/nvidia/checks/gdn_admit.tsv, whose expected values the retained C |
| 4 | note admission oracle (src/omega_gpu_gdn_admit.c, CUDAPP_MIGRATION_PENDING_C_GDN_ADMIT) wrote over the domain of the |
| 5 | note old differential (each predicate at v-1/v/v+1, 0 and the extremes of every field, the non-finite f32 classes, |
| 6 | note every alignment residue class). |
| 7 | note Case: OP A B C I0..I6 R O0..O9. o[0..6] = I0..I6, then gdn_admit OP A B C o must refuse (1) exactly when R is 1; |
| 8 | note when admitted, the outputs the C binding reads back must equal O: shape and alloc o[0..9], layout o[0..6], move |
| 9 | note o[0]. The other ops return a verdict only. |
| 10 | text t_name "GDN_ADMIT" |
| 11 | fn cname to void |
| 12 | for i ulong len t_name bound 64 |
| 13 | ckoc ulong get t_name i |
| 14 | end |
| 15 | end |
| 16 | note how many outputs of gdn_admit OP the C binding reads |
| 17 | fn gouts op ulong to ulong |
| 18 | if or eq op 1 eq op 2 |
| 19 | ret 10 |
| 20 | end |
| 21 | if eq op 7 |
| 22 | ret 7 |
| 23 | end |
| 24 | if eq op 8 |
| 25 | ret 1 |
| 26 | end |
| 27 | ret 0 |
| 28 | end |
| 29 | fn crow to bool |
| 30 | if ne ckcnt 22 |
| 31 | ckbad |
| 32 | end |
| 33 | o = new ulong 16 0 |
| 34 | for j ulong 7 |
| 35 | put o j cknum add 4 j |
| 36 | end |
| 37 | op = cknum 0 |
| 38 | r = gdn_admit op cknum 1 cknum 2 cknum 3 o |
| 39 | if ne r cknum 11 |
| 40 | ret false |
| 41 | end |
| 42 | if ne r 0 |
| 43 | ret true |
| 44 | end |
| 45 | for j ulong gouts op bound 10 |
| 46 | if ne get o j cknum add 12 j |
| 47 | ret false |
| 48 | end |
| 49 | end |
| 50 | ret true |
| 51 | end |