Expand description
Opt-in per-(OpKind, BackendId) host-time accounting for kernel launches
(execute_compiled_with_wait_hint). Off by default (one relaxed atomic load
per launch). What it measures: wall time of the kernel call on the HOST. A
kernel that only enqueues work (Vulkan batches into a command buffer, CUDA
launches on a stream) is charged its enqueue cost, NOT its device time; a
kernel that blocks (CPU math, a host-to-device upload, a forced flush) is
charged all of it. Device time lands wherever the realize finally waits, so
compare the per-op sum with the caller’s own wall clock around a step.
Structs§
- Launch
Row - One kernel launch, in launch order (see
set_trace). - Phase
Timer - Times a named phase of a realize from
startuntil it is dropped, when accounting is on (a no-op otherwise: one relaxed atomic load). Phases are hierarchical by NAME only: an outer phase’s time includes the inner ones nested inside it, so rows oftake_phasesare not additive.
Functions§
- enabled
- Whether accounting (or tracing) is on.
- set_
enabled - Turn accounting on or off. Does not clear what was recorded.
- set_
trace - Also keep every launch as a
LaunchRow, in order (implies the accounting path). For a one-step anatomy, not for long runs: one row per launch. Does not clear what was recorded. - take
- Drain the totals:
(op, backend, launches, total host time), longest first. - take_
phases - Drain the phase totals:
(phase, entries, total time), longest first. - take_
trace - Drain the launch trace.