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/attn-any/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 / attn-any / plan.om` 55 lines · 1245 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 2 note Shape: seq_q,seq_kv,head_dim,q_heads,kv_heads,causal,dtype,scale_bits. 3 note Plan: total Q/KV/O bytes, unused, per-head Q/KV/O byte offsets, rows, threads, mode. 4 note Refusal 1 is shape/format/size refusal, separate from bridge trap and allocation failure. 5 fn aa_plan s view ulong 8 head ulong p edit ulong 16 to ulong 6 for i ulong 16 7 put p i 0 8 end 9 for i ulong 5 10 if eq get s i 0 11 ret 1 12 end 13 end 14 if or gt get s 0 65535 gt get s 1 65535 15 ret 1 16 end 17 if or gt get s 2 256 gt get s 3 65535 18 ret 1 19 end 20 if gt get s 4 get s 3 21 ret 1 22 end 23 if ne rem get s 3 get s 4 0 24 ret 1 25 end 26 if or gt get s 5 1 gt get s 6 2 27 ret 1 28 end 29 if or ge head get s 3 gt get s 7 `4294967295` 30 ret 1 31 end 32 if eq and get s 7 `2139095040` `2139095040` 33 ret 1 34 end 35 bytes = ulong 4 36 if ne get s 6 0 37 bytes = ulong 2 38 end 39 qn = mul mul get s 0 get s 2 get s 3 40 kn = mul mul get s 1 get s 2 get s 4 41 if or gt qn `1073741824` gt kn `1073741824` 42 ret 1 43 end 44 put p 0 mul qn bytes 45 put p 1 mul kn bytes 46 put p 2 mul qn 4 47 put p 4 mul mul mul head get s 0 get s 2 bytes 48 kh = div head div get s 3 get s 4 49 put p 5 mul mul mul kh get s 1 get s 2 bytes 50 put p 6 mul mul mul head get s 0 get s 2 4 51 put p 7 get s 0 52 put p 8 32 53 put p 9 or get s 6 shl get s 5 8 54 ret 0 55 end