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/q38-head/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 / q38-head / plan.om` 117 lines · 2741 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 2 note Pure layout and schedule for the experimental 27B exact head. 3 note Info: norm bits, scratch bytes, rounding count, scaled, scores, coefficients, lo, hi, tau, padded count. 4 fn q38_layout q edit ulong 192 to void 5 put q 2 10384 6 put q 3 0 7 put q 4 20480 8 put q 5 add get q 4 mul ulong 248320 4 9 put q 6 add get q 5 mul ulong 248320 4 10 put q 9 mul div add ulong 248320 2047 2048 2048 11 put q 7 add get q 6 mul get q 9 4 12 put q 8 add get q 7 mul ulong 248320 4 13 put q 1 add get q 8 256 14 note Additional admission reserve for the resident screen, coefficients and scratch, rounded conservatively to 2 GiB. 15 put q 10 shl ulong 1 31 16 end 17 note A descriptor has kind, grid, element count, input A, input B, output A, output B, scalar, count. 18 fn q38_schedule m view ulong 16 q edit ulong 192 to ulong 19 if ne get m 1 248320 20 ret 0 21 end 22 if or eq get m 2 0 ge get m 2 `2139095040` 23 ret 0 24 end 25 for j ulong 6 26 v = get m add j 3 27 if or eq v 0 ge v shl ulong 1 48 28 ret 0 29 end 30 if ne rem v 16 0 31 ret 0 32 end 33 end 34 lay = new ulong 192 0 35 q38_layout lay 36 base = get m 3 37 hidden = get m 4 38 for j ulong 192 39 put q j 0 40 end 41 note Scale hidden by 2^64, then compact FP8 screen. 42 put q 0 1 43 put q 1 20 44 put q 2 5120 45 put q 3 hidden 46 put q 5 add base get lay 3 47 put q 8 5120 48 put q 16 2 49 put q 19 get m 8 50 put q 20 add base get lay 3 51 put q 21 add base get lay 4 52 note Conservative intervals, then maximum lower bound. 53 put q 32 3 54 put q 33 div add ulong 248320 255 256 55 put q 34 248320 56 put q 35 add base get lay 4 57 put q 36 add base get lay 5 58 put q 37 add base get lay 6 59 put q 38 add base get lay 7 60 put q 39 get m 2 61 put q 40 248320 62 put q 48 4 63 put q 49 div get lay 9 2048 64 put q 50 get lay 9 65 put q 51 add base get lay 6 66 put q 53 get m 6 67 put q 54 get m 7 68 put q 64 5 69 put q 65 1 70 put q 66 2048 71 put q 67 get m 6 72 put q 68 get m 7 73 put q 69 add base get lay 8 74 put q 70 add add base get lay 8 4 75 note Recheck retained candidates with the original BF16 weights and hidden values. 76 put q 80 6 77 put q 83 hidden 78 put q 84 add base get lay 7 79 put q 85 get m 5 80 put q 86 add base get lay 8 81 ret 6 82 end 83 note m[0]=1: info from folded weights. m[0]=2: six schedule descriptors. 84 note Schedule m[1..8]=vocab,norm bits,scratch,hidden,logits,argmax values,argmax indices,FP8 table. 85 fn q38_runtime m view ulong 16 bits view uchar 20480 q edit ulong 192 to ulong 86 if eq get m 0 2 87 ret q38_schedule m q 88 end 89 if and eq get m 0 3 eq get m 1 248320 90 for j ulong 192 91 put q j 0 92 end 93 q38_layout q 94 ret 1 95 end 96 if or ne get m 0 1 ne get m 1 248320 97 ret 0 98 end 99 wb = new uint 5120 0 100 for i ulong 5120 101 v = ulong 0 102 for j ulong 4 103 v = or v shl ulong get bits add mul i 4 j mul j 8 104 end 105 put wb i uint v 106 end 107 hn = q38_envelope wb 108 if eq hn 0 109 ret 0 110 end 111 for j ulong 192 112 put q j 0 113 end 114 q38_layout q 115 put q 0 hn 116 ret 1 117 end