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/components/bw_check.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 / components / bw_check.om` 142 lines · 2343 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 2 note Validate the existing IR, never translate to a second representation. 3 fn bc_width m view ulong 2048 reg ulong width ulong to bool 4 if ge reg 256 5 ret false 6 end 7 ret eq get m reg width 8 end 9 fn bc_regcheck ins view ulong 8192 base ulong m view ulong 2048 to uint 10 op = get ins base 11 flags = get ins add base 7 12 if gt op 59 13 ret 1 14 end 15 if ne shr flags 48 0 16 ret 1 17 end 18 for k ulong 4 19 v = get ins add add base 1 k 20 if ne v BCNONE 21 if and eq k 0 ne and flags 1 0 22 if ge v 32 23 ret 2 24 end 25 v = add v 256 26 else 27 if ge v 256 28 ret 2 29 end 30 end 31 width = get m v 32 if eq width 0 33 ret 2 34 end 35 subreg = and shr flags add ulong 16 mul k 8 255 36 if ge subreg width 37 ret 2 38 end 39 end 40 end 41 u = get ins add base 5 42 if ne u BCNONE 43 if ge u 32 44 ret 2 45 end 46 if eq get m add u 256 0 47 ret 2 48 end 49 end 50 ret 0 51 end 52 fn bc_type ins view ulong 8192 base ulong m view ulong 2048 to uint 53 op = get ins base 54 d = get ins add base 1 55 a = get ins add base 2 56 b = get ins add base 3 57 c = get ins add base 4 58 if or eq op 56 eq op 57 59 width = ulong 2 60 if eq op 57 61 width = 4 62 end 63 if or eq bc_width m d width false eq bc_width m a 2 false 64 ret 3 65 end 66 if eq d a 67 ret 3 68 end 69 end 70 if eq op 11 71 note Scalar loads/stores may select one lane of a live pair/quad; bc_regcheck checks subreg bounds. 72 if or eq d BCNONE eq bc_width m a 2 false 73 ret 3 74 end 75 end 76 if eq op 12 77 if or eq bc_width m a 2 false eq b BCNONE 78 ret 3 79 end 80 end 81 if eq op 16 82 if or eq bc_width m d 4 false eq bc_width m a 4 false 83 ret 3 84 end 85 if eq bc_width m b 2 false 86 ret 3 87 end 88 if and ne c BCNONE eq bc_width m c 4 false 89 ret 3 90 end 91 end 92 ret 0 93 end 94 fn bc_ctrlcheck ins view ulong 8192 i ulong n ulong to uint 95 base = mul i 8 96 op = get ins base 97 if or eq op 46 eq op 54 98 raw = and get ins add base 6 `4294967295` 99 target = add i raw 100 if ge raw `2147483648` 101 target = sub i sub ulong `4294967296` raw 102 end 103 if ge target n 104 ret 4 105 end 106 if and eq op 54 le target i 107 ret 4 108 end 109 end 110 if or eq op 11 or eq op 56 eq op 57 111 ctrl = shr get ins add base 6 32 112 if ne and shr ctrl 17 7 1 113 ret 5 114 end 115 wb = and shr ctrl 14 7 116 if and ne wb 0 and ne wb 3 ne wb 4 117 ret 5 118 end 119 end 120 ret 0 121 end 122 fn bc_ircheck ins view ulong 8192 n ulong m view ulong 2048 to uint 123 if or eq n 0 gt n 1024 124 ret 1 125 end 126 for i ulong n 127 base = mul i 8 128 rc = bc_regcheck ins base m 129 if ne rc 0 130 ret rc 131 end 132 rc = bc_type ins base m 133 if ne rc 0 134 ret rc 135 end 136 rc = bc_ctrlcheck ins i n 137 if ne rc 0 138 ret rc 139 end 140 end 141 ret 0 142 end