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 / apiviews / gdnpt.om
| 1 | om2 |
| 2 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 3 | note Pack reference tail [3][conv] into per-head slots of 384 by 4. |
| 4 | note Channel: s<128 q, s<256 k, else v. Slot 3 is 0. 384 is OMEGA_GDN_SLOTS. |
| 5 | note Unsized views take two parameter slots, so the loops stay in the export. |
| 6 | fn av_ch hh ulong ss ulong vh ulong to ulong |
| 7 | hk = div hh div vh 16 |
| 8 | if lt ss 128 |
| 9 | ret add mul hk 128 ss |
| 10 | end |
| 11 | if lt ss 256 |
| 12 | ret add 2048 add mul hk 128 sub ss 128 |
| 13 | end |
| 14 | ret add 4096 add mul hh 128 sub ss 256 |
| 15 | end |
| 16 | fn av_base hh ulong ss ulong to ulong |
| 17 | ret mul add mul hh 384 ss 4 |
| 18 | end |
| 19 | fn av_gdnpt tail view f32 * dst edit f32 * vh ulong conv ulong to ulong |
| 20 | if eq div vh 16 0 |
| 21 | ret 1 |
| 22 | end |
| 23 | if ne len dst mul mul vh 384 4 |
| 24 | ret 1 |
| 25 | end |
| 26 | if ne len tail mul conv 3 |
| 27 | ret 1 |
| 28 | end |
| 29 | for hh ulong vh |
| 30 | for ss ulong 384 |
| 31 | ch = av_ch hh ss vh |
| 32 | base = av_base hh ss |
| 33 | put dst base get tail ch |
| 34 | put dst add base 1 get tail add ch conv |
| 35 | put dst add base 2 get tail add ch mul conv 2 |
| 36 | put dst add base 3 0.0f32 |
| 37 | end |
| 38 | end |
| 39 | ret 0 |
| 40 | end |