ONE - On-device Neural Engine
|
#include <ExecutorBase.h>
Public Member Functions | |
ExecutorBase (std::unique_ptr< compiler::LoweredGraph > &&lowered_graph, backend::BackendContexts &&backend_contexts, const compiler::TensorRegistries &tensor_regs, const util::TracingCtx *tracing_ctx) | |
Construct a new ExecutorBase object. | |
virtual | ~ExecutorBase ()=default |
const ir::Graph & | graph () const final |
Returns graph object. | |
void | execute (const std::vector< backend::IPortableTensor * > &inputs, const std::vector< backend::IPortableTensor * > &outputs, const ExecutionOptions &options) override |
Execute with given input/output tensors. | |
uint32_t | inputSize () const override |
Get input size. | |
uint32_t | outputSize () const override |
Get output size. | |
const ir::OperandInfo & | inputInfo (uint32_t index) const override |
Get input info at index. | |
const ir::OperandInfo & | outputInfo (uint32_t index) const override |
Get output info at index. | |
ir::Layout | inputLayout (uint32_t index) const override |
Get input layout at index. | |
ir::Layout | outputLayout (uint32_t index) const override |
Get output layout at index. | |
void | setIndexedRanks (std::shared_ptr< ir::OperationIndexMap< int64_t > > ranks) final |
Set an ordering on operations. | |
virtual void | executeImpl (const ExecutionObservee &subject)=0 |
void | addObserver (std::unique_ptr< IExecutionObserver > ref) |
backend::BackendContexts & | getBackendContexts () |
const ExecutionOptions & | currentOptions () const override |
Return current execution configuration. | |
Public Member Functions inherited from onert::exec::IExecutor | |
IExecutor ()=default | |
Construct a new IExecutor object. | |
virtual | ~IExecutor ()=default |
Destroy the IExecutor object. | |
Protected Member Functions | |
bool | hasDynamicInput () |
Returns true if any input tensor is dynamic; false if all are static tensors. | |
Protected Attributes | |
ExecObservers | _observers |
std::shared_ptr< ir::OperationIndexMap< int64_t > > | _indexed_ranks |
std::unique_ptr< compiler::LoweredGraph > | _lowered_graph |
backend::BackendContexts | _backend_contexts |
const ir::Graph & | _graph |
std::vector< backend::builtin::IOTensor * > | _input_tensors |
std::vector< backend::builtin::IOTensor * > | _output_tensors |
std::mutex | _mutex |
const util::TracingCtx * | _tracing_ctx |
ExecutionOptions | _current_options |
Definition at line 40 of file ExecutorBase.h.
onert::exec::ExecutorBase::ExecutorBase | ( | std::unique_ptr< compiler::LoweredGraph > && | lowered_graph, |
backend::BackendContexts && | backend_contexts, | ||
const compiler::TensorRegistries & | tensor_regs, | ||
const util::TracingCtx * | tracing_ctx | ||
) |
Construct a new ExecutorBase object.
graph | Graph object |
tensor_builders | Tensor builders that are currently used |
Definition at line 27 of file ExecutorBase.cc.
References _graph, _input_tensors, _output_tensors, onert::ir::Graph::getInputs(), onert::compiler::TensorRegistries::getITensor(), and onert::ir::Graph::getOutputs().
|
virtualdefault |
|
inline |
Definition at line 89 of file ExecutorBase.h.
References _observers, and onert::exec::ExecObservers::add().
|
inlineoverridevirtual |
Return current execution configuration.
Implements onert::exec::IExecutor.
Definition at line 93 of file ExecutorBase.h.
References _current_options.
|
overridevirtual |
Execute with given input/output tensors.
Input and output tensors must be given.
[in] | inputs | Tensors that are passed as inputs |
[in] | outputs | Tensors that are passed as outputs |
[in] | options | Execution options |
Implements onert::exec::IExecutor.
Definition at line 48 of file ExecutorBase.cc.
References _current_options, _graph, _input_tensors, _mutex, _observers, _output_tensors, executeImpl(), onert::ir::Graph::getInputs(), onert::ir::Graph::getOutputs(), and onert::ir::OperandIndexSequence::size().
|
pure virtual |
Implemented in onert::exec::DataflowExecutor, onert::exec::LinearExecutor, and onert::exec::ParallelExecutor.
Referenced by execute().
|
inline |
|
inlinefinalvirtual |
Returns graph object.
Implements onert::exec::IExecutor.
Definition at line 54 of file ExecutorBase.h.
References _graph.
Referenced by TopologicalSortHelper.TopologicalSortHelper::add_edge(), and TopologicalSortHelper.TopologicalSortHelper::sort_util().
|
protected |
Returns true
if any input tensor is dynamic; false
if all are static tensors.
Definition at line 87 of file ExecutorBase.cc.
References _input_tensors.
Referenced by onert::exec::DataflowExecutor::executeImpl(), onert::exec::LinearExecutor::executeImpl(), and onert::exec::ParallelExecutor::executeImpl().
|
inlineoverridevirtual |
Get input info at index.
[in] | index | Index of input |
Implements onert::exec::IExecutor.
Definition at line 64 of file ExecutorBase.h.
References _input_tensors.
|
inlineoverridevirtual |
Get input layout at index.
[in] | index | Index of input |
Implements onert::exec::IExecutor.
Definition at line 74 of file ExecutorBase.h.
References _input_tensors.
|
inlineoverridevirtual |
Get input size.
Implements onert::exec::IExecutor.
Definition at line 60 of file ExecutorBase.h.
References _input_tensors.
|
inlineoverridevirtual |
Get output info at index.
[in] | index | Index of output |
Implements onert::exec::IExecutor.
Definition at line 69 of file ExecutorBase.h.
References _output_tensors.
|
inlineoverridevirtual |
Get output layout at index.
[in] | index | Index of output |
Implements onert::exec::IExecutor.
Definition at line 76 of file ExecutorBase.h.
References _output_tensors.
|
inlineoverridevirtual |
Get output size.
Implements onert::exec::IExecutor.
Definition at line 62 of file ExecutorBase.h.
References _output_tensors.
|
inlinefinalvirtual |
Set an ordering on operations.
[in] | ranks | The table encoding the ordering |
Implements onert::exec::IExecutor.
Definition at line 82 of file ExecutorBase.h.
References _indexed_ranks.
|
protected |
Definition at line 105 of file ExecutorBase.h.
Referenced by getBackendContexts().
|
protected |
It is set by execute() method only in thread-safe environment. It is used for non-primary executor call on builtin backend and accessed by entryExecutor's currentOptions() method.
TODO: Find better way to pass config to non-primary executor
Definition at line 118 of file ExecutorBase.h.
Referenced by currentOptions(), and execute().
|
protected |
Definition at line 106 of file ExecutorBase.h.
Referenced by onert::exec::DataflowExecutor::calculateRank(), execute(), onert::exec::DataflowExecutor::executeImpl(), onert::exec::LinearExecutor::executeImpl(), onert::exec::ParallelExecutor::executeImpl(), ExecutorBase(), and graph().
|
protected |
Definition at line 103 of file ExecutorBase.h.
Referenced by onert::exec::DataflowExecutor::calculateRank(), and setIndexedRanks().
|
protected |
Definition at line 107 of file ExecutorBase.h.
Referenced by execute(), ExecutorBase(), hasDynamicInput(), inputInfo(), inputLayout(), and inputSize().
|
protected |
Definition at line 104 of file ExecutorBase.h.
Referenced by onert::exec::DataflowExecutor::DataflowExecutor(), onert::exec::DataflowExecutor::executeImpl(), onert::exec::LinearExecutor::executeImpl(), and onert::exec::ParallelExecutor::executeImpl().
|
protected |
Definition at line 109 of file ExecutorBase.h.
Referenced by execute().
|
protected |
Definition at line 102 of file ExecutorBase.h.
Referenced by addObserver(), and execute().
|
protected |
Definition at line 108 of file ExecutorBase.h.
Referenced by execute(), ExecutorBase(), outputInfo(), outputLayout(), and outputSize().
|
protected |
Definition at line 110 of file ExecutorBase.h.
Referenced by onert::exec::DataflowExecutor::executeImpl(), onert::exec::LinearExecutor::executeImpl(), and onert::exec::ParallelExecutor::executeImpl().