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 / codegen / cg_tern_common.om

57 lines · 878 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2note Exact public ternary spec policy, including the independent 16384-byte staging cap.
3fn omega_ct_valid k ulong l ulong r ulong w ulong d ulong em ulong to ulong
4if or eq k 0 gt k 16384
5ret 0
6end
7if ne rem k 256 0
8ret 0
9end
10n = div add k 8191 8192
11if ne rem k mul 256 n 0
12ret 0
13end
14if eq l 0
15if and ne r 1 and ne r 2 ne r 4
16ret 0
17end
18else
19if or ne l 1 and ne r 2 ne r 4
20ret 0
21end
22end
23if or eq w 0 gt w 32
24ret 0
25end
26if or eq d 0 gt d 16
27ret 0
28end
29if ne rem div div k n 256 d 0
30ret 0
31end
32if gt mul r d 16
33ret 0
34end
35if gt and em 4294967295 1
36ret 0
37end
38if and eq and em 4294967295 1 ne n 1
39ret 0
40end
41if gt shr em 32 6
42ret 0
43end
44ret 1
45end
46fn omega_ct_coal k ulong r ulong w ulong to ulong
47if ne div add k 8191 8192 1
48ret 0
49end
50if gt mul mul 2 r w 32
51ret 0
52end
53if gt add mul k 2 mul mul 16 r w 16384
54ret 0
55end
56ret 1
57end