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 / attnhost.om
| 1 | note SPDX-License-Identifier: Apache-2.0 |
| 2 | note gpu/nvidia/checks/attnhost.om: the Omega port of the policy and clock blocks of CUDApp |
| 3 | note tests/attn_host_diff.c (its scan block is gpu/nvidia/checks/attnscan.om). Composed after |
| 4 | note gpu/nvidia/om/api/attn_host.om (ah_plan), gpu/nvidia/om/api/clock_ns.om (clock_ns) and |
| 5 | note gpu/nvidia/checks/lib.om; run with gpu/nvidia/checks/attnhost.tsv. Rows, lowercase hex: |
| 6 | note p OP IN0..IN22 R OUT0..OUT22: ah_plan on q = IN (q 23..31 zero) answers R and leaves q = OUT, with |
| 7 | note q 23..31 still zero. |
| 8 | note c S NS R: clock_ns S NS answers R. |
| 9 | text t_name "ATTNHOST" |
| 10 | fn cname to void |
| 11 | for i ulong len t_name bound 64 |
| 12 | ckoc ulong get t_name i |
| 13 | end |
| 14 | end |
| 15 | fn ahx i ulong to ulong |
| 16 | n = cklen i |
| 17 | if or eq n 0 gt n 16 |
| 18 | ckbad |
| 19 | end |
| 20 | v = ulong 0 |
| 21 | for j ulong n bound 16 |
| 22 | v = or shl v 4 cknib ckch i j |
| 23 | end |
| 24 | ret v |
| 25 | end |
| 26 | fn prow to bool |
| 27 | if ne ckcnt 49 |
| 28 | ckbad |
| 29 | end |
| 30 | q = new ulong 32 0 |
| 31 | for k ulong 23 |
| 32 | put q k ahx add k 2 |
| 33 | end |
| 34 | r = ah_plan q uint ahx 1 |
| 35 | ok = eq r ahx 25 |
| 36 | for k ulong 23 |
| 37 | if ne get q k ahx add k 26 |
| 38 | ok = false |
| 39 | end |
| 40 | end |
| 41 | for k ulong 9 |
| 42 | if ne get q add k 23 0 |
| 43 | ok = false |
| 44 | end |
| 45 | end |
| 46 | ret ok |
| 47 | end |
| 48 | fn crow to bool |
| 49 | if ne cklen 0 1 |
| 50 | ckbad |
| 51 | end |
| 52 | k = ckch 0 0 |
| 53 | if eq k 112 |
| 54 | ret prow |
| 55 | end |
| 56 | if eq k 99 |
| 57 | if ne ckcnt 4 |
| 58 | ckbad |
| 59 | end |
| 60 | ret eq clock_ns ahx 1 ahx 2 ahx 3 |
| 61 | end |
| 62 | ckbad |
| 63 | ret false |
| 64 | end |