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 / host-trace / overhead.om

52 lines · 1267 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2note Overhead driver for the host trace recorder. Compose after one arm file:
3note overhead-absent.om calls gbopen/gblaunch directly (no recorder in the unit)
4note overhead-traced.om calls htopen/htlaunch; argument "on" starts the recorder, "off" never does
5note Each sample times OHLAUNCH back-to-back launches of OHN elements on the host stand-in
6note (tests/host-trace/fakenv.om, fakedev.om) and prints the elapsed host CLOCK_MONOTONIC ns, one
7note line per sample. No device is opened. Exit 1 if any launch fails.
8const OHSAMP ulong 30
9const OHLAUNCH ulong 1000
10const OHN uint 64
11global ohline uchar 32
12fn ohprint v ulong to void
13n = ulong 0
14x = v
15while true bound 24
16put ohline n uchar add 48 rem x 10
17n = add n 1
18x = div x 10
19if eq x 0
20break
21end
22end
23for i ulong div n 2
24a = get ohline i
25put ohline i get ohline sub sub n i 1
26put ohline sub sub n i 1 a
27end
28put ohline n 10
29w = write 1 ohline 0 add n 1
30end
31fn main to int
32on = false
33if eq argcnt 2
34k = argread 1 ohline 0 8
35on = and eq k 2 eq get ohline 1 110
36end
37if not armopen OHN on
38ret 1
39end
40for s ulong OHSAMP
41armreset on
42t0 = ulong monons
43for i ulong OHLAUNCH
44if not armgo OHN
45ret 1
46end
47end
48t1 = ulong monons
49ohprint sub t1 t0
50end
51ret 0
52end