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/encoder/atomg_min_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 / om / encoder / atomg_min_test.om` 170 lines · 3933 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 2 note atomg_min_test.om: gate for BlackwellIR op 64, ATOMG.E.MIN.64.STRONG.SYS, of the seeded encoder (the Omega NG 3 note kernel trap word). Concatenate after bw_enc_sm121.om; mk/om-encoder.mk test-om-encoder-atomg compiles it with 4 note the pinned omc. 5 note No arguments: three rows through enc1 must give exactly the words below. Exit 0, else 10+r for row r. 6 note One argument: write the three instructions (48 bytes) on stdout for the ORACLE. 7 note Two arguments: read the ORACLE's text on stdin and require the three lines of amnd in order. 8 note Exit 0, 4 when a line is missing or out of order, 70 on a read error, 71 when the text is too long. 9 note ORACLE (independent, not first-party, never shipped): NVIDIA nvdisasm 13.0.85 -b SM121 -hex. Its decode of the 10 note type field (evidence/atomg-min-`20261107`/atomg_field_probe_nvdisasm.txt): 2 = .64, 3 = .S64. 11 note Rows (dst, src1, src2, ureg; dst absent encodes RZ) and words, decimal by Wolfram: 12 note R4, R2, R6, UR8: `33847720` = 0x020479a8, `2147483654` = 0x80000006, `144659720` = 0x089f5508 13 note RZ, R2, R6, UR8: `50297256` = 0x02ff79a8, `2147483654` = 0x80000006, `144659720` = 0x089f5508 14 note R10, R12, R14, UR4: `202013096` = 0x0c0a79a8, `2147483662` = 0x8000000e, `144659716` = 0x089f5504 15 note w3 of every row: `3284480` = 0x00321e00. 16 text amnd "ATOMG.E.MIN.64.STRONG.SYS PT, R4, desc[UR8][R2.64], R6 ;|ATOMG.E.MIN.64.STRONG.SYS PT, RZ, desc[UR8][R2.64], R6 ;|ATOMG.E.MIN.64.STRONG.SYS PT, R10, desc[UR4][R12.64], R14 ;|" 17 global am_in ulong 15 18 global am_w ulong 9 19 20 fn am_init to void 21 put am_in 0 4 22 put am_in 1 2 23 put am_in 2 6 24 put am_in 3 8 25 put am_in 4 1 26 put am_in 5 0 27 put am_in 6 2 28 put am_in 7 6 29 put am_in 8 8 30 put am_in 9 0 31 put am_in 10 10 32 put am_in 11 12 33 put am_in 12 14 34 put am_in 13 4 35 put am_in 14 1 36 put am_w 0 `33847720` 37 put am_w 1 `2147483654` 38 put am_w 2 `144659720` 39 put am_w 3 `50297256` 40 put am_w 4 `2147483654` 41 put am_w 5 `144659720` 42 put am_w 6 `202013096` 43 put am_w 7 `2147483662` 44 put am_w 8 `144659716` 45 end 46 47 note encode row r (dst, src1, src2, ureg, dst present) into w; enc1's result (0 accepted) 48 fn am_enc r ulong w edit ulong 4 to ulong 49 o = new ulong 16 0 50 b = mul r 5 51 put o 0 64 52 put o 1 get am_in b 53 put o 2 get am_in add b 1 54 put o 3 get am_in add b 2 55 put o 5 get am_in add b 3 56 put o 15 get am_in add b 4 57 ret enc1 view o w 58 end 59 60 fn am_words w view ulong 4 r ulong to bool 61 b = mul r 3 62 if ne get w 0 get am_w b 63 ret false 64 end 65 if ne get w 1 get am_w add b 1 66 ret false 67 end 68 if ne get w 2 get am_w add b 2 69 ret false 70 end 71 ret eq get w 3 `3284480` 72 end 73 74 fn am_rows to int 75 w = new ulong 4 0 76 for r ulong 3 77 if ne am_enc r edit w 0 78 ret int add 10 r 79 end 80 if not am_words view w r 81 ret int add 10 r 82 end 83 end 84 ret 0 85 end 86 87 fn am_bin to int 88 w = new ulong 4 0 89 code = new uchar 16384 0 90 for r ulong 3 91 if ne am_enc r edit w 0 92 ret int add 10 r 93 end 94 store edit code r view w 95 end 96 off = ulong 0 97 while lt off 48 98 n = write 1 code off sub 48 off 99 if le n 0 100 ret 3 101 end 102 off = add off ulong n 103 end 104 ret 0 105 end 106 107 note does needle amnd[s..e) start at buf[i]? The caller keeps i + e - s within the text. 108 fn am_at buf view uchar 65536 i ulong s ulong e ulong to bool 109 for j ulong sub e s 110 if ne get buf add i j get amnd add s j 111 ret false 112 end 113 end 114 ret true 115 end 116 117 note the end of the first match of amnd[s..e) in buf[i..n), or n+1 when absent 118 fn am_find buf view uchar 65536 n ulong i ulong s ulong e ulong to ulong 119 while le add i sub e s n 120 if am_at buf i s e 121 ret add i sub e s 122 end 123 i = add i 1 124 end 125 ret add n 1 126 end 127 128 fn am_check to int 129 buf = new uchar 65536 0 130 n = ulong 0 131 while lt n 65536 132 k = read 0 buf n sub 65536 n 133 if lt k 0 134 ret 70 135 end 136 if eq k 0 137 break 138 end 139 n = add n ulong k 140 end 141 if eq n 65536 142 ret 71 143 end 144 pos = ulong 0 145 s = ulong 0 146 for e ulong len amnd 147 if eq get amnd e 124 148 pos = am_find view buf n pos s e 149 if gt pos n 150 ret 4 151 end 152 s = add e 1 153 end 154 end 155 ret 0 156 end 157 158 fn main to int 159 am_init 160 if gt argcnt 3 161 ret 64 162 end 163 if eq argcnt 3 164 ret am_check 165 end 166 if eq argcnt 2 167 ret am_bin 168 end 169 ret am_rows 170 end