Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/CUDApp/blob/main/om/tools/dag_eval.om # CUDApp CUDA++: AIEN’s GPU machine-code toolchain, runtime and driver client for NVIDIA GPUs without the CUDA toolkit. Hardware coverage and driver replacement limits are explicit. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `CUDApp / om / tools / dag_eval.om` 1286 lines · 20999 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 2 note dag_eval: post-resolve resource-DAG schedule. C packs numbers and formats reasons. 3 note Model ulong 8192, scratch ulong 8192. Caller zeros scratch. Negative index is NONE. 4 note Header: n_ops n_res n_deps n_buf has_energy joules power energy_prov instr_none phase. 5 note Ops 32/10: t bytes launch cap engine bw launcher kind prov. 6 note Res 2592/4: kind slots cap prov. Deps 2720/2: from to. Buf 4768/4: bytes cap first last. 7 note Scratch: 0 t 1 remaining 3 makespan 4 status 5 reason 6 a 7 b 8 fa 9 fb 8 note 11 prov 12 accounted 13 dt 15 bytes 16 busy 17 launch 19 bound 20 cp 21 ncrit 9 note 22 measured 23 synthetic_e 24 energy 26 synthetic. 10 note state 64 blocked 320 npred 576 done 832 rem_t 1088 rem_b 1344 rem_l 1600 11 note run_start 1856 bytes_end 2112 free 2368 lbusy 2400 order 2432 indeg 2688 active 2944 12 note cp 2976 chain 3232 et 3488 ev 4000 start 4512 end 4768 ready 5024 floor 5280 13 note cont 5536 bound_res 5792 attr 5824 crit 6080 names 6336 peak 6344 peak_at 6376. 14 note FEPS is 1e-9, FLIVE is 1e-6, FNEG1 is -1.0, as IEEE-754 binary64 bits. 15 const NONE ulong `18446744073709551615` 16 const FNEG1 ulong `13830554455654793216` 17 const FEPS ulong `4472406533629990549` 18 const FLIVE ulong `4517329193108106637` 19 const SOK ulong 0 20 const SCAP ulong 4 21 const SCYC ulong 5 22 const SUNS ulong 6 23 const SLIFE ulong 8 24 const REMP ulong 1 25 const RCYC ulong 2 26 const RALN ulong 3 27 const RPROG ulong 4 28 const RGRD ulong 5 29 const RINV ulong 6 30 const RLIVE ulong 7 31 const RPEAK ulong 8 32 fn dep_fr m view ulong 8192 d ulong to ulong 33 p = mul d 2 34 p = add p 2720 35 ret get m p 36 end 37 fn dep_to m view ulong 8192 d ulong to ulong 38 p = mul d 2 39 p = add p 2720 40 ret get m add p 1 41 end 42 fn opu m view ulong 8192 i ulong f ulong to ulong 43 p = mul i 10 44 p = add p 32 45 ret get m add p f 46 end 47 fn opf m view ulong 8192 i ulong f ulong to f64 48 u = opu m i f 49 ret bitcast f64 u 50 end 51 fn resu m view ulong 8192 i ulong f ulong to ulong 52 p = mul i 4 53 p = add p 2592 54 ret get m add p f 55 end 56 fn resf m view ulong 8192 i ulong f ulong to f64 57 u = resu m i f 58 ret bitcast f64 u 59 end 60 fn bufu m view ulong 8192 i ulong f ulong to ulong 61 p = mul i 4 62 p = add p 4768 63 ret get m add p f 64 end 65 fn buff m view ulong 8192 i ulong f ulong to f64 66 u = bufu m i f 67 ret bitcast f64 u 68 end 69 fn scf s edit ulong 8192 i ulong to f64 70 u = get s i 71 ret bitcast f64 u 72 end 73 fn scinc s edit ulong 8192 i ulong to void 74 v = get s i 75 put s i add v 1 76 end 77 fn scdec s edit ulong 8192 i ulong to ulong 78 v = get s i 79 v = sub v 1 80 put s i v 81 ret v 82 end 83 fn sfput s edit ulong 8192 i ulong v f64 to void 84 put s i bitcast ulong v 85 end 86 fn sfadd s edit ulong 8192 i ulong v f64 to void 87 cur = bitcast f64 get s i 88 put s i bitcast ulong add cur v 89 end 90 fn topo_in m view ulong 8192 s edit ulong 8192 to void 91 nops = get m 0 92 nd = get m 2 93 i = ulong 0 94 while lt i nops bound 256 95 ix = add 2688 i 96 put s ix ulong 0 97 i = add i 1 98 end 99 i = ulong 0 100 while lt i nd bound 1024 101 dst = dep_to m i 102 ix = add 2688 dst 103 scinc s ix 104 i = add i 1 105 end 106 end 107 fn topo_q m view ulong 8192 s edit ulong 8192 to ulong 108 nops = get m 0 109 n = ulong 0 110 i = ulong 0 111 while lt i nops bound 256 112 ix = add 2688 i 113 if eq get s ix 0 114 ox = add 2432 n 115 put s ox i 116 n = add n 1 117 end 118 i = add i 1 119 end 120 ret n 121 end 122 fn topo_rel m view ulong 8192 s edit ulong 8192 u ulong n ulong to ulong 123 nd = get m 2 124 i = ulong 0 125 while lt i nd bound 1024 126 fr = dep_fr m i 127 if eq fr u 128 dst = dep_to m i 129 ix = add 2688 dst 130 deg = scdec s ix 131 if eq deg 0 132 ox = add 2432 n 133 put s ox dst 134 n = add n 1 135 end 136 end 137 i = add i 1 138 end 139 ret n 140 end 141 fn dag_topo m view ulong 8192 s edit ulong 8192 to ulong 142 nops = get m 0 143 topo_in m s 144 n = topo_q m s 145 head = ulong 0 146 while lt head n bound 256 147 ox = add 2432 head 148 u = get s ox 149 head = add head 1 150 n = topo_rel m s u n 151 end 152 if eq n nops 153 ret 1 154 end 155 ret 0 156 end 157 fn dag_cap m view ulong 8192 s edit ulong 8192 to ulong 158 nbuf = get m 3 159 b = ulong 0 160 while lt b nbuf bound 256 161 bytes = buff m b 0 162 cix = bufu m b 1 163 cap = resf m cix 2 164 if gt bytes cap 165 put s 4 SCAP 166 put s 5 RALN 167 put s 6 b 168 put s 7 cix 169 ret SCAP 170 end 171 b = add b 1 172 end 173 ret 0 174 end 175 fn prov_op m view ulong 8192 s edit ulong 8192 to void 176 nops = get m 0 177 mask = ulong 0 178 i = ulong 0 179 while lt i nops bound 256 180 pv = opu m i 8 181 bitv = shl ulong 1 pv 182 mask = or mask bitv 183 i = add i 1 184 end 185 put s 11 mask 186 end 187 fn res_used m view ulong 8192 i ulong to ulong 188 nops = get m 0 189 nbuf = get m 3 190 j = ulong 0 191 while lt j nops bound 256 192 eng = opu m j 4 193 if eq eng i 194 ret 1 195 end 196 bw = opu m j 5 197 if eq bw i 198 ret 1 199 end 200 lch = opu m j 6 201 if eq lch i 202 ret 1 203 end 204 j = add j 1 205 end 206 j = ulong 0 207 while lt j nbuf bound 256 208 cap = bufu m j 1 209 if eq cap i 210 ret 1 211 end 212 j = add j 1 213 end 214 ret 0 215 end 216 fn prov_res m view ulong 8192 s edit ulong 8192 to void 217 nres = get m 1 218 mask = get s 11 219 i = ulong 0 220 while lt i nres bound 32 221 used = res_used m i 222 if eq used 1 223 pv = resu m i 3 224 bitv = shl ulong 1 pv 225 mask = or mask bitv 226 end 227 i = add i 1 228 end 229 put s 11 mask 230 end 231 fn dag_prov m view ulong 8192 s edit ulong 8192 to void 232 put s 11 ulong 0 233 prov_op m s 234 prov_res m s 235 end 236 fn init_ops m view ulong 8192 s edit ulong 8192 to void 237 nops = get m 0 238 i = ulong 0 239 tb = 0.0f64 240 tt = 0.0f64 241 tl = 0.0f64 242 while lt i nops bound 256 243 ix = add 64 i 244 put s ix ulong 0 245 ix = add 320 i 246 put s ix ulong 0 247 ix = add 576 i 248 put s ix ulong 0 249 ix = add 832 i 250 put s ix ulong 0 251 t = opf m i 0 252 by = opf m i 1 253 ln = opf m i 2 254 ix = add 1088 i 255 sfput s ix t 256 ix = add 1344 i 257 sfput s ix by 258 ix = add 1600 i 259 sfput s ix ln 260 ix = add 1856 i 261 put s ix FNEG1 262 ix = add 2112 i 263 put s ix FNEG1 264 tb = add tb by 265 tt = add tt t 266 tl = add tl ln 267 i = add i 1 268 end 269 sfput s 15 tb 270 sfput s 16 tt 271 sfput s 17 tl 272 end 273 fn init_res m view ulong 8192 s edit ulong 8192 to void 274 nres = get m 1 275 i = ulong 0 276 while lt i nres bound 32 277 slots = resu m i 1 278 ix = add 2368 i 279 put s ix slots 280 ix = add 2400 i 281 put s ix ulong 0 282 i = add i 1 283 end 284 end 285 fn init_dep m view ulong 8192 s edit ulong 8192 to void 286 nd = get m 2 287 i = ulong 0 288 while lt i nd bound 1024 289 dst = dep_to m i 290 ix = add 576 dst 291 scinc s ix 292 i = add i 1 293 end 294 end 295 fn dag_init m view ulong 8192 s edit ulong 8192 to void 296 nops = get m 0 297 init_ops m s 298 put s 0 ulong 0 299 put s 1 nops 300 put s 3 ulong 0 301 init_res m s 302 init_dep m s 303 end 304 fn dag_rdy m view ulong 8192 s edit ulong 8192 to void 305 nops = get m 0 306 t = scf s 0 307 i = ulong 0 308 while lt i nops bound 256 309 ix = add 64 i 310 st = get s ix 311 if eq st 0 312 dx = add 832 i 313 px = add 576 i 314 if eq get s dx get s px 315 put s ix ulong 1 316 rx = add 5024 i 317 sfput s rx t 318 end 319 end 320 i = add i 1 321 end 322 end 323 fn dag_can m view ulong 8192 s edit ulong 8192 i ulong to ulong 324 eng = opu m i 4 325 if ne eng NONE 326 fx = add 2368 eng 327 if le get s fx 0 328 ret 1 329 end 330 end 331 lch = opu m i 6 332 lx = add 1600 i 333 reml = scf s lx 334 if ne lch NONE 335 if gt reml 0.0f64 336 bx = add 2400 lch 337 if ne get s bx 0 338 ret 2 339 end 340 end 341 end 342 if ne lch NONE 343 if gt reml 0.0f64 344 ret 3 345 end 346 end 347 ret 0 348 end 349 fn disp_go m view ulong 8192 s edit ulong 8192 i ulong t f64 code ulong to void 350 eng = opu m i 4 351 if ne eng NONE 352 fx = add 2368 eng 353 v = scdec s fx 354 end 355 sx = add 4512 i 356 sfput s sx t 357 if eq code 3 358 lch = opu m i 6 359 bx = add 2400 lch 360 put s bx ulong 1 361 ix = add 64 i 362 put s ix ulong 2 363 end 364 if eq code 0 365 ix = add 64 i 366 put s ix ulong 3 367 rx = add 1856 i 368 sfput s rx t 369 end 370 end 371 fn dag_disp m view ulong 8192 s edit ulong 8192 to void 372 nops = get m 0 373 t = scf s 0 374 i = ulong 0 375 while lt i nops bound 256 376 ix = add 64 i 377 st = get s ix 378 if eq st 1 379 code = dag_can m s i 380 if eq code 1 381 bx = add 320 i 382 put s bx ulong 1 383 end 384 if eq code 2 385 bx = add 320 i 386 put s bx ulong 2 387 end 388 if eq code 0 389 disp_go m s i t 0 390 end 391 if eq code 3 392 disp_go m s i t 3 393 end 394 end 395 i = add i 1 396 end 397 end 398 fn dag_db m view ulong 8192 s edit ulong 8192 i ulong remb f64 to f64 399 bw = opu m i 5 400 cap = opf m i 3 401 ix = add 2944 bw 402 act = get s ix 403 share = div cap f64 act 404 ret div remb share 405 end 406 fn dag_rd m view ulong 8192 s edit ulong 8192 i ulong to f64 407 d = neg 1.0f64 408 tx = add 1088 i 409 remt = scf s tx 410 if gt remt 0.0f64 411 d = remt 412 end 413 bx = add 1344 i 414 remb = scf s bx 415 if gt remb 0.0f64 416 db = dag_db m s i remb 417 if lt d 0.0f64 418 d = db 419 end 420 if not lt d 0.0f64 421 if lt db d 422 d = db 423 end 424 end 425 end 426 if lt d 0.0f64 427 d = 0.0f64 428 end 429 ret d 430 end 431 fn dt_take cur f64 nxt f64 to f64 432 take = ulong 0 433 if lt cur 0.0f64 434 take = ulong 1 435 end 436 if lt nxt cur 437 take = ulong 1 438 end 439 if eq take 1 440 ret nxt 441 end 442 ret cur 443 end 444 fn dt_act m view ulong 8192 s edit ulong 8192 to void 445 nops = get m 0 446 nres = get m 1 447 i = ulong 0 448 while lt i nres bound 32 449 ix = add 2944 i 450 put s ix ulong 0 451 i = add i 1 452 end 453 i = ulong 0 454 while lt i nops bound 256 455 ix = add 64 i 456 st = get s ix 457 if eq st 3 458 bx = add 1344 i 459 rb = scf s bx 460 if gt rb 0.0f64 461 bw = opu m i 5 462 ax = add 2944 bw 463 scinc s ax 464 end 465 end 466 i = add i 1 467 end 468 end 469 fn dt_scan m view ulong 8192 s edit ulong 8192 to ulong 470 nops = get m 0 471 dt = neg 1.0f64 472 any = ulong 0 473 i = ulong 0 474 while lt i nops bound 256 475 ix = add 64 i 476 st = get s ix 477 if eq st 2 478 any = ulong 1 479 lx = add 1600 i 480 reml = scf s lx 481 dt = dt_take dt reml 482 end 483 if eq st 3 484 any = ulong 1 485 d = dag_rd m s i 486 dt = dt_take dt d 487 end 488 i = add i 1 489 end 490 sfput s 13 dt 491 ret any 492 end 493 fn dag_dt m view ulong 8192 s edit ulong 8192 to ulong 494 dt_act m s 495 ret dt_scan m s 496 end 497 fn dag_cont m view ulong 8192 s edit ulong 8192 i ulong t f64 to void 498 bytes = opf m i 1 499 if le bytes 0.0f64 500 ret 501 end 502 cap = opf m i 3 503 ideal = div bytes cap 504 bx = add 2112 i 505 be = scf s bx 506 if lt be 0.0f64 507 be = t 508 end 509 rx = add 1856 i 510 rs = scf s rx 511 actual = sub be rs 512 extra = 0.0f64 513 diff = sub actual ideal 514 if gt diff 0.0f64 515 extra = diff 516 end 517 cx = add 5536 i 518 sfput s cx extra 519 end 520 fn dag_rel m view ulong 8192 s edit ulong 8192 i ulong to void 521 nd = get m 2 522 d = ulong 0 523 while lt d nd bound 1024 524 fr = dep_fr m d 525 if eq fr i 526 dst = dep_to m d 527 ix = add 832 dst 528 scinc s ix 529 end 530 d = add d 1 531 end 532 end 533 fn dag_done m view ulong 8192 s edit ulong 8192 i ulong t f64 to void 534 ix = add 64 i 535 put s ix ulong 4 536 ex = add 4768 i 537 sfput s ex t 538 v = get s 1 539 put s 1 sub v 1 540 eng = opu m i 4 541 if ne eng NONE 542 fx = add 2368 eng 543 scinc s fx 544 end 545 dag_rel m s i 546 dag_cont m s i t 547 end 548 fn dag_thr bytes f64 to f64 549 eps = bitcast f64 FEPS 550 if gt bytes 1.0f64 551 ret mul eps bytes 552 end 553 ret eps 554 end 555 fn dag_sh m view ulong 8192 s edit ulong 8192 i ulong to f64 556 bw = opu m i 5 557 cap = opf m i 3 558 ix = add 2944 bw 559 act = get s ix 560 ret div cap f64 act 561 end 562 fn dag_byte m view ulong 8192 s edit ulong 8192 i ulong dt f64 t f64 to void 563 bx = add 1344 i 564 remb = scf s bx 565 if le remb 0.0f64 566 ret 567 end 568 share = dag_sh m s i 569 step = mul share dt 570 remb = sub remb step 571 bytes = opf m i 1 572 thr = dag_thr bytes 573 if le remb thr 574 remb = 0.0f64 575 ex = add 2112 i 576 sfput s ex t 577 end 578 sfput s bx remb 579 end 580 fn dag_alch m view ulong 8192 s edit ulong 8192 i ulong dt f64 t f64 to void 581 lx = add 1600 i 582 reml = scf s lx 583 reml = sub reml dt 584 eps = bitcast f64 FEPS 585 if le reml eps 586 reml = 0.0f64 587 lch = opu m i 6 588 bx = add 2400 lch 589 put s bx ulong 0 590 ix = add 64 i 591 put s ix ulong 3 592 rx = add 1856 i 593 sfput s rx t 594 end 595 sfput s lx reml 596 end 597 fn dag_arun m view ulong 8192 s edit ulong 8192 i ulong dt f64 t f64 to void 598 eps = bitcast f64 FEPS 599 tx = add 1088 i 600 remt = scf s tx 601 if gt remt 0.0f64 602 remt = sub remt dt 603 if le remt eps 604 remt = 0.0f64 605 end 606 sfput s tx remt 607 end 608 dag_byte m s i dt t 609 remt = scf s tx 610 bx = add 1344 i 611 remb = scf s bx 612 if le remt 0.0f64 613 if le remb 0.0f64 614 dag_done m s i t 615 end 616 end 617 end 618 fn dag_adv m view ulong 8192 s edit ulong 8192 to void 619 nops = get m 0 620 dt = scf s 13 621 if lt dt 0.0f64 622 dt = 0.0f64 623 end 624 t = scf s 0 625 t = add t dt 626 sfput s 0 t 627 i = ulong 0 628 while lt i nops bound 256 629 ix = add 64 i 630 st = get s ix 631 if eq st 2 632 dag_alch m s i dt t 633 end 634 if eq st 3 635 dag_arun m s i dt t 636 end 637 i = add i 1 638 end 639 ms = scf s 3 640 if gt t ms 641 sfput s 3 t 642 end 643 end 644 fn dag_sim m view ulong 8192 s edit ulong 8192 to ulong 645 guard = ulong 0 646 nleft = get s 1 647 while gt nleft 0 bound 2065 648 guard = add guard 1 649 if gt guard 2064 650 put s 4 SUNS 651 put s 5 RGRD 652 ret SUNS 653 end 654 dag_rdy m s 655 dag_disp m s 656 any = dag_dt m s 657 if eq any 0 658 put s 4 SUNS 659 put s 5 RPROG 660 ret SUNS 661 end 662 dag_adv m s 663 nleft = get s 1 664 end 665 ret 0 666 end 667 fn dag_flr m view ulong 8192 s edit ulong 8192 i ulong to f64 668 t = opf m i 0 669 by = opf m i 1 670 ln = opf m i 2 671 floor = t 672 if gt by 0.0f64 673 cap = opf m i 3 674 tb = div by cap 675 if gt tb floor 676 floor = tb 677 end 678 end 679 floor = add floor ln 680 ix = add 5280 i 681 sfput s ix floor 682 ret floor 683 end 684 fn dag_best m view ulong 8192 s edit ulong 8192 i ulong to f64 685 nd = get m 2 686 best = 0.0f64 687 d = ulong 0 688 while lt d nd bound 1024 689 dst = dep_to m d 690 if eq dst i 691 fr = dep_fr m d 692 ix = add 2976 fr 693 cp = scf s ix 694 if gt cp best 695 best = cp 696 end 697 end 698 d = add d 1 699 end 700 ret best 701 end 702 fn rwk_bw m view ulong 8192 r ulong to f64 703 nops = get m 0 704 w = 0.0f64 705 j = ulong 0 706 while lt j nops bound 256 707 bw = opu m j 5 708 if eq bw r 709 by = opf m j 1 710 cap = opf m j 3 711 part = div by cap 712 w = add w part 713 end 714 j = add j 1 715 end 716 ret w 717 end 718 fn rwk_cpu m view ulong 8192 r ulong to f64 719 nops = get m 0 720 slots = resu m r 1 721 w = 0.0f64 722 j = ulong 0 723 while lt j nops bound 256 724 eng = opu m j 4 725 if eq eng r 726 t = opf m j 0 727 ln = opf m j 2 728 sum = add t ln 729 part = div sum f64 slots 730 w = add w part 731 end 732 j = add j 1 733 end 734 ret w 735 end 736 fn rwk_lch m view ulong 8192 r ulong to f64 737 nops = get m 0 738 w = 0.0f64 739 j = ulong 0 740 while lt j nops bound 256 741 lch = opu m j 6 742 if eq lch r 743 ln = opf m j 2 744 w = add w ln 745 end 746 j = add j 1 747 end 748 ret w 749 end 750 fn dag_rwk m view ulong 8192 r ulong to f64 751 kind = resu m r 0 752 w = 0.0f64 753 if eq kind 2 754 w = rwk_bw m r 755 end 756 if eq kind 1 757 w = rwk_cpu m r 758 end 759 if eq kind 4 760 w = rwk_lch m r 761 end 762 ret w 763 end 764 fn dag_cpw m view ulong 8192 s edit ulong 8192 to f64 765 nops = get m 0 766 k = ulong 0 767 bcp = 0.0f64 768 while lt k nops bound 256 769 ox = add 2432 k 770 i = get s ox 771 floor = dag_flr m s i 772 best = dag_best m s i 773 cpv = add best floor 774 ix = add 2976 i 775 sfput s ix cpv 776 if gt cpv bcp 777 bcp = cpv 778 end 779 k = add k 1 780 end 781 ret bcp 782 end 783 fn dag_bres m view ulong 8192 s edit ulong 8192 bcp f64 to f64 784 nres = get m 1 785 bnd = bcp 786 r = ulong 0 787 while lt r nres bound 32 788 w = dag_rwk m r 789 ix = add 5792 r 790 sfput s ix w 791 if gt w bnd 792 bnd = w 793 end 794 r = add r 1 795 end 796 ret bnd 797 end 798 fn dag_bnd m view ulong 8192 s edit ulong 8192 to void 799 bcp = dag_cpw m s 800 sfput s 20 bcp 801 bnd = dag_bres m s bcp 802 sfput s 19 bnd 803 end 804 fn dag_ws m view ulong 8192 s edit ulong 8192 b ulong to f64 805 first = bufu m b 2 806 if eq first NONE 807 ret 0.0f64 808 end 809 ix = add 4512 first 810 ret scf s ix 811 end 812 fn dag_we m view ulong 8192 s edit ulong 8192 b ulong to f64 813 last = bufu m b 3 814 if eq last NONE 815 ret scf s 3 816 end 817 ix = add 4768 last 818 ret scf s ix 819 end 820 fn dag_life m view ulong 8192 s edit ulong 8192 to ulong 821 nbuf = get m 3 822 b = ulong 0 823 eps = bitcast f64 FEPS 824 while lt b nbuf bound 256 825 st = dag_ws m s b 826 en = dag_we m s b 827 lim = add en eps 828 if lt lim st 829 put s 4 SLIFE 830 put s 5 RINV 831 put s 6 b 832 sfput s 8 st 833 sfput s 9 en 834 ret SLIFE 835 end 836 b = add b 1 837 end 838 ret 0 839 end 840 fn dag_evs m view ulong 8192 s edit ulong 8192 c ulong to ulong 841 nbuf = get m 3 842 en = ulong 0 843 b = ulong 0 844 eps = bitcast f64 FEPS 845 while lt b nbuf bound 256 846 cap = bufu m b 1 847 if eq cap c 848 st = dag_ws m s b 849 e = dag_we m s b 850 lim = add st eps 851 if lt lim e 852 by = buff m b 0 853 ix = add 3488 en 854 sfput s ix st 855 vx = add 4000 en 856 sfput s vx by 857 en = add en 1 858 ix = add 3488 en 859 sfput s ix e 860 vx = add 4000 en 861 nb = neg by 862 sfput s vx nb 863 en = add en 1 864 end 865 end 866 b = add b 1 867 end 868 ret en 869 end 870 fn sort_sw etj f64 kt f64 evj f64 kv f64 to ulong 871 sw = ulong 0 872 if gt etj kt 873 sw = ulong 1 874 end 875 if eq etj kt 876 if gt evj 0.0f64 877 if lt kv 0.0f64 878 sw = ulong 1 879 end 880 end 881 end 882 ret sw 883 end 884 fn sort_sh s edit ulong 8192 j ulong etj f64 evj f64 to ulong 885 dx = add 3488 j 886 sfput s dx etj 887 ex = add 4000 j 888 sfput s ex evj 889 ret sub j 1 890 end 891 fn sort_in s edit ulong 8192 j ulong kt f64 kv f64 to ulong 892 jp = sub j 1 893 px = add 3488 jp 894 etj = scf s px 895 qx = add 4000 jp 896 evj = scf s qx 897 sw = sort_sw etj kt evj kv 898 if eq sw 1 899 j = sort_sh s j etj evj 900 end 901 ret j 902 end 903 fn dag_sort s edit ulong 8192 en ulong to void 904 i = ulong 1 905 while lt i en bound 512 906 tx = add 3488 i 907 kt = scf s tx 908 vx = add 4000 i 909 kv = scf s vx 910 j = i 911 go = ulong 1 912 while gt j 0 bound 512 913 if eq go 0 914 break 915 end 916 nj = sort_in s j kt kv 917 if eq nj j 918 go = ulong 0 919 end 920 j = nj 921 end 922 tx = add 3488 j 923 sfput s tx kt 924 vx = add 4000 j 925 sfput s vx kv 926 i = add i 1 927 end 928 end 929 fn nmsk1 m view ulong 8192 s edit ulong 8192 b ulong pat f64 to void 930 st = dag_ws m s b 931 e = dag_we m s b 932 hit = ulong 0 933 if le st pat 934 if gt e pat 935 hit = ulong 1 936 end 937 end 938 if eq hit 0 939 ret 940 end 941 w = div b 64 942 bit = rem b 64 943 ix = add 6336 w 944 cur = get s ix 945 bitv = shl ulong 1 bit 946 put s ix or cur bitv 947 end 948 fn dag_nmsk m view ulong 8192 s edit ulong 8192 c ulong pat f64 to void 949 put s 6336 ulong 0 950 put s 6337 ulong 0 951 put s 6338 ulong 0 952 put s 6339 ulong 0 953 nbuf = get m 3 954 b = ulong 0 955 while lt b nbuf bound 256 956 cap = bufu m b 1 957 if eq cap c 958 nmsk1 m s b pat 959 end 960 b = add b 1 961 end 962 end 963 fn scan_pk m view ulong 8192 s edit ulong 8192 c ulong peak f64 pat f64 to ulong 964 px = add 6344 c 965 sfput s px peak 966 ax = add 6376 c 967 sfput s ax pat 968 cap = resf m c 2 969 eps = bitcast f64 FEPS 970 pcap = add cap eps 971 if gt peak pcap 972 dag_nmsk m s c pat 973 put s 4 SCAP 974 put s 5 RPEAK 975 put s 6 c 976 sfput s 8 peak 977 sfput s 9 pat 978 ret SCAP 979 end 980 ret 0 981 end 982 fn dag_scan m view ulong 8192 s edit ulong 8192 c ulong en ulong to ulong 983 live = 0.0f64 984 peak = 0.0f64 985 pat = 0.0f64 986 i = ulong 0 987 lim = bitcast f64 FLIVE 988 nlim = neg lim 989 while lt i en bound 512 990 vx = add 4000 i 991 ev = scf s vx 992 live = add live ev 993 if lt live nlim 994 put s 4 SLIFE 995 put s 5 RLIVE 996 put s 6 c 997 sfput s 8 live 998 tx = add 3488 i 999 at = scf s tx 1000 sfput s 9 at 1001 ret SLIFE 1002 end 1003 if gt live peak 1004 peak = live 1005 tx = add 3488 i 1006 pat = scf s tx 1007 end 1008 i = add i 1 1009 end 1010 ret scan_pk m s c peak pat 1011 end 1012 fn dag_ledg m view ulong 8192 s edit ulong 8192 to ulong 1013 nres = get m 1 1014 c = ulong 0 1015 while lt c nres bound 32 1016 kind = resu m c 0 1017 if eq kind 3 1018 en = dag_evs m s c 1019 dag_sort s en 1020 rc = dag_scan m s c en 1021 if ne rc 0 1022 ret rc 1023 end 1024 end 1025 c = add c 1 1026 end 1027 ret 0 1028 end 1029 fn dag_pred m view ulong 8192 s edit ulong 8192 cur ulong to ulong 1030 nd = get m 2 1031 pred = NONE 1032 d = ulong 0 1033 while lt d nd bound 1024 1034 dst = dep_to m d 1035 if eq dst cur 1036 fr = dep_fr m d 1037 if eq pred NONE 1038 pred = fr 1039 end 1040 if ne pred fr 1041 fx = add 4768 fr 1042 ef = scf s fx 1043 px = add 4768 pred 1044 ep = scf s px 1045 if gt ef ep 1046 pred = fr 1047 end 1048 end 1049 end 1050 d = add d 1 1051 end 1052 ret pred 1053 end 1054 fn dag_gap m view ulong 8192 s edit ulong 8192 cur ulong pred ulong to void 1055 sx = add 4512 cur 1056 st = scf s sx 1057 base = 0.0f64 1058 if ne pred NONE 1059 px = add 4768 pred 1060 base = scf s px 1061 end 1062 gap = sub st base 1063 if le gap 0.0f64 1064 ret 1065 end 1066 bx = add 320 cur 1067 blk = get s bx 1068 if eq blk 1 1069 sfadd s 5828 gap 1070 end 1071 if eq blk 2 1072 sfadd s 5827 gap 1073 end 1074 if eq blk 0 1075 sfadd s 5830 gap 1076 end 1077 sfadd s 12 gap 1078 end 1079 fn dag_bw m view ulong 8192 s edit ulong 8192 cur ulong rt f64 to void 1080 bytes = opf m cur 1 1081 cap = opf m cur 3 1082 ideal = div bytes cap 1083 cx = add 5536 cur 1084 cont = scf s cx 1085 actual = add ideal cont 1086 t = opf m cur 0 1087 if ge t actual 1088 sfadd s 5824 rt 1089 end 1090 if not ge t actual 1091 sfadd s 5825 ideal 1092 sfadd s 5826 cont 1093 if gt rt actual 1094 left = sub rt actual 1095 sfadd s 5830 left 1096 end 1097 end 1098 end 1099 fn dag_run m view ulong 8192 s edit ulong 8192 cur ulong to void 1100 ex = add 4768 cur 1101 en = scf s ex 1102 rx = add 1856 cur 1103 rs = scf s rx 1104 sx = add 4512 cur 1105 base = scf s sx 1106 if ge rs 0.0f64 1107 base = rs 1108 end 1109 rt = sub en base 1110 ln = opf m cur 2 1111 sfadd s 5827 ln 1112 acc = scf s 12 1113 acc = add acc ln 1114 kind = opu m cur 7 1115 bytes = opf m cur 1 1116 if eq kind 4 1117 sfadd s 5829 rt 1118 end 1119 if ne kind 4 1120 if gt bytes 0.0f64 1121 dag_bw m s cur rt 1122 end 1123 if not gt bytes 0.0f64 1124 sfadd s 5824 rt 1125 end 1126 end 1127 acc = add acc rt 1128 sfput s 12 acc 1129 end 1130 fn attr_end m view ulong 8192 s edit ulong 8192 to ulong 1131 nops = get m 0 1132 cur = ulong 0 1133 i = ulong 1 1134 while lt i nops bound 256 1135 ix = add 4768 i 1136 ei = scf s ix 1137 cx = add 4768 cur 1138 ec = scf s cx 1139 if gt ei ec 1140 cur = i 1141 end 1142 i = add i 1 1143 end 1144 ret cur 1145 end 1146 fn attr_rev s edit ulong 8192 nc ulong to void 1147 i = ulong 0 1148 while lt i nc bound 256 1149 j = sub nc 1 1150 j = sub j i 1151 sx = add 3232 j 1152 src = get s sx 1153 dx = add 6080 i 1154 put s dx src 1155 i = add i 1 1156 end 1157 end 1158 fn attr_left s edit ulong 8192 to void 1159 ms = scf s 3 1160 acc = scf s 12 1161 left = sub ms acc 1162 lim = bitcast f64 FLIVE 1163 addit = ulong 0 1164 if gt left lim 1165 addit = ulong 1 1166 end 1167 if lt left neg lim 1168 addit = ulong 1 1169 end 1170 if eq addit 1 1171 sfadd s 5830 left 1172 end 1173 end 1174 fn dag_attr m view ulong 8192 s edit ulong 8192 to void 1175 nops = get m 0 1176 if eq nops 0 1177 ret 1178 end 1179 cur = attr_end m s 1180 put s 12 ulong 0 1181 nc = ulong 0 1182 while lt nc 256 bound 256 1183 if eq cur NONE 1184 break 1185 end 1186 ix = add 3232 nc 1187 put s ix cur 1188 nc = add nc 1 1189 dag_run m s cur 1190 pred = dag_pred m s cur 1191 dag_gap m s cur pred 1192 cur = pred 1193 end 1194 put s 21 nc 1195 attr_rev s nc 1196 attr_left s 1197 end 1198 fn dag_syn s edit ulong 8192 to void 1199 mask = get s 11 1200 syn = ulong 0 1201 bitv = shl ulong 1 1 1202 got = and mask bitv 1203 if ne got 0 1204 syn = ulong 1 1205 end 1206 put s 26 syn 1207 end 1208 fn nrg_pow s edit ulong 8192 power f64 prov ulong to void 1209 if ne prov 1 1210 ret 1211 end 1212 ms = scf s 3 1213 eps = bitcast f64 FEPS 1214 ej = mul power ms 1215 ej = mul ej eps 1216 put s 23 ulong 1 1217 sfput s 24 ej 1218 mask = get s 11 1219 bitv = shl ulong 1 1 1220 put s 11 or mask bitv 1221 end 1222 fn dag_nrg m view ulong 8192 s edit ulong 8192 to void 1223 has = get m 4 1224 joules = bitcast f64 get m 5 1225 power = bitcast f64 get m 6 1226 prov = get m 7 1227 none = get m 8 1228 took = ulong 0 1229 if ne has 0 1230 if gt joules 0.0f64 1231 if eq none 0 1232 put s 22 ulong 1 1233 sfput s 24 joules 1234 took = ulong 1 1235 end 1236 end 1237 end 1238 if eq took 0 1239 if ne has 0 1240 if gt power 0.0f64 1241 nrg_pow s power prov 1242 end 1243 end 1244 end 1245 dag_syn s 1246 end 1247 fn dag_eval m view ulong 8192 s edit ulong 8192 to ulong 1248 phase = get m 9 1249 if eq phase 0 1250 if eq get m 0 0 1251 put s 4 SUNS 1252 put s 5 REMP 1253 ret SUNS 1254 end 1255 put s 4 SOK 1256 ret SOK 1257 end 1258 if eq dag_topo m s 0 1259 put s 4 SCYC 1260 put s 5 RCYC 1261 ret SCYC 1262 end 1263 rc = dag_cap m s 1264 if ne rc 0 1265 ret rc 1266 end 1267 dag_prov m s 1268 dag_init m s 1269 rc = dag_sim m s 1270 if ne rc 0 1271 ret rc 1272 end 1273 dag_bnd m s 1274 rc = dag_life m s 1275 if ne rc 0 1276 ret rc 1277 end 1278 rc = dag_ledg m s 1279 if ne rc 0 1280 ret rc 1281 end 1282 dag_attr m s 1283 dag_nrg m s 1284 put s 4 SOK 1285 ret SOK 1286 end