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 / api / attn_host.om
| 1 | om2 |
| 2 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 3 | note q inputs rows, query heads, head dim, rows per launch, max blocks, has ids. |
| 4 | note q 10 is row cursor; q 11..22 describe one existing launch without new admission policy. |
| 5 | fn ah_plan q edit ulong 32 op uint to ulong |
| 6 | if eq op 0 |
| 7 | v = and add uint get q 2 31 4294967264 |
| 8 | put q 8 ulong v |
| 9 | put q 9 ulong mul v 16 |
| 10 | ret 0 |
| 11 | end |
| 12 | if eq op 1 |
| 13 | put q 8 mul get q 1 get q 2 |
| 14 | idw = ulong 1 |
| 15 | if ne get q 5 0 |
| 16 | idw = mul get q 3 get q 4 |
| 17 | end |
| 18 | put q 9 add add mul get q 3 4 get q 1 idw |
| 19 | put q 10 0 |
| 20 | ret 0 |
| 21 | end |
| 22 | if eq op 3 |
| 23 | put q 10 get q 22 |
| 24 | ret 0 |
| 25 | end |
| 26 | if ge get q 10 get q 0 |
| 27 | ret 0 |
| 28 | end |
| 29 | nr = sub get q 0 get q 10 |
| 30 | if gt nr get q 3 |
| 31 | nr = get q 3 |
| 32 | end |
| 33 | put q 11 nr |
| 34 | put q 12 and mul nr 4 4294967295 |
| 35 | put q 13 and add mul nr 4 get q 1 4294967295 |
| 36 | words = ulong 1 |
| 37 | if ne get q 5 0 |
| 38 | words = mul nr get q 4 |
| 39 | end |
| 40 | put q 14 add get q 13 words |
| 41 | put q 15 mul get q 10 get q 8 |
| 42 | put q 16 mul mul nr get q 8 4 |
| 43 | put q 17 mul get q 14 4 |
| 44 | put q 18 mul get q 10 get q 4 |
| 45 | put q 19 mul mul nr get q 4 4 |
| 46 | put q 20 mul get q 1 4 |
| 47 | put q 21 ulong mul uint get q 12 4 |
| 48 | put q 22 add get q 10 get q 3 |
| 49 | ret 1 |
| 50 | end |