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
CUDApp / tests / session_memory_gate.om
| 1 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | note Concatenate tests/components/proc.om then this file. One argument: pinned omc. |
| 3 | note Uses the existing checked process helper. All new test/conductor logic is Omega. |
| 4 | text MGsrc "om/session/reserve.om" |
| 5 | text MGfx "om/engine/fixture_rest.om" |
| 6 | text MGeng "om/engine/eng.om" |
| 7 | text MGslot "om/api/apish_slot.om" |
| 8 | text MGtest "tests/session_memory_test.om" |
| 9 | text MGdir "build/session-memory" |
| 10 | text MGcomp "build/components" |
| 11 | text MGbin "build/session-memory/check" |
| 12 | text MGlog "build/session-memory/positive.log" |
| 13 | text MGl1 "build/session-memory/default.log" |
| 14 | text MGl2 "build/session-memory/saturation.log" |
| 15 | text MGl3 "build/session-memory/prefix.log" |
| 16 | text MGl4 "build/session-memory/sign.log" |
| 17 | text MGl5 "build/session-memory/end.log" |
| 18 | text MGl6 "build/session-memory/underflow.log" |
| 19 | text MGl7 "build/session-memory/capacity.log" |
| 20 | text MGpass "SESSION_MEMORY_GATE PASS mutants=7/7 KILLED; chip NOT_RUN\n" |
| 21 | text MGkill "KILLED " |
| 22 | text MGa "if eq len b 0\nret 4096" |
| 23 | text MGan "if eq len b 0\nret 4097" |
| 24 | text MGb "if gt value 17592186044415" |
| 25 | text MGbn "if ge value 17592186044415" |
| 26 | text MGc "ret eq get b 12 58" |
| 27 | text MGcn "ret eq get b 12 59" |
| 28 | text MGd "put dst 0 sub ulong 0 get dst 0" |
| 29 | text MGdn "put dst 0 add ulong 0 get dst 0" |
| 30 | text MGe "if eq get dst 1 len b" |
| 31 | text MGen "if ne get dst 1 len b" |
| 32 | text MGf "if or eq get rec 1 0 and eq get rec 5 0 ne get rec 3 ver" |
| 33 | text MGfn "if or ne get rec 1 0 and eq get rec 5 0 ne get rec 3 ver" |
| 34 | text MGg "if ge get m 3 get m 4" |
| 35 | text MGgn "if gt get m 3 get m 4" |
| 36 | |
| 37 | fn mg_load to void |
| 38 | put HUsed 0 0 |
| 39 | hp_cat MGsrc len MGsrc |
| 40 | hp_cat MGfx len MGfx |
| 41 | hp_cat MGeng len MGeng |
| 42 | hp_cat MGslot len MGslot |
| 43 | hp_cat MGtest len MGtest |
| 44 | end |
| 45 | |
| 46 | fn mg_change old view uchar * next view uchar * to void |
| 47 | hp_require eq len old len next |
| 48 | hp_require gt len old 0 |
| 49 | n = get HUsed 0 |
| 50 | hp_require le len old n |
| 51 | matches = ulong 0 |
| 52 | i = ulong 0 |
| 53 | while le i sub n len old bound 999999 |
| 54 | same = true |
| 55 | for j ulong len old |
| 56 | if ne get HSrc add i j get old j |
| 57 | same = false |
| 58 | break |
| 59 | end |
| 60 | end |
| 61 | if same |
| 62 | matches = add matches 1 |
| 63 | for j ulong len next |
| 64 | put HSrc add i j get next j |
| 65 | end |
| 66 | i = add i len old |
| 67 | else |
| 68 | i = add i 1 |
| 69 | end |
| 70 | end |
| 71 | hp_require eq matches 1 |
| 72 | end |
| 73 | |
| 74 | fn mg_run expected long path view uchar * to void |
| 75 | hp_build MGbin len MGbin |
| 76 | fd = hp_open path len path or int 577 524288 420 |
| 77 | hp_start MGbin len MGbin |
| 78 | hp_exec -1 fd expected |
| 79 | hp_close fd |
| 80 | end |
| 81 | |
| 82 | fn mg_mut old view uchar * next view uchar * path view uchar * to void |
| 83 | mg_load |
| 84 | mg_change old next |
| 85 | mg_run 1 path |
| 86 | hp_say MGkill |
| 87 | hp_say old |
| 88 | hp_say HPNew |
| 89 | end |
| 90 | |
| 91 | fn main to int |
| 92 | path = new uchar 1024 0 |
| 93 | hp_require eq argcnt 2 |
| 94 | n = argread 1 path 0 1024 |
| 95 | hp_require gt n 0 |
| 96 | put HOn 0 ulong n |
| 97 | for i ulong ulong n |
| 98 | put HOm i get path i |
| 99 | end |
| 100 | r = makedir MGdir 0 len MGdir 493 |
| 101 | hp_require or eq r 0 eq r -17 |
| 102 | r = makedir MGcomp 0 len MGcomp 493 |
| 103 | hp_require or eq r 0 eq r -17 |
| 104 | mg_load |
| 105 | mg_run 0 MGlog |
| 106 | mg_mut MGa MGan MGl1 |
| 107 | mg_mut MGb MGbn MGl2 |
| 108 | mg_mut MGc MGcn MGl3 |
| 109 | mg_mut MGd MGdn MGl4 |
| 110 | mg_mut MGe MGen MGl5 |
| 111 | mg_mut MGf MGfn MGl6 |
| 112 | mg_mut MGg MGgn MGl7 |
| 113 | hp_say MGpass |
| 114 | ret 0 |
| 115 | end |