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 / apish.om

742 lines · 16585 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0
2note gpu/nvidia/checks/apish.om: the Omega port of CUDApp tests/api_shells_diff.c for the units apishp
3note (gpu/nvidia/om/api/apish_shp.om), apishk (apish_pack.om), apishl (apish_slot.om), apishr (apish_trit.om) and,
4note where the test reaches them through the C shells, arnan, arscale and arslot. The test compared each Omega
5note answer with the pending C under a label; this part runs the test's loops, value tables and xorshift stream and
6note gives every answer to its label (as3, asi, as6 of apish-lib.om, which is composed after it), and the table
7note holds, per label, the count and the digest of the pending C's answers. xp and xk are the C header's apish_p and
8note apish_k: the op numbers and argument orders below are those of src/omega_api_shells.h, and as3, asi and as6
9note are its casts (uint32_t, int, none). A pair result is its low and high halves.
10note Not here, because their units have their own head: block and block0 (apish-blk.om), xf32 (apish-fp8x.om),
11note xbf16 (apish-fp8xb.om).
12text t_name "APISH"
13text l_nkbad "nkbad"
14text l_qset "qset"
15text l_pfargs "pfargs"
16text l_layok "layok"
17text l_tritok "tritok"
18text l_nk_r "nk-r"
19text l_lay_r "lay-r"
20text l_trit_r "trit-r"
21text l_qset_r "qset-r"
22text l_pf_r "pf-r"
23text l_trit "trit"
24text l_refb "refb"
25text l_kbits "kbits"
26text l_isnan "isnan"
27text l_e4ref "e4ref"
28text l_e4nan "e4nan"
29text l_scan "scan"
30text l_scalef "scalef"
31text l_scalebits "scalebits"
32text l_scalefm "scalefm"
33text l_scalebitsm "scalebitsm"
34text l_x16 "x16"
35text l_packscale_refuse "packscale-refuse"
36text l_packscale "packscale"
37text l_packscale_byte "packscale-byte"
38text l_xfold_e "xfold-e"
39text l_lane "lane"
40text l_pad8 "pad8"
41text l_perm4 "perm4"
42text l_pfbm "pfbm"
43text l_finite "finite"
44text l_tile8 "tile8"
45text l_dreg "dreg"
46text l_rrows "rrows"
47text l_vy2 "vy2"
48text l_tcw "tcw"
49text l_qrt "qrt"
50text l_le128 "le128"
51text l_qgrp "qgrp"
52text l_fp8m "fp8m"
53text l_fp8w "fp8w"
54text l_fp8mt "fp8mt"
55text l_ctabud "ctabud"
56text l_regfit "regfit"
57text l_align "align"
58text l_pk "pk"
59text l_swsrc "swsrc"
60text l_thok "thok"
61text l_rup "rup"
62text l_woff "woff"
63text l_qwait "qwait"
64text l_ternw "ternw"
65text l_ternc "ternc"
66text l_lane_x "lane-x"
67text l_perm_x "perm-x"
68text l_pad_x "pad-x"
69text l_qgrp_x "qgrp-x"
70text l_qgrp0 "qgrp0"
71text l_qgrp1 "qgrp1"
72text l_qgrp32 "qgrp32"
73text l_gxatt "gxatt"
74text l_kvsb "kvsb"
75text l_vy16 "vy16"
76text l_splt "splt"
77text l_persok "persok"
78text l_p2bad "p2bad"
79text l_qydiv "qydiv"
80text l_qfbyt "qfbyt"
81text l_hostb "hostb"
82text l_plane "plane"
83text l_smaxp "smaxp"
84text l_mtps "mtps"
85text l_roomok "roomok"
86text l_pa256b "pa256b"
87text l_stride "stride"
88text l_mtbig "mtbig"
89text l_mtgrp "mtgrp"
90text l_qydivq "qydivq"
91text l_room_r "room-r"
92text l_pa_r "pa-r"
93text l_qy_r "qy-r"
94text l_qyq_r "qyq-r"
95text l_qf_r "qf-r"
96text l_gx_r "gx-r"
97text l_host_r "host-r"
98text l_vy_r "vy-r"
99text l_plane_r "plane-r"
100text l_p2_r "p2-r"
101text l_st_r "st-r"
102text l_grp_r "grp-r"
103text l_big_r "big-r"
104text l_tgbm "tgbm"
105text l_tgspecr "tgspecr"
106text l_tgspecw "tgspecw"
107text l_tgsz "tgsz"
108text l_terndr "terndr"
109text l_terndd "terndd"
110text l_segb "segb"
111text l_segend "segend"
112text l_maxmnk "maxmnk"
113text l_dcache "dcache"
114text l_tpack "tpack"
115text l_rtdst "rtdst"
116text l_rtsrc "rtsrc"
117text l_dsplitc "dsplitc"
118text l_dsplits "dsplits"
119text l_tcspr "tcspr"
120text l_tcspc "tcspc"
121text l_wok "wok"
122text l_r_lane "r-lane"
123text l_r_tgbm "r-tgbm"
124text l_r_segb "r-segb"
125text l_r_segend "r-segend"
126text l_r_align "r-align"
127text l_r_pk "r-pk"
128text l_r_max "r-max"
129text l_r_tpack "r-tpack"
130text l_r_rtdst "r-rtdst"
131text l_r_rtsrc "r-rtsrc"
132text l_r_dsc "r-dsc"
133text l_r_dss "r-dss"
134text l_r_woff "r-woff"
135text l_r_wok "r-wok"
136text l_r_rup "r-rup"
137text l_r_finite "r-finite"
138text l_r_xfold "r-xfold"
139text l_r_sc "r-sc"
140text l_r_scb "r-scb"
141text l_slot_rc "slot-rc"
142text l_slot_rec "slot-rec"
143text l_slot_badop "slot-badop"
144text l_slot_stale_gate "slot-stale-gate"
145text l_tbl_begin "tbl-begin"
146text l_tbl_busy "tbl-busy"
147text l_tbl_fin "tbl-fin"
148text l_tbl_ver "tbl-ver"
149text l_tbl_pin "tbl-pin"
150text l_tbl_pin_stale "tbl-pin-stale"
151text l_tbl_evict_busy "tbl-evict-busy"
152text l_tbl_unpin "tbl-unpin"
153text l_tbl_unpin_bad "tbl-unpin-bad"
154text l_tbl_evict "tbl-evict"
155text l_tbl_evict_stale "tbl-evict-stale"
156text l_tbl_idle "tbl-idle"
157text l_tbl_mbegin "tbl-mbegin"
158text l_tbl_mpin "tbl-mpin"
159text l_neg_control "neg-control"
160text l_neg_slot "neg-slot"
161text l_neg_flip "neg-flip"
162note the test's B, its attention bounds, its upload n and k values, its fold edges; the xorshift state; the slot
163note table of the test's last block: two records of three words, seven statistics, next_version and mutant
164global ap_b ulong 38
165global ap_bn ulong 19
166global ap_ns ulong 11
167global ap_ks ulong 11
168global ap_e ulong 14
169global ap_x ulong 1
170global ap_tr ulong 6
171global ap_ts ulong 7
172global ap_tc ulong 2
173fn xp op ulong a ulong b ulong c ulong d ulong e ulong to ulong
174ret apishp uint op uint a uint b uint c uint d uint e
175end
176fn xk op ulong a ulong b ulong to ulong
177ret apishk uint op uint a uint b 0 0 0
178end
179fn ap_i1 to void
180put ap_b 0 0
181put ap_b 1 1
182put ap_b 2 2
183put ap_b 3 3
184put ap_b 4 4
185put ap_b 5 7
186put ap_b 6 8
187put ap_b 7 15
188put ap_b 8 16
189put ap_b 9 31
190put ap_b 10 32
191put ap_b 11 45
192put ap_b 12 63
193put ap_b 13 64
194put ap_b 14 127
195put ap_b 15 128
196put ap_b 16 129
197put ap_b 17 255
198put ap_b 18 256
199put ap_b 19 511
200put ap_b 20 512
201put ap_b 21 1023
202put ap_b 22 1024
203put ap_b 23 2048
204put ap_b 24 4095
205put ap_b 25 4096
206put ap_b 26 8191
207put ap_b 27 8192
208put ap_b 28 16384
209put ap_b 29 32768
210put ap_b 30 65535
211put ap_b 31 65536
212put ap_b 32 131072
213put ap_b 33 262144
214put ap_b 34 1048576
215put ap_b 35 16777215
216put ap_b 36 0x7fffffff
217put ap_b 37 0xffffffff
218put ap_x 0 0xa11e5001
219end
220fn ap_i2 to void
221put ap_bn 0 0
222put ap_bn 1 1
223put ap_bn 2 2
224put ap_bn 3 7
225put ap_bn 4 8
226put ap_bn 5 15
227put ap_bn 6 16
228put ap_bn 7 17
229put ap_bn 8 127
230put ap_bn 9 128
231put ap_bn 10 255
232put ap_bn 11 256
233put ap_bn 12 257
234put ap_bn 13 32767
235put ap_bn 14 32768
236put ap_bn 15 32769
237put ap_bn 16 65535
238put ap_bn 17 65536
239put ap_bn 18 131072
240put ap_ns 0 0
241put ap_ns 1 1
242put ap_ns 2 255
243put ap_ns 3 256
244put ap_ns 4 512
245put ap_ns 5 8192
246put ap_ns 6 8193
247put ap_ns 7 16384
248put ap_ns 8 16385
249put ap_ns 9 1073741824
250put ap_ns 10 1073741825
251put ap_ks 0 0
252put ap_ks 1 1
253put ap_ks 2 255
254put ap_ks 3 256
255put ap_ks 4 512
256put ap_ks 5 768
257put ap_ks 6 8192
258put ap_ks 7 8448
259put ap_ks 8 8704
260put ap_ks 9 16384
261put ap_ks 10 16640
262end
263fn ap_i3 to void
264put ap_e 0 0
265put ap_e 1 1
266put ap_e 2 0x7f
267put ap_e 3 0x80
268put ap_e 4 0xff
269put ap_e 5 0x100
270put ap_e 6 0x7fffff
271put ap_e 7 0x800000
272put ap_e 8 0xffffff
273put ap_e 9 0x7f7fffff
274put ap_e 10 0x7f800000
275put ap_e 11 0x80000000
276put ap_e 12 0xff800000
277put ap_e 13 0xffffffff
278end
279note the test's rnd() and pick()
280fn ap_rnd to ulong
281x = get ap_x 0
282x = and xor x shl x 13 0xffffffff
283x = xor x shr x 17
284x = and xor x shl x 5 0xffffffff
285put ap_x 0 x
286ret x
287end
288fn ap_pick to ulong
289r = ap_rnd
290if eq and r 7 0
291ret get ap_b rem r 38
292end
293ret r
294end
295note ---- check_upload
296fn ap_up1 a ulong b ulong to void
297as3 l_nkbad xp 57 a b 0 0 0
298as3 l_qset xp 60 b 0 0 0 0
299for q ulong 4
300asi l_pfargs xp 61 a b q 0 0
301end
302end
303fn ap_upr to void
304a = ap_pick
305b = ap_pick
306c = and ap_pick 3
307d = and ap_pick 7
308as3 l_nk_r xp 57 a b 0 0 0
309asi l_lay_r xp 58 c d 0 0 0
310asi l_trit_r xp 59 and a 255 0 0 0 0
311as3 l_qset_r xp 60 a 0 0 0 0
312asi l_pf_r xp 61 a b c 0 0
313end
314fn ap_upload to void
315for i ulong 11
316for j ulong 11
317ap_up1 get ap_ns i get ap_ks j
318end
319end
320for q ulong 4
321for r ulong 6
322asi l_layok xp 58 q r 0 0 0
323end
324end
325for v ulong 256
326asi l_tritok xp 59 v 0 0 0 0
327end
328for n ulong 10000
329ap_upr
330end
331end
332note ---- check_pack_bytes
333fn ap_pb1 to void
334v = new uchar 16 0
335for i ulong 16
336put v i uchar add mul i 3 1
337end
338as6 l_trit apishr v
339for b ulong 256
340as3 l_refb xk 1 b 0
341as3 l_kbits xk 2 b 0
342asi l_isnan xk 3 b 0
343as3 l_e4ref xk 2 b 0
344asi l_e4nan xk 3 b 0
345end
346w = new uchar 256 0
347for i ulong 256
348put w i uchar i
349end
350y = new ulong 2 0
351r = arnan part w 0 256 y
352if ne r 0
353ckbad
354end
355as6 l_scan get y 1
356as6 l_scan get y 0
357end
358note omega_api_scalef: bit 32 of the op 4 answer is the refusal (-1), else the low half is the scale's bits
359fn ap_sf t view uchar * tb view uchar * bf ulong m ulong to void
360r = xk 4 bf m
361if ne and r 0x100000000 0
362as6 t 0xffffffffffffffff
363else
364as6 t 0
365as3 tb r
366end
367end
368fn ap_pb2 to void
369for bf ulong 65536
370ap_sf l_scalef l_scalebits bf 0
371ap_sf l_scalefm l_scalebitsm bf 1
372as3 l_x16 xk 6 bf 0
373end
374end
375note omega_fp8_pack_scales is arscale: a refusal is -1
376fn ap_ps t view uchar * sc view ushort 4 o edit f32 4 to void
377r = arscale 0 part sc 0 4 part o 0 4
378if ne r 0
379as6 t 0xffffffffffffffff
380else
381as6 t 0
382end
383end
384fn ap_pb3 to void
385sc = new ushort 4 0
386put sc 0 0x3f80
387put sc 1 0x4000
388put sc 2 0x7f80
389o = new f32 4 0.0f32
390ap_ps l_packscale_refuse sc o
391put sc 2 0x3f00
392ap_ps l_packscale sc o
393for i ulong 4
394as3 l_packscale_byte ulong bitcast uint get o i
395end
396for i ulong 14
397as3 l_xfold_e xk 5 get ap_e i 0
398end
399end
400note ---- check_shapes
401fn ap_sh1 a ulong to void
402as3 l_lane xp 1 a 0 0 0 0
403as3 l_pad8 xp 9 a 0 0 0 0
404as3 l_perm4 xp 17 a 0 0 0 0
405as3 l_pfbm xp 18 a 0 0 0 0
406asi l_finite xp 12 a 0 0 0 0
407asi l_tile8 xp 15 a 0 0 0 0
408asi l_dreg xp 22 a 0 0 0 0
409as3 l_rrows xp 24 a 0 0 0 0
410asi l_vy2 xp 28 a 0 0 0 0
411as3 l_tcw xp 32 a 0 0 0 0
412as3 l_qrt xp 37 a 0 0 0 0
413if ne xp 39 a 0 0 0 0 0
414as6 l_le128 1
415else
416as6 l_le128 0
417end
418as3 l_qgrp xp 36 a 0 0 0 0
419end
420fn ap_sh2 a ulong b ulong to void
421v = xp 2 a b 0 0 0
422as3 l_fp8m v
423as3 l_fp8w shr v 32
424as3 l_fp8mt xp 30 a b 0 0 0
425as3 l_ctabud xp 16 a b 0 0 0
426asi l_regfit xp 3 a b 0 0 0
427asi l_align xp 14 a b 0 0 0
428as6 l_pk xp 13 a b 0 0 0
429as3 l_swsrc xp 19 a b 0 0 0
430asi l_thok xp 29 a b 0 0 0
431as3 l_rup xp 33 a b 0 0 0
432as6 l_woff xp 34 a b 0 0 0
433as3 l_qwait xp 38 a b 0 0 0
434v = xp 8 a b 0 0 0
435as3 l_ternw v
436as3 l_ternc shr v 32
437end
438fn ap_shapes to void
439for i ulong 38
440ap_sh1 get ap_b i
441for j ulong 38
442ap_sh2 get ap_b i get ap_b j
443end
444end
445for k ulong 257
446as3 l_lane_x xp 1 k 0 0 0 0
447end
448for q ulong 16
449as3 l_perm_x xp 17 q 0 0 0 0
450end
451for n ulong 65
452as3 l_pad_x xp 9 n 0 0 0 0
453end
454for g ulong 32
455as3 l_qgrp_x xp 36 mul add g 1 3 0 0 0 0
456end
457as3 l_qgrp0 xp 36 0 0 0 0 0
458as3 l_qgrp1 xp 36 1 0 0 0 0
459as3 l_qgrp32 xp 36 32 0 0 0 0
460end
461note ---- check_attn
462note omega_api_qydiv: a high half is the refusal (1); the quotient is compared only when pc is not 0
463fn ap_qy t view uchar * tq view uchar * a ulong b ulong to void
464r = xp 41 a b 0 0 0
465if ne shr r 32 0
466as6 t 1
467else
468as6 t 0
469end
470if ne b 0
471as3 tq r
472end
473end
474fn ap_at1 a ulong to void
475as3 l_gxatt xp 43 a 0 0 0 0
476as3 l_kvsb xp 44 a 0 0 0 0
477asi l_vy16 xp 47 a 0 0 0 0
478as3 l_splt xp 48 a 0 0 0 0
479asi l_persok xp 50 a 0 0 0 0
480asi l_p2bad xp 56 a 0 0 0 0
481end
482fn ap_at2 a ulong b ulong to void
483ap_qy l_qydiv l_qydivq a b
484as6 l_qfbyt xp 42 a b 0 0 0
485as6 l_hostb xp 45 a b 0 0 0
486as6 l_plane xp 49 a b 0 0 0
487as3 l_smaxp xp 54 a b 0 0 0
488as6 l_mtps xp 55 a b 0 0 0
489end
490fn ap_at3 a ulong b ulong c ulong k ulong to void
491asi l_roomok xp 40 a b c 0 0
492asi l_pa256b xp 46 a b c 0 0
493asi l_stride xp 51 a b c 0 0
494asi l_mtbig xp 53 a b c 0 0
495as6 l_mtgrp xp 52 a b c get ap_bn rem k 8 0
496end
497fn ap_atr to void
498a = ap_pick
499b = ap_pick
500c = ap_pick
501d = and ap_pick 31
502asi l_room_r xp 40 a b c 0 0
503asi l_pa_r xp 46 and a 65535 b c 0 0
504ap_qy l_qy_r l_qyq_r a b
505as6 l_qf_r xp 42 a b 0 0 0
506as3 l_gx_r xp 43 a 0 0 0 0
507as6 l_host_r xp 45 a b 0 0 0
508asi l_vy_r xp 47 a 0 0 0 0
509as6 l_plane_r xp 49 and a 63 b 0 0 0
510asi l_p2_r xp 56 a 0 0 0 0
511asi l_st_r xp 51 a b c 0 0
512as6 l_grp_r xp 52 and a 255 b c d 0
513asi l_big_r xp 53 and a 255 d b 0 0
514end
515fn ap_at4 a ulong b ulong to void
516ap_at2 a b
517for k ulong 19
518ap_at3 a b get ap_bn k k
519end
520end
521fn ap_attn to void
522for i ulong 19
523ap_at1 get ap_bn i
524for j ulong 19
525ap_at4 get ap_bn i get ap_bn j
526end
527end
528for n ulong 10000
529ap_atr
530end
531end
532note ---- check_multi
533note omega_api_dsplit: the low half is the code; the splits (high half) are written only when the code is 0,
534note else the caller's value f stays
535fn ap_ds t view uchar * ts view uchar * v ulong f ulong to void
536as3 t v
537if eq and v 0xffffffff 0
538as3 ts shr v 32
539else
540as6 ts f
541end
542end
543fn ap_mu1 a ulong b ulong c ulong to void
544as3 l_tgbm xp 4 a b c 0 0
545v = xp 5 a b c 0 0
546as3 l_tgspecr v
547as3 l_tgspecw shr v 32
548as3 l_tgsz xp 6 a b c 0 0
549asi l_maxmnk xp 20 a b c 0 0
550asi l_dcache xp 21 a b c 0 0
551ap_ds l_dsplitc l_dsplits xp 27 a b c 0 0 9
552v = xp 31 a b c 0 0
553as3 l_tcspr v
554as3 l_tcspc shr v 32
555asi l_wok xp 35 a b c 0 0
556end
557fn ap_mu2 a ulong b ulong c ulong d ulong e ulong to void
558v = xp 7 a and b 1 and c 7 and d 15 and e 31
559as3 l_terndr v
560as3 l_terndd shr v 32
561as3 l_segb xp 10 a b c d e
562asi l_segend xp 11 a b c d e
563asi l_tpack xp 23 a b and c 1 d e
564as3 l_rtdst xp 25 a b c d 0
565as3 l_rtsrc xp 26 a b c d 0
566end
567fn ap_mu3 i ulong j ulong to void
568a = get ap_b i
569b = get ap_b j
570c = get ap_b rem add i j 38
571d = get ap_b rem add mul i 3 j 38
572e = get ap_b rem mul j 5 38
573ap_mu1 a b c
574ap_mu2 a b c d e
575end
576fn ap_multi to void
577for i ulong 38
578for j ulong 16
579ap_mu3 i j
580end
581end
582end
583note ---- check_random
584fn ap_rn1 a ulong b ulong c ulong d ulong e ulong to void
585as3 l_r_lane xp 1 a 0 0 0 0
586as3 l_r_tgbm xp 4 a b c 0 0
587c1 = c
588if eq c 0
589c1 = 1
590end
591b5 = add rem b 5 1
592as3 l_r_segb xp 10 rem a 8 b5 c1 d e
593asi l_r_segend xp 11 rem a 8 b5 c1 d and e 1
594asi l_r_wok xp 35 a b c1 0 0
595end
596fn ap_rn2 a ulong b ulong c ulong d ulong e ulong to void
597asi l_r_align xp 14 a or b 1 0 0 0
598as6 l_r_pk xp 13 rem a 64 b 0 0 0
599asi l_r_max xp 20 a b c 0 0
600asi l_r_tpack xp 23 a b and c 1 rem d 8 e
601as3 l_r_rtdst xp 25 rem a 16 b rem c 8 rem d 8 0
602as3 l_r_rtsrc xp 26 a b rem c 16 rem d 8 0
603end
604fn ap_rn3 a ulong b ulong c ulong to void
605ap_ds l_r_dsc l_r_dss xp 27 a rem b 64 rem c 128 0 0 1
606as6 l_r_woff xp 34 rem a 4096 b 0 0 0
607as3 l_r_rup xp 33 a rem b 64 0 0 0
608asi l_r_finite xp 12 a 0 0 0 0
609as3 l_r_xfold xk 5 a 0
610ap_sf l_r_sc l_r_scb and a 65535 and b 1
611end
612fn ap_rn to void
613a = ap_pick
614b = ap_pick
615c = ap_pick
616d = ap_pick
617e = ap_pick
618ap_rn1 a b c d e
619ap_rn2 a b c d e
620ap_rn3 a b c
621end
622fn ap_random to void
623for n ulong 10000
624ap_rn
625end
626end
627note ---- check_slots
628fn ap_sl1 rec edit ulong 16 op ulong aux ulong to void
629r = apishl op aux rec
630asi l_slot_rc bitcast ulong r
631for k ulong 16
632as6 l_slot_rec get rec k
633end
634end
635fn ap_slots to void
636rec = new ulong 16 0
637ap_sl1 rec 1 0
638ap_sl1 rec 1 0
639ap_sl1 rec 2 0
640ap_sl1 rec 1 0
641ap_sl1 rec 3 17
642ap_sl1 rec 4 0
643ap_sl1 rec 4 0
644ap_sl1 rec 5 0
645ap_sl1 rec 5 0
646ap_sl1 rec 7 0
647ap_sl1 rec 6 0
648ap_sl1 rec 3 1
649ap_sl1 rec 8 0
650junk = new ulong 16 0
651asi l_slot_badop bitcast ulong apishl 9 0 junk
652asi l_slot_stale_gate bitcast ulong apishl 7 0 junk
653end
654note the C slot table's step_slot (src/omega_fp8_slot_table.c): one arslot call on the slot's record and the
655note table's statistics; next_version comes back in cfg word 0
656fn ap_step slot ulong op ulong aux ulong ok ulong to ulong
657cfg = new ulong 8 0
658put cfg 0 get ap_tc 0
659put cfg 1 get ap_tc 1
660put cfg 2 ok
661put cfg 3 op
662put cfg 4 aux
663r = new ulong 3 0
664for i ulong 3
665put r i get ap_tr add mul slot 3 i
666end
667st = new ulong 7 0
668for i ulong 7
669put st i get ap_ts i
670end
671rc = arslot cfg r st
672for i ulong 3
673put ap_tr add mul slot 3 i get r i
674end
675for i ulong 7
676put ap_ts i get st i
677end
678put ap_tc 0 get cfg 0
679ret bitcast ulong rc
680end
681note the test's table calls: begin_load is op 1, finish_load op 2 (aux the key, ok set), pin op 3 and unpin op 4
682note (aux the version), evict op 5; the table is idle when op 6 answers non-zero for every slot (the form of the
683note C file's pending branch; aridle, which the default build calls, is checked by arestdata)
684fn ap_tbl to void
685put ap_tc 0 1
686asi l_tbl_begin ap_step 0 1 0 0
687asi l_tbl_busy ap_step 0 1 0 0
688r = ap_step 0 2 42 1
689asi l_tbl_fin r
690vv = ulong 0
691if eq r 0
692vv = get ap_tr 2
693end
694as6 l_tbl_ver vv
695asi l_tbl_pin ap_step 0 3 vv 0
696asi l_tbl_pin_stale ap_step 0 3 add vv 1 0
697asi l_tbl_evict_busy ap_step 0 5 0 0
698asi l_tbl_unpin ap_step 0 4 vv 0
699asi l_tbl_unpin_bad ap_step 0 4 vv 0
700asi l_tbl_evict ap_step 0 5 0 0
701asi l_tbl_evict_stale ap_step 0 5 0 0
702il = ulong 1
703for i ulong 2
704if eq il 1
705if eq and ap_step i 6 0 0 0xffffffff 0
706il = 0
707end
708end
709end
710as6 l_tbl_idle il
711put ap_tc 1 1
712asi l_tbl_mbegin ap_step 1 1 0 0
713asi l_tbl_mpin ap_step 1 3 0 0
714end
715note ---- check_negative: the test's red controls
716fn ap_neg to void
717as3 l_neg_control xor xp 1 256 0 0 0 0 8
718rec = new ulong 16 0
719put rec 0 2
720put rec 1 1
721put rec 3 1
722asi l_neg_slot bitcast ulong apishl 7 0 rec
723put rec 1 xor get rec 1 1
724asi l_neg_flip bitcast ulong apishl 7 0 rec
725as6 l_neg_flip get rec 1
726end
727fn aprun to void
728ap_i1
729ap_i2
730ap_i3
731ap_upload
732ap_pb1
733ap_pb2
734ap_pb3
735ap_shapes
736ap_attn
737ap_multi
738ap_random
739ap_slots
740ap_tbl
741ap_neg
742end