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_scalar.om
| 1 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | note Decode uses the kernel's raw rounding for nonfinite values, unlike gx_f2bf NaN quieting. |
| 3 | fn av_drnd u uint to uint |
| 4 | if gx_fin u |
| 5 | ret gx_f2bf u |
| 6 | end |
| 7 | ret shr add add u 32767 and shr u 16 1 16 |
| 8 | end |
| 9 | fn av_perm i uint r uint to uint |
| 10 | p = div r 2 |
| 11 | if lt i 128 |
| 12 | if lt i p |
| 13 | ret i |
| 14 | end |
| 15 | ret add r sub i p |
| 16 | end |
| 17 | j = sub i 128 |
| 18 | if lt j p |
| 19 | ret add p j |
| 20 | end |
| 21 | ret i |
| 22 | end |
| 23 | fn av_permf s view f32 256 d edit f32 256 r uint to ulong |
| 24 | for i ulong 256 |
| 25 | put d i get s ulong av_perm uint i r |
| 26 | end |
| 27 | ret 0 |
| 28 | end |
| 29 | fn av_permb s view ushort 256 d edit ushort 256 r uint to ulong |
| 30 | for i ulong 256 |
| 31 | put d i get s ulong av_perm uint i r |
| 32 | end |
| 33 | ret 0 |
| 34 | end |