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 / codegen / cg_sentin.om
| 1 | om2 |
| 2 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 3 | note q={m,n,np,set-as-uint32,poison-f32-bits}; one last-real word per 16x8 output tile. |
| 4 | note Public view transports uint bits for the native OM2 integer ABI; equality remains private f32 equality. |
| 5 | fn st_last tile ulong width ulong lim ulong to ulong |
| 6 | x = add mul tile width sub width 1 |
| 7 | if ge x lim |
| 8 | ret sub lim 1 |
| 9 | end |
| 10 | ret x |
| 11 | end |
| 12 | fn st_one q view ulong 5 c edit uint * idx ulong to ulong |
| 13 | poison = uint get q 4 |
| 14 | if ne get q 3 0 |
| 15 | put c idx poison |
| 16 | ret ulong 1 |
| 17 | end |
| 18 | if eq bitcast f32 get c idx bitcast f32 poison |
| 19 | ret ulong 1 |
| 20 | end |
| 21 | ret ulong 0 |
| 22 | end |
| 23 | fn st_row q view ulong 5 c edit uint * ti ulong to ulong |
| 24 | row = st_last ti 16 get q 0 |
| 25 | count = ulong 0 |
| 26 | nt = div and add get q 1 7 4294967295 8 |
| 27 | for tj ulong nt |
| 28 | col = st_last tj 8 get q 1 |
| 29 | idx = add mul row get q 2 col |
| 30 | count = add count st_one q c idx |
| 31 | end |
| 32 | ret count |
| 33 | end |
| 34 | fn sentin q view ulong 5 c edit uint * to ulong |
| 35 | for i ulong 5 |
| 36 | if gt get q i 4294967295 |
| 37 | ret ulong 0 |
| 38 | end |
| 39 | end |
| 40 | if gt get q 1 get q 2 |
| 41 | ret ulong 0 |
| 42 | end |
| 43 | if lt len c mul get q 0 get q 2 |
| 44 | ret ulong 0 |
| 45 | end |
| 46 | if or eq get q 0 0 eq get q 1 0 |
| 47 | ret ulong 0 |
| 48 | end |
| 49 | count = ulong 0 |
| 50 | mt = div and add get q 0 15 4294967295 16 |
| 51 | for ti ulong mt |
| 52 | count = add count st_row q c ti |
| 53 | end |
| 54 | ret count |
| 55 | end |