interplane.Get Omega
Read in your language

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

branch main Branches Tags History

CUDApp / om / gemmex / policy.om

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