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 / artifact.om

76 lines · 2029 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2note Concatenate QuantSchema quant.om, Composer realize.om, and cache digest.om before this unit.
3note Portable storage remains omega_native_artifact export/admit. No second manifest or identity schema.
4note Cache key is SHA256 of Composer exact canonical used bytes, never structs or device addresses.
5note Caller owns immutable admitted bytes; session-resident handle policy is residency.om.
6note -1 invalid bounds, -10 canonical realization refusal, -11 code id, -12 launch id, -13 store key.
7fn kc_equal a view uchar 32 b view uchar 32 to bool
8for i ulong 32
9if ne get a i get b i
10ret false
11end
12end
13ret true
14end
15fn kc_key rec view uchar 4096 n ulong out edit uchar 32 to int
16if ne compose_check rec n 0
17ret -10
18end
19ret kc_sha rec n out
20end
21note sizes4 = canonical used bytes, encoded code used bytes, canonical relocatable launch used bytes, reserved0.
22note Validate every immutable payload on read; a filename or prior validation is not admission.
23fn kc_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 int
24hash = new uchar 32 0
25if or eq get sizes 1 0 gt get sizes 1 16384
26ret -1
27end
28if or eq get sizes 2 0 gt get sizes 2 4096
29ret -1
30end
31if ne get sizes 3 0
32ret -1
33end
34if ne compose_check rec get sizes 0 0
35ret -10
36end
37if ne compose_launchread rec launch get sizes 2 0
38ret -12
39end
40if ne kc_codesha code get sizes 1 hash 0
41ret -1
42end
43if not compose_codeid rec hash
44ret -11
45end
46if ne kc_sha launch get sizes 2 hash 0
47ret -1
48end
49if not compose_launchid rec hash
50ret -12
51end
52if ne kc_sha rec get sizes 0 hash 0
53ret -1
54end
55if not kc_equal hash expected
56ret -13
57end
58for i ulong 32
59put out i get hash i
60end
61ret 0
62end
63fn kc_request rec view uchar 4096 n ulong req edit ulong 16 to int
64hash = new uchar 32 0
65if ne kc_key rec n hash 0
66ret -10
67end
68for i ulong 4
69word = ulong 0
70for j ulong 8
71word = or word shl ulong get hash add mul i 8 j mul j 8
72end
73put req add 3 i word
74end
75ret 0
76end