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 / blackwell / cpui.om
| 1 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | fn bw_imac sum uint a uint b uint to uint |
| 3 | ret uint and add ulong sum mul ulong a ulong b 4294967295 |
| 4 | end |
| 5 | fn bw_idot a view uint * b view uint * r ulong sh ulong to uint |
| 6 | nn = and sh 4294967295 |
| 7 | kk = shr sh 32 |
| 8 | ai = and mul div r nn kk 4294967295 |
| 9 | bi = rem r nn |
| 10 | sum = uint 0 |
| 11 | for p ulong 4294967295 |
| 12 | if ge p kk |
| 13 | ret sum |
| 14 | end |
| 15 | sum = bw_imac sum get a ai get b bi |
| 16 | ai = and add ai 1 4294967295 |
| 17 | bi = and add bi nn 4294967295 |
| 18 | end |
| 19 | ret sum |
| 20 | end |
| 21 | fn bw_cpui a view uint * b view uint * c edit uint * to int |
| 22 | nn = bw_dim len a len b len c |
| 23 | if eq nn 0 |
| 24 | ret -1 |
| 25 | end |
| 26 | kk = div len b nn |
| 27 | sh = or shl kk 32 nn |
| 28 | for t ulong 18446744073709551615 |
| 29 | if ge t len c |
| 30 | ret 0 |
| 31 | end |
| 32 | v = bw_idot view a view b t sh |
| 33 | put c and t 4294967295 v |
| 34 | end |
| 35 | ret 0 |
| 36 | end |