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