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