Skip to content
class

OpEvent

OpEvent

Record of a single op execution captured by OpScope.

Each event is a snapshot of one dispatched op: its name, the device and dtype it ran on, the output shape, the wall-clock duration, the net memory delta, and an optional FLOP estimate. Profilers store vectors of these records and expose them to the Python layer for trace export (Chrome / Perfetto) and aggregated summaries.

Attributes

namestd::string
Op name as recorded at OpScope construction (typically the schema name, e.g. "matmul", "conv2d").
deviceDevice
Device on which the op executed.
dtypeDtype
Element dtype of the output tensor at OpScope construction time.
shapeShape
Output tensor shape at OpScope construction time.
time_nsint64_t
Wall-clock duration from OpScope construction to destruction, in nanoseconds.
memory_delta_bytesint64_t
Change in MemoryTracker::current_bytes for device across the scope. May be negative when the op frees more memory than it allocates (e.g. in-place ops releasing temporaries).
flopsint64_t
Estimated floating-point operation count, populated by OpScope::set_flops. Defaults to 0 when the op does not report a count.
backwardbool
Whether the event is backward work — a whole backward pass ("backward") or one node of it, named after the node ("MulBackward") — rather than a dispatched op.

Notes

All fields are owned by value; the struct is freely copyable and suitable for return from Profiler::events.