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/graph/residue.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 / graph / residue.om` 150 lines · 2279 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 2 note Scalar graph metadata and admission; fixed descriptors avoid object ABI coupling. 3 fn grshape c view ulong 16 d edit ulong 16 to ulong 4 hd = get c 0 5 iw = get c 1 6 qh = get c 2 7 kv = get c 3 8 gh = get c 4 9 if eq hd 0 10 hd = 5120 11 end 12 if eq iw 0 13 iw = 17408 14 end 15 if eq qh 0 16 qh = 24 17 end 18 if eq kv 0 19 kv = 4 20 end 21 if eq gh 0 22 gh = 48 23 end 24 if or ne rem hd 1024 0 gt hd 5120 25 ret 0 26 end 27 if or eq iw 0 or ne rem iw 256 0 gt iw 17408 28 ret 0 29 end 30 if or gt qh 24 ne rem qh kv 0 31 ret 0 32 end 33 if gt div qh kv 8 34 ret 0 35 end 36 if and ne gh 32 ne gh 48 37 ret 0 38 end 39 if ne mul qh 256 mul gh 128 40 ret 0 41 end 42 put d 0 hd 43 put d 1 iw 44 put d 2 qh 45 put d 3 kv 46 put d 4 gh 47 put d 5 mul add 32 gh 128 48 put d 6 add get d 5 mul gh 128 49 put d 7 mul 2 gh 50 put d 8 mul add qh kv 512 51 put d 9 add mul qh 256 mul kv 512 52 put d 10 mul qh 256 53 ret 1 54 end 55 fn grmeta mode ulong c view ulong 16 d edit ulong 16 to ulong 56 if eq mode 0 57 ret grshape c d 58 end 59 if eq mode 1 60 note layers,maxlayers,vocab,span,heads,maxheads,mask,usesmask 61 if or eq get c 0 0 gt get c 0 get c 1 62 ret 0 63 end 64 if or eq get c 2 0 gt get c 2 mul get c 3 get c 3 65 ret 0 66 end 67 if or eq get c 4 0 gt get c 4 get c 5 68 ret 0 69 end 70 if and ne get c 7 0 lt get c 0 64 71 if ne shr get c 6 get c 0 0 72 ret 0 73 end 74 end 75 put d 0 div sub add get c 2 get c 3 1 get c 3 76 ret 1 77 end 78 if eq mode 2 79 note mask,layer,attention count,gdn count -> bit,index,updated counts 80 bit = and shr get c 0 get c 1 1 81 na = get c 2 82 ng = get c 3 83 idx = ng 84 if ne bit 0 85 idx = na 86 na = add na 1 87 else 88 ng = add ng 1 89 end 90 put d 0 bit 91 put d 1 idx 92 put d 2 na 93 put d 3 ng 94 ret 1 95 end 96 if eq mode 3 97 note normalize barrier: dependency chains refuse NONE 98 b = get c 0 99 if or gt b 4 eq b 1 100 ret 0 101 end 102 ret b 103 end 104 if eq mode 4 105 note Prefill device allocation round-up preserving size_t arithmetic. 106 ret and add get c 0 4095 `18446744073709547520` 107 end 108 if eq mode 5 109 if ne get c 0 get c 3 110 ret 0 111 end 112 if ne get c 1 get c 4 113 ret 0 114 end 115 if ne get c 2 get c 5 116 ret 0 117 end 118 ret 1 119 end 120 if eq mode 6 121 skip = ulong 0 122 if ne get c 0 0 123 skip = 1 124 end 125 if gt get c 0 get c 2 126 ret 0 127 end 128 if gt get c 1 skip 129 if gt sub get c 1 skip sub get c 2 get c 0 130 ret 0 131 end 132 end 133 put d 0 skip 134 ret 1 135 end 136 if eq mode 7 137 limit = get c 1 138 if eq limit 0 139 limit = sub get c 2 2 140 end 141 if gt limit get c 3 142 ret 0 143 end 144 if gt get c 0 limit 145 ret 0 146 end 147 ret get c 4 148 end 149 ret 0 150 end