interplane.Get Omega
Read in your language

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

branch main Branches Tags History

CUDApp / om / attention-mirror / plan.om

35 lines · 929 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2note Scoped 27B attention mirror plan. Zero bypasses, all-ones refuses, otherwise bytes.
3note The native layout has four heads, 512 bytes per row and 8256 bytes tail slack per plane.
4note Modes: 0 ordinary, 1 mirror all rows, 2 provisional adaptive threshold at 1024 rows.
5fn native_attnmirplan q view ulong 7 to ulong
6mode = get q 0
7qheads = get q 1
8kvheads = get q 2
9maxpos = get q 3
10pos = get q 4
11rows = get q 5
12plane = get q 6
13if or gt mode 2 or ne qheads 24 ne kvheads 4
14ret 18446744073709551615
15end
16if or eq maxpos 0 gt maxpos 131072
17ret 18446744073709551615
18end
19if or eq rows 0 gt rows 32768
20ret 18446744073709551615
21end
22if gt pos maxpos
23ret 18446744073709551615
24end
25if gt rows sub maxpos pos
26ret 18446744073709551615
27end
28if ne plane add mul maxpos 2048 8256
29ret 18446744073709551615
30end
31if or eq mode 0 and eq mode 2 lt rows 1024
32ret 0
33end
34ret mul plane 2
35end