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 / gemmex / policy.om
| 1 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | note Host policy only. Unsigned products preserve the C shell's modulo-64 arithmetic. |
| 3 | note op 0 min; 1 row index; 2 row stride; 3 packed rows; 4 contiguous conversion; |
| 4 | note 5 conversion element count; 6 conversion row byte offset. |
| 5 | note Index: a transpose, b leading dimension, c row, d column. |
| 6 | fn gemm_ex_policy op ulong a ulong b ulong c ulong d ulong to ulong |
| 7 | if eq op 0 |
| 8 | if lt a b |
| 9 | ret a |
| 10 | end |
| 11 | ret b |
| 12 | end |
| 13 | if eq op 1 |
| 14 | if ne a 0 |
| 15 | ret add mul d b c |
| 16 | end |
| 17 | ret add mul c b d |
| 18 | end |
| 19 | if eq op 2 |
| 20 | if ne a 0 |
| 21 | ret b |
| 22 | end |
| 23 | ret 1 |
| 24 | end |
| 25 | if eq op 3 |
| 26 | w = mul b c |
| 27 | if gt d c |
| 28 | w = mul b d |
| 29 | end |
| 30 | if and ne a 5 ne a 6 |
| 31 | if le w 65536 |
| 32 | ret div 65536 w |
| 33 | end |
| 34 | end |
| 35 | ret 1 |
| 36 | end |
| 37 | if eq op 4 |
| 38 | if or eq a 1 eq b mul c d |
| 39 | ret 1 |
| 40 | end |
| 41 | ret 0 |
| 42 | end |
| 43 | if eq op 5 |
| 44 | ret mul a b |
| 45 | end |
| 46 | if eq op 6 |
| 47 | ret mul mul a b c |
| 48 | end |
| 49 | if eq op 7 |
| 50 | if ne a 0 |
| 51 | ret 1 |
| 52 | end |
| 53 | ret b |
| 54 | end |
| 55 | ret 0 |
| 56 | end |