ONE - On-device Neural Engine
Loading...
Searching...
No Matches
onert::exec::ProfileObserver Class Reference

#include <ExecutionObservers.h>

Collaboration diagram for onert::exec::ProfileObserver:

Public Member Functions

 ProfileObserver (std::shared_ptr< ExecTime > et, const ir::Graph &graph)
 
void handleJobBegin (IExecutor *, ir::SubgraphIndex, ir::OperationIndex, const backend::Backend *) override
 
void handleJobEnd (IExecutor *, ir::SubgraphIndex, ir::OperationIndex, const backend::Backend *) override
 
void handleSubgraphEnd (ir::SubgraphIndex) override
 Invoked just after model (not individual operation) execution ends.
 
ObserverType type () const override
 
- Public Member Functions inherited from onert::exec::IExecutionObserver
virtual void handleSubgraphBegin (ir::SubgraphIndex)
 Invoked just before model (not individual operation) execution begins.
 
virtual ~IExecutionObserver ()=default
 

Detailed Description

Definition at line 82 of file ExecutionObservers.h.

Constructor & Destructor Documentation

◆ ProfileObserver()

onert::exec::ProfileObserver::ProfileObserver ( std::shared_ptr< ExecTime et,
const ir::Graph graph 
)
inlineexplicit

Definition at line 85 of file ExecutionObservers.h.

86 : _et(std::move(et)), _graph(graph)
87 {
88 }

Member Function Documentation

◆ handleJobBegin()

void onert::exec::ProfileObserver::handleJobBegin ( IExecutor ,
ir::SubgraphIndex  ,
ir::OperationIndex  ,
const backend::Backend backend 
)
overridevirtual

Implements onert::exec::IExecutionObserver.

Definition at line 76 of file ExecutionObservers.cc.

78{
79 _timer = backend->config()->timer();
80 if (_timer == nullptr)
81 throw std::runtime_error("To profile backend timer() method must be implemented");
82 _timer->handleBegin();
83}

References onert::backend::Backend::config().

◆ handleJobEnd()

void onert::exec::ProfileObserver::handleJobEnd ( IExecutor exec,
ir::SubgraphIndex  ,
ir::OperationIndex  op_ind,
const backend::Backend backend 
)
overridevirtual

Implements onert::exec::IExecutionObserver.

Definition at line 85 of file ExecutionObservers.cc.

87{
88 _timer->handleEnd();
89 const auto timer_res = _timer->getTime();
90
91 // NOTE This assumes there is just one operation in a op
92 const auto &node = _graph.operations().at(op_ind);
93 auto node_name = node.name();
94 VERBOSE(ProfileInfo) << "Time for " << node_name << " : " << timer_res << std::endl;
95
96 // fill ExecTime:
97 bool is_quantized = exec->graph().operands().at(node.getInputs().at(0)).typeInfo().type() ==
98 ir::DataType::QUANT_UINT8_ASYMM;
99
100 uint32_t size = 0;
101 for (const auto &ind : (node.getInputs() + node.getOutputs()) | ir::Remove::UNDEFINED)
102 {
103 size += exec->graph().operands().at(ind).info().total_size();
104 }
105 if (node_name == "Permute")
106 {
107 // TODO Change it to updateOperationExecTime()
108 _et->updatePermuteTime(backend, backend, is_quantized, size, timer_res);
109 }
110 else
111 {
112 _et->updateOperationExecTime(backend, node_name, is_quantized, size, timer_res);
113 }
114};
const Operations & operations() const override
Definition Graph.h:114
const Object & at(const Index &index) const
Get the object that is associated with the given index.
#define VERBOSE(name, lv)
Definition Log.h:71
bool is_quantized(const CircleNode *node)
int32_t size[5]
Definition Slice.cpp:35

References onert::util::ObjectManager< Index, Object >::at(), onert::exec::IExecutor::graph(), onert::ir::Graph::operands(), onert::ir::Graph::operations(), size, Operand::type, onert::ir::UNDEFINED, and VERBOSE.

◆ handleSubgraphEnd()

void onert::exec::ProfileObserver::handleSubgraphEnd ( ir::SubgraphIndex  )
inlineoverridevirtual

Invoked just after model (not individual operation) execution ends.

Reimplemented from onert::exec::IExecutionObserver.

Definition at line 94 of file ExecutionObservers.h.

94{ _et->storeOperationsExecTime(); }

◆ type()

ObserverType onert::exec::ProfileObserver::type ( ) const
inlineoverridevirtual

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