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 / engine / fixture_rest.om

162 lines · 2352 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2note Extracted fixture arithmetic; unsigned operations preserve C modulo semantics.
3note Clock inputs are the uint64_t representations of timespec fields, including negative and overflow edges.
4note WolframLanguageEvaluator: {Quotient[2^64-1,10^9],Quotient[2^64-1,1000],Mod[2^64-1,10^9]} -> {18446744073,18446744073709551,709551615}.
5note Constants below are copied from the source fixture or evaluated in the lane evidence.
6fn fr_bool val bool to ulong
7if val
8ret 1
9end
10ret 0
11end
12
13fn fr_calc op ulong a ulong b ulong c ulong to ulong
14if eq op 0
15ret add mul a 1000000000 b
16end
17if eq op 1
18ret add mul a 1000 div b 1000000
19end
20if eq op 2
21ret add a b
22end
23if eq op 3
24ret sub a b
25end
26if eq op 4
27if gt a b
28ret a
29end
30ret b
31end
32if eq op 5
33ret and a 255
34end
35if eq op 6
36ret and xor a 255 255
37end
38if eq op 7
39ix = rem a 8
40if eq ix 0
41ret 4096
42end
43if eq ix 1
44ret 65536
45end
46if eq ix 2
47ret 1048576
48end
49if eq ix 3
50ret 4194304
51end
52if eq ix 4
53ret 16777216
54end
55if eq ix 5
56ret 33554432
57end
58ret 67108864
59end
60if eq op 8
61ret fr_bool eq rem a 2000 0
62end
63if eq op 9
64if ne a 0
65ret and add mul b 2 3 4294967295
66end
67ret 2
68end
69if eq op 10
70ret and mul sub a 1 128 4294967295
71end
72if eq op 11
73ret mul a 4
74end
75if eq op 12
76ret sub a 1
77end
78if eq op 13
79ret add add a b c
80end
81if eq op 14
82if ne a 0
83ret 1
84end
85ret 0
86end
87if eq op 15
88ret fr_bool eq a b
89end
90if eq op 16
91ret fr_bool and ne a 0 ne b 0
92end
93if eq op 17
94ret div a 1000000
95end
96if eq op 18
97ret and sub a 1 4294967295
98end
99if eq op 19
100if ne a 0
101ret 0
102end
103ret 4294967295
104end
105ret 18446744073709551615
106end
107
108fn fr_flush ix ulong va ulong to ulong
109if eq ix 0
110ret 537133066
111end
112if eq ix 4
113ret 2147483648
114end
115if eq ix 5
116ret 537198615
117end
118if eq ix 6
119ret and add va 16 4294967295
120end
121if eq ix 7
122ret shr add va 16 32
123end
124if eq ix 8
125ret 1179010630
126end
127if eq ix 10
128ret 1048577
129end
130ret 0
131end
132
133fn fr_scale val ulong kind uint to f64
134if eq kind 0
135ret div f64 val 1073741824.0
136end
137ret div f64 val 1048576.0
138end
139
140note Bounded NUL-terminated text matching. Input transport pads shorter source buffers to 512 bytes.
141fn fr_text buf view uchar 512 pat view uchar 32 n ulong to ulong
142if or eq n 0 gt n 32
143ret 0
144end
145for i ulong 512
146if eq get buf i 0
147ret 0
148end
149if le n sub ulong 512 i
150same = true
151for j ulong n
152if ne get buf add i j get pat j
153same = false
154end
155end
156if same
157ret 1
158end
159end
160end
161ret 0
162end