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/tests/shader-pilot/core-test.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 / tests / shader-pilot / core-test.om` 138 lines · 3230 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 2 note Tests bind the pilot boundary, not GPU execution or source authentication. 3 global sptally ulong 2 4 text spok "SHADER_PILOT_CORE_PASS\n" 5 text spbad "SHADER_PILOT_CORE_FAIL\n" 6 fn sptest yes bool to void 7 put sptally 0 add get sptally 0 1 8 if not yes 9 put sptally 1 add get sptally 1 1 10 end 11 end 12 fn spcopy id ulong to ulong 13 n = kload id 14 for i ulong n 15 put sptask i get kt i 16 end 17 gbvec 18 for i ulong 512 19 put spcode i get gbcode i 20 end 21 ret n 22 end 23 fn spow p ulong v ulong to void 24 for j ulong 4 25 put ko add mul p 4 j uchar and shr v mul j 8 255 26 end 27 end 28 fn spobs n ulong value ulong to void 29 note Independent expected literals: Wolfram Mod[7+9,2^32]=16 and Mod[2^32-1+3,2^32]=2. 30 for i ulong add n 2 31 v = value 32 if or eq i 0 eq i add n 1 33 v = `2779096485` 34 end 35 spow i v 36 end 37 end 38 fn spcase id ulong tn ulong n ulong value ulong on ulong to void 39 sptest eq spload id tn 40 sptest eq get gblen 0 512 41 sptest eq kw 5 n 42 sptest eq kw 2 1 43 spobs n value 44 sptest eq keval tn on 0 45 note Wrong result/skipped write must fail the existing independent evaluator. 46 put ko 4 xor get ko 4 1 47 sptest eq keval tn on 1 48 spobs n value 49 put ko sub on 1 0 50 sptest eq keval tn on 1 51 t = spcopy id 52 sptest eq t tn 53 sptest eq spmatch id tn 512 0 54 note Every candidate byte matters. Omitted scan bytes make these tests fail. 55 for i ulong tn 56 v = get sptask i 57 put sptask i xor v 1 58 sptest eq spmatch id tn 512 1 59 sptest eq get sptask i xor v 1 60 put sptask i v 61 end 62 for i ulong 512 63 v = get spcode i 64 put spcode i xor v 1 65 sptest eq spmatch id tn 512 1 66 sptest eq get spcode i xor v 1 67 put spcode i v 68 end 69 sptest eq spmatch id tn 512 0 70 sptest eq spmatch id sub tn 1 512 65 71 sptest eq spmatch id add tn 1 512 65 72 sptest eq spmatch id tn 511 65 73 sptest eq spmatch id tn 513 65 74 sptest eq spmatch id `18446744073709551615` 512 65 75 sptest eq spmatch id tn `18446744073709551615` 65 76 note Stale or poisoned trusted scratch cannot redefine the expected bytes. 77 put kt 0 0 78 put gbcode 0 0 79 put gblen 0 0 80 sptest eq spmatch id tn 512 0 81 end 82 fn spprofs to void 83 n = kload 2 84 sptest spprofile 2 n 85 note This remains valid CUL1 add8 but stride2 is not supported by gbvec. 86 kput 8 2 87 kput 9 2 88 kput 10 2 89 kput 11 15 90 kput 12 15 91 kput 13 15 92 sptest eq kvalid 216 0 93 sptest not spprofile 2 216 94 n = kload 3 95 sptest not spprofile 2 n 96 sptest spprofile 3 n 97 note A valid CUL1 operation is not necessarily a supported vector operation. 98 n = kload 5 99 sptest eq kvalid n 0 100 sptest not spprofile 2 n 101 n = kload 1 102 sptest not spprofile 1 n 103 n = kload 2 104 kput 3 2 105 sptest not spprofile 2 n 106 end 107 fn main to int 108 spprofs 109 spcase 2 160 8 16 40 110 spcase 3 232 17 2 76 111 note Same emitted code does not make task2 an acceptable task3 receipt. 112 t = spcopy 2 113 sptest eq spmatch 3 t 512 65 114 sptest eq spmatch 3 232 512 1 115 note Unsupported catalog IDs and modes do not mutate a previous specimen. 116 n = spload 3 117 a = get kt 0 118 b = get gbcode 0 119 for id ulong 10 120 if and ne id 2 ne id 3 121 sptest eq spload id 0 122 sptest eq spmatch id 232 512 77 123 sptest eq get kt 0 a 124 sptest eq get gbcode 0 b 125 sptest eq get gblen 0 512 126 end 127 end 128 sptest eq spload `18446744073709551615` 0 129 sptest eq spmatch `18446744073709551615` 232 512 77 130 if ne get sptally 1 0 131 r = write 2 spbad 0 len spbad 132 ret 1 133 end 134 if ne write 1 spok 0 len spok long len spok 135 ret 74 136 end 137 ret 0 138 end