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_bffin.om
| 1 | om2 |
| 2 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 3 | note Inner traversal blocks preserve the checked one-million-iteration guard. |
| 4 | fn vc_bffin s view ushort * q view ulong 4 to ulong |
| 5 | for zzj ulong get q 1 |
| 6 | i = add get q 0 zzj |
| 7 | if eq and get s i 32640 32640 |
| 8 | ret add i 1 |
| 9 | end |
| 10 | end |
| 11 | ret 0 |
| 12 | end |
| 13 | |
| 14 | fn av_bffin s view ushort * n ulong to ulong |
| 15 | q = new ulong 4 0 |
| 16 | r = ulong 0 |
| 17 | for zzb ulong add div n 1000000 1 |
| 18 | put q 0 mul zzb 1000000 |
| 19 | zzn = sub n get q 0 |
| 20 | if gt zzn 1000000 |
| 21 | zzn = ulong 1000000 |
| 22 | end |
| 23 | put q 1 zzn |
| 24 | rr = vc_bffin s q |
| 25 | if ne rr 0 |
| 26 | ret rr |
| 27 | end |
| 28 | end |
| 29 | ret r |
| 30 | end |