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