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 / core / canonical.om

223 lines · 3806 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2note Copyright 2026 Drake Stapleton
3note Bootstrap LP64 OmegaObject byte view; ABI asserted by the C memory shell.
4fn crd b view uchar 25972 p ulong n ulong to ulong
5x = ulong 0
6for i ulong n
7x = or x shl ulong ulong get b add p i mul i 8
8end
9ret x
10end
11fn ccmp b view uchar 25972 p ulong q ulong n ulong to long
12for i ulong n
13x = long ulong get b add p i
14y = long ulong get b add q i
15if ne x y
16ret sub x y
17end
18end
19ret 0
20end
21fn cstrlen b view uchar 25972 p ulong to ulong
22n = ulong 0
23while ne ulong get b add p n 0 bound 25972
24n = add n 1
25end
26ret n
27end
28fn cless b view uchar 25972 p ulong q ulong mode ulong to bool
29if eq mode 0
30n = cstrlen b p
31m = cstrlen b q
32if lt m n
33n = m
34end
35c = ccmp b p q n
36if ne c 0
37ret lt c 0
38end
39ret lt cstrlen b p cstrlen b q
40end
41x = crd b p 2
42y = crd b q 2
43if ne x y
44ret lt x y
45end
46if eq mode 1
47ret lt ccmp b add p 2 add q 2 32 0
48end
49x = crd b add p 2 2
50y = crd b add q 2 2
51n = x
52if lt y n
53n = y
54end
55c = ccmp b add p 4 add q 4 n
56if ne c 0
57ret lt c 0
58end
59ret lt x y
60end
61fn csort b view uchar 25972 idx edit ulong 64 cfg view ulong 4 to void
62n = get cfg 0
63base = get cfg 1
64step = get cfg 2
65for i ulong n
66v = add base mul i step
67j = i
68while gt j 0 bound 64
69if not cless b v get idx sub j 1 get cfg 3
70break
71end
72put idx j get idx sub j 1
73j = sub j 1
74end
75put idx j v
76end
77end
78fn cbe o edit uchar 32768 p ulong x ulong n ulong to void
79for i ulong n
80put o add p i uchar and shr x mul sub sub n i 1 8 255
81end
82end
83fn ccopy b view uchar 25972 o edit uchar 32768 p ulong q ulong n ulong to void
84for i ulong n
85put o add p i uchar ulong get b add q i
86end
87end
88fn celem b view uchar 25972 o edit uchar 32768 cap ulong mode ulong pos ulong p ulong to ulong
89if eq mode 0
90k = cstrlen b p
91v = crd b add p 576 2
92if or gt k 255 gt add pos add 3 add k v cap
93ret 65536
94end
95put o pos uchar k
96ccopy b o add pos 1 p k
97pos = add pos add k 1
98cbe o pos v 2
99ccopy b o add pos 2 add p 64 v
100pos = add pos add v 2
101else
102if eq mode 1
103if gt add pos 34 cap
104ret 65536
105end
106cbe o pos crd b p 2 2
107ccopy b o add pos 2 add p 2 32
108pos = add pos 34
109else
110v = crd b add p 2 2
111if gt add pos add v 4 cap
112ret 65536
113end
114cbe o pos crd b p 2 2
115cbe o add pos 2 v 2
116ccopy b o add pos 4 add p 4 v
117pos = add pos add v 4
118end
119end
120ret pos
121end
122fn cgroup b view uchar 25972 o edit uchar 32768 cap ulong cfg view ulong 4 pos ulong to ulong
123idx = new ulong 64 0
124csort b idx cfg
125n = get cfg 0
126mode = get cfg 3
127if gt add pos 2 cap
128ret 65536
129end
130cbe o pos n 2
131pos = add pos 2
132for i ulong n
133p = get idx i
134pos = celem b o cap mode pos p
135if eq pos 65536
136ret pos
137end
138end
139ret pos
140end
141fn canon b view uchar 25972 o edit uchar 32768 cap ulong to ulong
142kind = crd b 36 4
143if lt cap 6
144ret 65536
145end
146put o 0 uchar 79
147put o 1 uchar 77
148put o 2 uchar 71
149put o 3 uchar 48
150put o 4 uchar 1
151if eq kind 8
152put o 4 uchar 2
153end
154put o 5 uchar kind
155cfg = new ulong 4 0
156n = crd b 40 2
157if gt n 32
158ret 65536
159end
160put cfg 0 n
161put cfg 1 42
162put cfg 2 578
163pos = cgroup b o cap cfg 6
164if eq pos 65536
165ret pos
166end
167n = crd b 18538 2
168if gt n 64
169ret 65536
170end
171put cfg 0 n
172put cfg 1 18540
173put cfg 2 34
174put cfg 3 1
175pos = cgroup b o cap cfg pos
176if eq pos 65536
177ret pos
178end
179n = crd b 20716 2
180if gt n 32
181ret 65536
182end
183put cfg 0 n
184put cfg 1 20718
185put cfg 2 132
186put cfg 3 2
187pos = cgroup b o cap cfg pos
188if eq pos 65536
189ret pos
190end
191n = crd b 24944 4
192if gt add pos add n 4 cap
193ret 65536
194end
195cbe o pos n 4
196ccopy b o add pos 4 24948 n
197ret add pos add n 4
198end
199fn cidcmp a view uchar 32 b view uchar 32 to long
200for i ulong 32
201x = long ulong get a i
202y = long ulong get b i
203if ne x y
204ret sub x y
205end
206end
207ret 0
208end
209fn cidhex a view uchar 32 b edit uchar 65 to void
210for i ulong 64
211v = ulong get a shr i 1
212if eq and i 1 0
213v = shr v 4
214end
215v = and v 15
216if lt v 10
217put b i uchar add v 48
218else
219put b i uchar add v 87
220end
221end
222put b 64 uchar 0
223end