taken by individual operators on demand. One can use the same
mechanism to do "always ON" measurements for any process running
PyTorch. It might be useful for gathering information about PyTorch
workloads running in a given process or across the entire set of
machines.
New callbacks for any operator invocation can be added with
"torch::addGlobalCallback". Hooks will be called with
"torch::RecordFunction" struct that describes invocation context (e.g.
name). If enabled, "RecordFunction::inputs()" contains arguments of
the function represented as "torch::IValue" variant type. Note, that
inputs logging is relatively expensive and thus has to be enabled
explicitly.
The operator callbacks also have access to
"c10::ThreadLocalDebugInfo::get()" interface that returns a pointer to
the struct holding the debug information. This debug information can
be set earlier by using "at::DebugInfoGuard" object. Debug information
is propagated through the forward (including async "fork" tasks) and