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_count.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_count s view uint * q view ulong 4 v uint to ulong |
| 5 | r = ulong 0 |
| 6 | for zzj ulong get q 1 |
| 7 | i = add get q 0 zzj |
| 8 | if eq get s i v |
| 9 | r = add r 1 |
| 10 | end |
| 11 | end |
| 12 | ret r |
| 13 | end |
| 14 | |
| 15 | fn av_count s view uint * n ulong v uint to ulong |
| 16 | q = new ulong 4 0 |
| 17 | r = ulong 0 |
| 18 | for zzb ulong add div n 1000000 1 |
| 19 | put q 0 mul zzb 1000000 |
| 20 | zzn = sub n get q 0 |
| 21 | if gt zzn 1000000 |
| 22 | zzn = ulong 1000000 |
| 23 | end |
| 24 | put q 1 zzn |
| 25 | rr = vc_count s q v |
| 26 | r = add r rr |
| 27 | end |
| 28 | ret r |
| 29 | end |