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 / om / encoder / bw_spec_regress.om
| 1 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | note Host audit regressions ENC155-01..07. No device entry points. |
| 3 | fn require yes bool to void |
| 4 | if not yes |
| 5 | exit 80 |
| 6 | end |
| 7 | end |
| 8 | fn reset_o o edit ulong 16 op ulong to void |
| 9 | for i ulong 16 |
| 10 | put o i 0 |
| 11 | end |
| 12 | put o 0 op |
| 13 | end |
| 14 | fn parity sp_tbl edit ulong 3001 o view ulong 16 to void |
| 15 | w = new ulong 4 0 |
| 16 | ref = new ulong 4 0 |
| 17 | dec = new ulong 16 0 |
| 18 | require eq enc1 o ref E_OK |
| 19 | require eq sp_enc sp_tbl o w E_OK |
| 20 | for i ulong 4 |
| 21 | require eq get w i get ref i |
| 22 | end |
| 23 | require eq sp_dec sp_tbl w dec E_OK |
| 24 | require same_sem sp_tbl o dec |
| 25 | end |
| 26 | fn emit_words sp_tbl edit ulong 3001 o view ulong 16 to void |
| 27 | w = new ulong 4 0 |
| 28 | buf = new uchar 16 0 |
| 29 | require eq sp_enc sp_tbl o w E_OK |
| 30 | for i ulong 4 |
| 31 | v = get w i |
| 32 | off = mul i 4 |
| 33 | for b ulong 4 |
| 34 | byte_v = uchar and shr v mul b 8 255 |
| 35 | put buf add off b byte_v |
| 36 | end |
| 37 | end |
| 38 | require eq write 1 buf 0 16 16 |
| 39 | end |
| 40 | fn main to int |
| 41 | sp_tbl = new ulong 3001 0 |
| 42 | w = new ulong 4 4294967295 |
| 43 | dec = new ulong 16 0 |
| 44 | buf128 = new uchar 128 0 |
| 45 | o = new ulong 16 0 |
| 46 | mode = new uchar 16 0 |
| 47 | note Cold decoder must initialize without any prior encoder call. |
| 48 | require eq sp_dec sp_tbl w dec E_NOMAT |
| 49 | note All absent RA/RB operands must encode RZ, independently byte checked. |
| 50 | for j ulong 3 |
| 51 | reset_o o add 51 j |
| 52 | put o 1 4 |
| 53 | put o 4 7 |
| 54 | parity sp_tbl o |
| 55 | end |
| 56 | note RRU destination is a full GPR, not a uniform register. |
| 57 | reset_o o 8 |
| 58 | put o 1 32 |
| 59 | put o 2 1 |
| 60 | put o 5 2 |
| 61 | put o 4 3 |
| 62 | put o 8 1 |
| 63 | put o 12 1 |
| 64 | put o 14 1 |
| 65 | parity sp_tbl o |
| 66 | require eq sp_enc sp_tbl o w E_OK |
| 67 | require eq sp_dec sp_tbl w dec E_OK |
| 68 | put dec 8 0 |
| 69 | require not same_sem sp_tbl o dec |
| 70 | note Optional sample output for offline nvdisasm, no binary listing committed. |
| 71 | if ge argcnt 2 |
| 72 | got = argread 1 mode 0 16 |
| 73 | require gt got 0 |
| 74 | if eq get mode 0 122 |
| 75 | reset_o o add ulong 51 sub ulong get mode 1 48 |
| 76 | put o 1 4 |
| 77 | put o 4 7 |
| 78 | end |
| 79 | emit_words sp_tbl o |
| 80 | ret 0 |
| 81 | end |
| 82 | reset_o o 42 |
| 83 | put o 6 32 |
| 84 | require eq sp_enc sp_tbl o w E_RANGE |
| 85 | reset_o o 51 |
| 86 | put o 6 256 |
| 87 | require eq sp_enc sp_tbl o w E_RANGE |
| 88 | reset_o o 10 |
| 89 | put o 1 8 |
| 90 | require eq sp_enc sp_tbl o w E_RANGE |
| 91 | reset_o o 12 |
| 92 | put o 6 4294967296 |
| 93 | require eq sp_enc sp_tbl o w E_RANGE |
| 94 | reset_o o 4 |
| 95 | put o 6 1 |
| 96 | require eq sp_enc sp_tbl o w E_RANGE |
| 97 | put o 6 262143 |
| 98 | require eq sp_enc sp_tbl o w E_RANGE |
| 99 | reset_o o 54 |
| 100 | put o 6 2147483647 |
| 101 | require eq sp_enc sp_tbl o w E_RANGE |
| 102 | reset_o o 46 |
| 103 | put o 6 4294967296 |
| 104 | require eq sp_enc sp_tbl o w E_RANGE |
| 105 | note A decoded active operand mutation must fail semantically. |
| 106 | reset_o o 8 |
| 107 | put o 13 1 |
| 108 | require eq sp_enc sp_tbl o w E_OK |
| 109 | require eq sp_dec sp_tbl w dec E_OK |
| 110 | require same_sem sp_tbl o dec |
| 111 | put dec 1 add get dec 1 1 |
| 112 | require not same_sem sp_tbl o dec |
| 113 | require eq sp_dec sp_tbl w dec E_OK |
| 114 | put dec 7 xor get dec 7 1 |
| 115 | require not same_sem sp_tbl o dec |
| 116 | note Read errors and partial EOF are distinct from clean EOF. |
| 117 | require eq read_exact int -1 buf128 128 -1 |
| 118 | ret 0 |
| 119 | end |