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 / native / trace / htlaunch.om

92 lines · 2790 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2note Traced entry points for native/blackwell/launch.om. Compose after context.om (or a host
3note stand-in), vector.om, launch.om and native/trace/htrec.om. launch.om itself is not changed, so a
4note unit that does not include this file and htrec.om is byte-identical to before.
5note
6note htopen and htlaunch behave exactly like gbopen and gblaunch and return the same result. While
7note recording is off they make one flag test and call through. While it is on they record:
8note gpu.open span launch.om:gbopen a0 bytes allocated, a1 code bytes uploaded, status nverr
9note mem.alloc instants launch.om:gbmem a0 bytes, a1 buffer slot 0..7, status the handle sign
10note kernel.launch span VECTOR_1D a0 elements n, a1 last stage reached, status nverr
11note mem.moved instant launch.om:gbcmd a0 command bytes written to buffer 0, a1 direction 1
12note The launch span covers command build, upload, submission, the host wait for the completion
13note mark and the readback checks; launch.om has no hook between them, so the span records the last
14note stage reached (nvstage 40 build/upload, 41 submit, 42 host wait, 43 completion checks).
15note Name ids 101..106 are reserved for this file.
16text htlnames "launch.om:gbopen|kernel:VECTOR_1D/vector.om:gbvec|launch.om:gbmem|launch.om:gbcmd|launch.om:gbcode|host.readback"
17fn htlname to bool
18id = uint 101
19ok = htnbeg id
20for i ulong len htlnames
21b = get htlnames i
22if eq b 124
23ok = and ok htnend
24id = add id 1
25ok = and ok htnbeg id
26else
27ok = and ok htnbyte b
28end
29end
30ret and ok htnend
31end
32note htgbsz: the size launch.om gbopen requests for buffer i (launch.om lines 240-246). The host test
33note checks it against the sizes the stand-in nvalloc actually received.
34fn htgbsz i ulong n uint to ulong
35if ge i 5
36ret mul ulong n 4
37end
38if or eq i 0 eq i 2
39ret 65536
40end
41ret 4096
42end
43fn htopen n uint to bool
44if not htlive
45ret gbopen n
46end
47s = htbeg 3 101
48ok = gbopen n
49total = ulong 0
50for i ulong 8
51m = get gbmem i
52if and ok gt m 0
53sz = htgbsz i n
54total = add total sz
55b = htmark 5 103 sz i 0
56end
57end
58code = ulong 0
59rc = long 0
60if ok
61code = get gblen 0
62b = htmark 11 105 code 1 0
63else
64rc = get nverr 0
65end
66b = htend s total code rc
67ret ok
68end
69fn htlaunch n uint to bool
70if not htlive
71ret gblaunch n
72end
73note gblaunch writes nvstage 40 before any work; it is cleared here only to see whether that
74note happened, and restored when gblaunch refused its arguments first, so state matches gblaunch.
75prev = get nvstage 0
76put nvstage 0 0
77s = htbeg 4 102
78ok = gblaunch n
79st = ulong get nvstage 0
80if eq st 0
81put nvstage 0 prev
82end
83if ge st 41
84b = htmark 11 104 get gbused 0 1 0
85end
86rc = long 0
87if not ok
88rc = get nverr 0
89end
90b = htend s ulong n st rc
91ret ok
92end