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 / components / artifact_policy.om

85 lines · 1767 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2note Pure QMD prefix policy from CUDApp b774723, little-endian packed words.
3note Byte views preserve uint32 alignment without copying the QMD.
4fn art_word q view uchar 256 i ulong to ulong
5j = mul i 4
6lo = or ulong get q j shl ulong get q add j 1 8
7hi = or ulong get q add j 2 shl ulong get q add j 3 8
8ret or lo shl hi 16
9end
10fn art_template q0 view uchar 256 q1 view uchar 256 to ulong
11if ne art_word q0 12 0
12ret 0
13end
14if or ne art_word q1 12 0 or ne art_word q1 15 0 ne art_word q1 16 0
15ret 0
16end
17if or ne art_word q1 32 0 ne and art_word q1 33 xor 4294967295 shl ulong 10 21 0
18ret 0
19end
20if or ne art_word q1 42 0 ne and art_word q1 43 524287 0
21ret 0
22end
23if or ne art_word q1 44 0 ne and art_word q1 45 524287 0
24ret 0
25end
26if or ne art_word q1 52 12 ne and art_word q1 53 524287 0
27ret 0
28end
29if or ne art_word q1 56 0 or ne and art_word q1 57 524287 0 ne art_word q1 59 0
30ret 0
31end
32ret 1
33end
34fn art_launch q1 view uchar 256 s view ulong 7 to ulong
35wg = get s 6
36if lt wg 16
37wg = 16
38end
39ws = ulong 8
40if ne get s 5 0
41ws = div and add get s 5 127 4294967295 128
42end
43for i ulong 5
44if eq get s i 0
45ret 0
46end
47end
48if or gt get s 2 65535 gt get s 3 65535
49ret 0
50end
51if or gt get s 4 255 or gt wg 511 gt ws 2047
52ret 0
53end
54if ne art_word q1 34 or get s 2 shl get s 3 16
55ret 0
56end
57if ne and art_word q1 35 255 get s 4
58ret 0
59end
60if ne and shr art_word q1 35 8 511 wg
61ret 0
62end
63if ne and art_word q1 36 2047 ws
64ret 0
65end
66if ne art_word q1 39 get s 0
67ret 0
68end
69if ne art_word q1 40 get s 1
70ret 0
71end
72if ne art_word q1 41 1
73ret 0
74end
75ret 1
76end
77fn artifact_policy mode ulong q0 view uchar 256 q1 view uchar 256 s view ulong 7 to ulong
78if eq mode 0
79ret art_template q0 q1
80end
81if eq mode 1
82ret art_launch q1 s
83end
84ret 0
85end