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_range.om
| 1 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | fn vc_range q view ulong 16 d edit uint * zz view ulong 4 to ulong |
| 3 | r = new ulong 16 0 |
| 4 | for j ulong 5 |
| 5 | put r j get q j |
| 6 | end |
| 7 | for jj ulong get zz 1 |
| 8 | i = add get zz 0 jj |
| 9 | put r 0 add get q 0 i |
| 10 | rc = api_at_plan 10 r |
| 11 | if ne rc 0 |
| 12 | ret rc |
| 13 | end |
| 14 | put d i uint get r 8 |
| 15 | put d add get zz 2 i uint get r 9 |
| 16 | end |
| 17 | ret 0 |
| 18 | end |
| 19 | fn av_range q view ulong 16 d edit uint * n ulong to ulong |
| 20 | zz = new ulong 4 0 |
| 21 | put zz 2 n |
| 22 | r = ulong 0 |
| 23 | for bb ulong add div n 1000000 1 |
| 24 | put zz 0 mul bb 1000000 |
| 25 | cnt = sub n get zz 0 |
| 26 | if gt cnt 1000000 |
| 27 | cnt = ulong 1000000 |
| 28 | end |
| 29 | put zz 1 cnt |
| 30 | rr = vc_range q d zz |
| 31 | if ne rr 0 |
| 32 | ret rr |
| 33 | end |
| 34 | end |
| 35 | ret r |
| 36 | end |