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 / tests / components / capacity-unit.om

108 lines · 1967 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2note Concatenate allocator,effect,check,project,rowpipe,staged,compose,then this host-only caller.
3note Refused emissions must not patch/control a nonexistent slot before their capacity error reaches the caller.
4fn cu_slots to int
5ins = new ulong 8192 99
6s = new ulong 64 0
7m = new ulong 2048 0
8args = new ulong 4 0
9put s 0 1024
10at = bc_branch ins s 0 false
11if or ne at 1024 ne get s 3 1
12ret 70
13end
14bc_patch ins at 0
15bc_tail ins at
16for j ulong 8192
17if ne get ins j 99
18ret 71
19end
20end
21note Check both final valid slot and very large rejected indices before multiplication.
22bc_patch ins 18446744073709551615 0
23bc_tail ins 18446744073709551615
24bc_patch ins 1023 1023
25if ne and get ins 8190 4294967295 0
26ret 72
27end
28bc_tail ins 1023
29if ne get ins 8190 shl ulong 1032192 32
30ret 73
31end
32for j ulong 4
33put args j j
34put m j 4
35end
36put m 2 2
37for j ulong 3
38put s 0 add j 1022
39if eq bc_mma ins s m args 0
40ret 74
41end
42if ne get s 0 add j 1022
43ret 75
44end
45end
46put s 0 1021
47put s 1 0
48put s 3 0
49if ne bc_mma ins s m args 0
50ret 76
51end
52if ne get s 0 1024
53ret 77
54end
55ret 0
56end
57fn cu_case cfg view ulong 16 expected uint to int
58ins = new ulong 8192 0
59meta = new ulong 2048 0
60phys = new ulong 288 0
61actual = new ulong 8 99
62rc = bc_compose cfg ins meta phys actual
63if ne rc expected
64ret 65
65end
66if ne rc 0
67for j ulong 8
68if ne get actual j 0
69ret 66
70end
71end
72end
73ret 0
74end
75fn main to int
76rc = cu_slots
77if ne rc 0
78ret rc
79end
80cfg = new ulong 16 0
81put cfg 0 3
82put cfg 1 1536
83put cfg 2 16
84put cfg 3 8
85put cfg 4 16
86note This legal U3 shape previously trapped103 during branch patching at saturated instruction capacity.
87rc = cu_case cfg 2
88if ne rc 0
89ret rc
90end
91note A legal nearby U2 shape must remain realizable with unchanged instruction effects.
92put cfg 1 2048
93rc = cu_case cfg 0
94if ne rc 0
95ret rc
96end
97put cfg 0 1
98put cfg 1 256
99put cfg 2 8
100put cfg 3 1
101put cfg 4 4
102rc = cu_case cfg 0
103if ne rc 0
104ret rc
105end
106put cfg 0 2
107ret cu_case cfg 0
108end