tvm
Public Member Functions | Static Public Attributes | List of all members
tvm::runtime::profiling::MetricCollectorNode Class Referenceabstract

Interface for user defined profiling metric collection. More...

#include <profiling.h>

Inheritance diagram for tvm::runtime::profiling::MetricCollectorNode:
Collaboration diagram for tvm::runtime::profiling::MetricCollectorNode:

Public Member Functions

virtual void Init (Array< DeviceWrapper > devs)=0
 Initialization call. Called before profiling has started. Any expensive precomputation should happen here. More...
 
virtual ObjectRef Start (Device dev)=0
 Start colling metrics for a function call. More...
 
virtual Map< String, ffi::Any > Stop (ffi::ObjectRef obj)=0
 Stop collecting metrics. More...
 
virtual ~MetricCollectorNode ()
 
 TVM_DECLARE_BASE_OBJECT_INFO (MetricCollectorNode, Object)
 

Static Public Attributes

static constexpr const char * _type_key = "runtime.profiling.MetricCollector"
 

Detailed Description

Interface for user defined profiling metric collection.

Users can register their own collector by registering a packed function with the name "runtime.profiling.metrics.my_collector_name" where "my_collector_name" is the name of their collector. This function should take an Array of Device as input which contains the devices the collector will be run on.

MetricCollectorNodes will be called in the following fashion.

MetricCollector mc;
for (auto op : model) {
auto o = mc.Start();
op();
auto metrics = mc.Stop(o); // metrics are added the profiling report
}

Constructor & Destructor Documentation

◆ ~MetricCollectorNode()

virtual tvm::runtime::profiling::MetricCollectorNode::~MetricCollectorNode ( )
inlinevirtual

Member Function Documentation

◆ Init()

virtual void tvm::runtime::profiling::MetricCollectorNode::Init ( Array< DeviceWrapper devs)
pure virtual

Initialization call. Called before profiling has started. Any expensive precomputation should happen here.

Parameters
devsThe list of devices this collector will be run on.

◆ Start()

virtual ObjectRef tvm::runtime::profiling::MetricCollectorNode::Start ( Device  dev)
pure virtual

Start colling metrics for a function call.

Parameters
devThe device the call will be run on.
Returns
An object used to maintain state of the metric collection. This object will be passed to the corresponding Stop call. If the device is not supported, this function will return a nullptr ObjectRef.

◆ Stop()

virtual Map<String, ffi::Any> tvm::runtime::profiling::MetricCollectorNode::Stop ( ffi::ObjectRef  obj)
pure virtual

Stop collecting metrics.

Parameters
objThe object created by the corresponding Start call.
Returns
A set of metric names and the associated values. Values must be one of DurationNode, PercentNode, CountNode, or String.

◆ TVM_DECLARE_BASE_OBJECT_INFO()

tvm::runtime::profiling::MetricCollectorNode::TVM_DECLARE_BASE_OBJECT_INFO ( MetricCollectorNode  ,
Object   
)

Member Data Documentation

◆ _type_key

constexpr const char* tvm::runtime::profiling::MetricCollectorNode::_type_key = "runtime.profiling.MetricCollector"
staticconstexpr

The documentation for this class was generated from the following file: