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 / cache / validate.om

66 lines · 1824 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2note Runtime adapter reuses the sole-owner validator and fresh staged composer.
3note No caller may supply successful composer statistics or substitute code.
4note Callee scratch avoids the pinned compiler's sixteen-slot register ceiling.
5fn nv_record cfg view ulong 16 rec view uchar 4096 launch view uchar 4096 actual view ulong 8 to uint
6l = new ulong 32 0
7for i ulong 32
8put l i compose_word launch i
9end
10ret bc_record cfg rec l actual
11end
12fn nv_code ins view ulong 8192 phys view ulong 288 count ulong code view uchar 16384 bytes ulong to int
13fresh = new uchar 16384 0
14n = bc_encode ins phys count 1 fresh
15if or eq n 0 ne n bytes
16ret -14
17end
18for i ulong n
19if ne get fresh i get code i
20ret -14
21end
22end
23ret 0
24end
25fn nv_staged rec view uchar 4096 code view uchar 16384 launch view uchar 4096 bytes ulong to int
26cfg = new ulong 16 0
27ins = new ulong 8192 0
28meta = new ulong 2048 0
29phys = new ulong 288 0
30actual = new ulong 8 0
31if and ne compose_word launch 12 8 ne compose_word launch 12 12
32ret -14
33end
34put cfg 0 3
35put cfg 1 compose_word rec 6
36put cfg 2 div compose_word rec 16 32
37put cfg 3 compose_word rec 14
38put cfg 4 compose_word rec 17
39put cfg 5 div sub compose_word launch 12 8 4
40if ne bc_compose cfg ins meta phys actual 0
41ret -14
42end
43if ne nv_record cfg rec launch actual 0
44ret -14
45end
46ret nv_code ins phys get actual 0 code bytes
47end
48fn native_validate rec view uchar 4096 sizes view ulong 4 code view uchar 16384 launch view uchar 4096 expected view uchar 32 out edit uchar 32 to long
49key = new uchar 32 0
50for i ulong 32
51put out i 0
52end
53rc = kc_validate rec sizes code launch expected key
54if ne rc 0
55ret long rc
56end
57if eq compose_word rec 19 3
58if ne nv_staged rec code launch get sizes 1 0
59ret -14
60end
61end
62for i ulong 32
63put out i get key i
64end
65ret 0
66end