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/guard_spec_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 / guard_spec_test.om` 110 lines · 2331 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 2 note guard_spec_test.om: the spec encoder sp_enc (om/encoder/bw_spec_sm121.om, used by om/components/encode.om 3 note bc_encode for the q38 and validate paths) must match enc1 on the guard predicate (DRA-483, C1b). 4 note Concatenate after bw_enc_sm121.om and bw_spec_sm121.om; mk/om-encoder.mk test-om-encoder-guard compiles it. 5 note enc1's guards are pinned by guard_pred_test.om and the nvdisasm oracle; this gate carries them to sp_enc. 6 note Every op 0..59 (the spec's coverage) is encoded unpredicated, @P0 and @!P0 with R4 <- R8, R12, R16, UR4 (imm 2 7 note for BRA and BSSY, else 0) by both encoders: both must accept or both refuse, and accepted words must be equal. 8 note Prints one line per differing form (op, form 0 none / 1 @P0 / 2 @!P0), then the count; exit 0 when none, else 1. 9 text gsm1 "FAIL spec op " 10 text gsm2 " form " 11 text gsm3 "spec guard mismatches: " 12 text gsnl "\n" 13 14 fn gs_o op ulong f ulong o edit ulong 16 to void 15 for j ulong 16 16 put o j 0 17 end 18 put o 0 op 19 put o 1 4 20 put o 2 8 21 put o 3 12 22 put o 4 16 23 put o 5 4 24 if eq op 35 25 note FSEL's src3 is its predicate selector, P0..P7 (the spec bounds it at 7; enc1 keeps its low 3 bits) 26 put o 4 0 27 end 28 if or eq op 46 eq op 54 29 put o 6 2 30 end 31 put o 12 1 32 put o 13 1 33 put o 14 1 34 put o 15 1 35 if ne f 0 36 put o 9 1 37 end 38 if eq f 2 39 put o 10 1 40 end 41 end 42 43 fn gs_dec x ulong to void 44 b = new uchar 20 0 45 i = ulong 20 46 v = x 47 c = true 48 while c bound 20 49 i = sub i 1 50 put b i uchar add 48 rem v 10 51 v = div v 10 52 if eq v 0 53 c = false 54 end 55 end 56 k = write 1 b i sub 20 i 57 end 58 59 fn gs_same a view ulong 4 b view ulong 4 to bool 60 for k ulong 4 61 if ne get a k get b k 62 ret false 63 end 64 end 65 ret true 66 end 67 68 note 1 when enc1 and sp_enc disagree on op with form f 69 fn gs_one st edit ulong 3001 op ulong f ulong to ulong 70 o = new ulong 16 0 71 a = new ulong 4 0 72 b = new ulong 4 0 73 gs_o op f edit o 74 r1 = enc1 view o edit a 75 r2 = sp_enc st view o edit b 76 if ne eq r1 0 eq r2 0 77 ret 1 78 end 79 if ne r1 0 80 ret 0 81 end 82 if gs_same view a view b 83 ret 0 84 end 85 ret 1 86 end 87 88 fn main to int 89 st = new ulong 3001 0 90 bad = ulong 0 91 for op ulong 60 92 for f ulong 3 93 if ne gs_one edit st op f 0 94 k = write 1 gsm1 0 len gsm1 95 gs_dec op 96 k = write 1 gsm2 0 len gsm2 97 gs_dec f 98 k = write 1 gsnl 0 1 99 bad = add bad 1 100 end 101 end 102 end 103 k = write 1 gsm3 0 len gsm3 104 gs_dec bad 105 k = write 1 gsnl 0 1 106 if ne bad 0 107 ret 1 108 end 109 ret 0 110 end