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 / components / cm_prediction.om
| 1 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | note Quiet mean/sd/dof/n[0:4], pressure[4], residual present[5], mean/sd/dof/n[6:10]. |
| 3 | note Scale[10], core[11], power by core[12:15]. Output mean/sd/dof/n/known/borrowed/energy[16:23]. |
| 4 | fn cm_prediction words edit ulong 32 to ulong |
| 5 | mean = bitcast f64 get words 0 |
| 6 | sd = bitcast f64 get words 1 |
| 7 | dof = bitcast f64 get words 2 |
| 8 | n = get words 3 |
| 9 | put words 20 ulong 0 |
| 10 | put words 21 ulong 0 |
| 11 | if eq get words 4 0 |
| 12 | put words 20 ulong 1 |
| 13 | else |
| 14 | if ne get words 5 0 |
| 15 | mean = add mean bitcast f64 get words 6 |
| 16 | rsd = bitcast f64 get words 7 |
| 17 | sd = bitcast f64 cm_sqrt bitcast ulong add mul sd sd mul rsd rsd |
| 18 | rdof = bitcast f64 get words 8 |
| 19 | if lt rdof dof |
| 20 | dof = rdof |
| 21 | end |
| 22 | n = get words 9 |
| 23 | put words 20 ulong 1 |
| 24 | else |
| 25 | sd = bitcast f64 cm_sqrt bitcast ulong add mul sd sd f64 1.0 |
| 26 | put words 21 ulong 1 |
| 27 | end |
| 28 | end |
| 29 | scale = bitcast f64 get words 10 |
| 30 | if not ge scale f64 1.0 |
| 31 | scale = f64 1.0 |
| 32 | end |
| 33 | put words 16 bitcast ulong mean |
| 34 | put words 17 bitcast ulong mul sd scale |
| 35 | put words 18 bitcast ulong dof |
| 36 | put words 19 and n 4294967295 |
| 37 | core = get words 11 |
| 38 | if ge core 3 |
| 39 | core = ulong 2 |
| 40 | end |
| 41 | mw = bitcast f64 get words add 12 core |
| 42 | put words 22 ulong 0 |
| 43 | if gt mw f64 0.0 |
| 44 | cost = bitcast f64 cm_exp bitcast ulong mean true |
| 45 | energy = mul mul cost mw bitcast f64 ulong 4562254508917369340 |
| 46 | put words 22 bitcast ulong energy |
| 47 | end |
| 48 | ret 0 |
| 49 | end |