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/cmdlist/plan.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 / cmdlist / plan.om` 153 lines · 2680 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 2 const CLBAD ulong `18446744073709551615` 3 note Descriptor: count then sixteen VA/length/flags triples; count17 means unknown. 4 fn clvalid p view ulong 200704 i ulong to ulong 5 b = mul i 49 6 n = get p b 7 if gt n 17 8 ret 0 9 end 10 if eq n 17 11 ret 1 12 end 13 for j ulong n 14 k = add add b 1 mul j 3 15 if eq get p add k 1 0 16 ret 0 17 end 18 if eq get p add k 2 0 19 ret 0 20 end 21 if gt get p add k 2 3 22 ret 0 23 end 24 if gt get p k sub CLBAD get p add k 1 25 ret 0 26 end 27 end 28 ret 1 29 end 30 31 fn clrange p view ulong 200704 a ulong b ulong to ulong 32 if ge get p a add get p b get p add b 1 33 ret 0 34 end 35 if ge get p b add get p a get p add a 1 36 ret 0 37 end 38 x = get p add a 2 39 y = get p add b 2 40 h = ulong 0 41 if and ne and y 2 0 ne and x 1 0 42 h = or h 1 43 end 44 if and ne and y 1 0 ne and x 2 0 45 h = or h 2 46 end 47 if and ne and y 2 0 ne and x 2 0 48 h = or h 4 49 end 50 ret h 51 end 52 53 fn clrow p view ulong 200704 a ulong y ulong to ulong 54 h = ulong 0 55 for j ulong get p y 56 b = add add y 1 mul j 3 57 h = or h clrange p a b 58 end 59 ret h 60 end 61 62 fn clpair p view ulong 200704 x ulong y ulong to ulong 63 if or eq get p x 17 eq get p y 17 64 ret 7 65 end 66 h = ulong 0 67 for i ulong get p x 68 a = add add x 1 mul i 3 69 h = or h clrow p a y 70 end 71 ret h 72 end 73 74 fn clhazards p view ulong 200704 i ulong start ulong to ulong 75 h = ulong 0 76 for j ulong sub i start 77 h = or h clpair p mul i 49 mul add start j 49 78 end 79 if eq i 0 80 h = ulong 8 81 end 82 ret h 83 end 84 85 fn clstep p view ulong 200704 barriers edit ulong 4096 o edit ulong 16 i ulong mode ulong stamps ulong to ulong 86 h = clhazards p i get o 3 87 put barriers i h 88 if ne h 0 89 put o 1 add get o 1 1 90 put o 3 i 91 put o 0 add get o 0 4 92 end 93 if eq mode 0 94 put o 0 add get o 0 4 95 else 96 put o 0 add get o 0 198 97 end 98 if ne stamps 0 99 put o 0 add get o 0 6 100 end 101 ret 0 102 end 103 104 note Whole-program planning: count capacity mode stamps ring_words prefix_words. 105 note Output: exact words, WFI methods (excluding tail release), submissions, epoch start. 106 note RAW1 WAR2 WAW4 admission8. Compare ALL outstanding launches since the last drain. 107 note No splitting: ring overflow is refused before the shell can submit anything. 108 fn cmdlist_plan a view ulong 16 p view ulong 200704 barriers edit ulong 4096 o edit ulong 16 to ulong 109 if gt get a 0 4096 110 ret 1 111 end 112 if gt get a 0 get a 1 113 ret 1 114 end 115 if gt get a 1 4096 116 ret 1 117 end 118 if or gt get a 2 1 gt get a 3 1 119 ret 1 120 end 121 for i ulong 4 122 if ne get a add 6 i 0 123 ret 1 124 end 125 end 126 for i ulong get a 0 127 if eq clvalid p i 0 128 ret 2 129 end 130 end 131 for i ulong 16 132 put o i 0 133 end 134 if eq get a 0 0 135 ret 0 136 end 137 put o 0 35 138 if ne get a 3 0 139 put o 0 add get o 0 8 140 put o 1 1 141 end 142 for i ulong get a 0 143 r = clstep p barriers o i get a 2 get a 3 144 end 145 if gt get a 5 get a 4 146 ret 3 147 end 148 if gt get o 0 sub get a 4 get a 5 149 ret 3 150 end 151 put o 2 1 152 ret 0 153 end