interplane.Get Omega
Read in your language

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

branch main Branches Tags History

omega-mv / gpu / nvidia / checks / bwhz.om

101 lines · 2472 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0
2note gpu/nvidia/checks/bwhz.om: the scoreboard hazard checker of gpu/nvidia/om/codegen/bw_hazard.om and
3note bw_hazard_dec.om against the C it succeeds, src/omega_bw_hazard.c at 60b5d81e (DRA-606: a scoreboard barrier
4note field holding 6 is refused, either field; src_pc is the smallest producer pc, whatever the visit order).
5note Composed after bw_hazard.om, bw_hazard_dec.om and gpu/nvidia/checks/lib.om; run with gpu/nvidia/checks/bwhz.tsv.
6note Rows, lowercase hex:
7note d WORDS RC WBAR RBAR WAIT: hz_dec of the 16 bytes WORDS refuses (-1) exactly when RC is 1, and otherwise
8note gives the write barrier, read barrier and wait mask of the C decode (record words 4, 5, 6). The oracle writes
9note 0 0 0 for a refused row, and a refused row passes only with those zeros, so every byte of every row is read
10note (the gate's table control changes the last byte of the first row, a refused one).
11note j DT SV ST TAG: hz_jtag, the join's pc tag. l R RT PC TAG: hz_ltag, a late reader's. w V T TAG: hz_wtag, the
12note tag of an entry after a wait. TAG is the C's expression on its own pmin (bwhz_oracle.c, README.md Oracles).
13note The whole check, hz_chk, takes a 3203584-word wire: more than a program may hold in local arrays, and a global
14note is never an argument, so it is not run here; README.md (bwhz) says how it was compared with the C.
15text t_name "BWHZ"
16fn cname to void
17for i ulong len t_name bound 64
18ckoc ulong get t_name i
19end
20end
21fn bzx i ulong to ulong
22n = cklen i
23if or eq n 0 gt n 16
24ckbad
25end
26v = ulong 0
27for j ulong n bound 16
28v = or shl v 4 cknib ckch i j
29end
30ret v
31end
32fn crow to bool
33if ne cklen 0 1
34ckbad
35end
36k = ckch 0 0
37if eq k 106
38ret crowj
39end
40if eq k 108
41ret crowl
42end
43if eq k 119
44ret crowt
45end
46if ne k 100
47ckbad
48end
49ret crowd
50end
51fn crowd to bool
52if ne ckcnt 6
53ckbad
54end
55if ne ckhexn 1 16
56ckbad
57end
58b = new uchar 16 0
59d = new ulong 24 0
60for j ulong 16
61put b j uchar ckhex 1 j
62end
63rc = hz_dec b d
64rr = bzx 2
65if gt rr 1
66ckbad
67end
68if eq rr 1
69ok = eq rc long -1
70ok = and ok eq bzx 3 0
71ok = and ok eq bzx 4 0
72ret and ok eq bzx 5 0
73end
74if ne rc 0
75ret false
76end
77ok = eq get d 4 bzx 3
78ok = and ok eq get d 5 bzx 4
79ret and ok eq get d 6 bzx 5
80end
81fn crowj to bool
82if ne ckcnt 5
83ckbad
84end
85t = hz_jtag bzx 1 bzx 2 bzx 3
86ret eq t bzx 4
87end
88fn crowl to bool
89if ne ckcnt 5
90ckbad
91end
92t = hz_ltag bzx 1 bzx 2 bzx 3
93ret eq t bzx 4
94end
95fn crowt to bool
96if ne ckcnt 4
97ckbad
98end
99t = hz_wtag bzx 1 bzx 2
100ret eq t bzx 3
101end