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

Namespaces

namespace  feature
 
namespace  train
 

Data Structures

class  DataflowExecutor
 
class  DynamicShapeInferer
 Class to infer shape of output tensor at execution time and allocate memory fo output tensor if needed. More...
 
class  EdgeTensor
 
class  ExecObservers
 
class  ExecTime
 
class  Execution
 Class to define execution instance to collect input/output information for inference and prepare executor run (TODO) More...
 
struct  ExecutionContext
 
class  ExecutionObservee
 Class that. More...
 
struct  ExecutionOptions
 
class  ExecutorBase
 
class  FunctionSequence
 
class  HookFunction
 
class  IExecutionObserver
 
struct  IExecutor
 Struct to define interface of Executor. More...
 
class  IExecutors
 Class to gather NN package's executor set. More...
 
class  IFunction
 
struct  InputDesc
 
struct  IODescription
 
struct  IOMinMaxHash
 
class  IPermuteFunction
 
class  Job
 
class  JSON
 
class  LinearExecutor
 Class to handle execution phase. Simple run the sequence of operations that is sorted in topological order. More...
 
class  MinMaxRecorder
 
class  MultiModelExecutors
 Class to gather executors. More...
 
class  NopFunction
 A derivative of IFunction tha does nothing. More...
 
struct  OpMinMaxHash
 
struct  OutputDesc
 
class  ParallelExecutor
 Class to execute Graph in parallel. More...
 
class  ParallelScheduler
 
class  PermuteLayer
 
class  ProfileObserver
 
class  RawMinMaxDumper
 
class  SingleModelExecutors
 Class to gather executor set for single model NN package. More...
 
class  ThreadPool
 
class  TracingObserver
 
class  WorkQueue
 

Typedefs

using OpMinMaxMap = util::MinMaxMap< std::pair< ir::SubgraphIndex, ir::OperationIndex >, OpMinMaxHash >
 
using IOMinMaxMap = util::MinMaxMap< std::pair< ir::SubgraphIndex, ir::IOIndex >, IOMinMaxHash >
 
using BackendSet = util::Set< const backend::Backend * >
 
using MeasurementData = std::unordered_map< const backend::Backend *, std::unordered_map< std::string, std::unordered_map< bool, std::map< uint32_t, int64_t > > > >
 table, that contains execution time of an operation on some backend for different input sizes and transfer time from one backend to another for various input sizes (permutation time)
 

Enumerations

enum class  ObserverType { PROFILE , TRACING , MINMAX_DUMP }
 

Functions

void UpdateOffsets (::onert::backend::ITensor *src, ::onert::backend::ITensor *dst, const ::onert::ir::Shape &loop_shape, std::vector< size_t > &src_offsets, std::vector< size_t > &dst_offsets)
 
void CopyStatic (const uint8_t *src_buffer, uint8_t *dst_buffer, const std::vector< size_t > &src_offsets, const std::vector< size_t > &dst_offsets, size_t copy_len)
 
void CopyDynamic (const ::onert::backend::ITensor *src, const ::onert::backend::ITensor *dst, uint8_t *dst_buffer, const ::onert::ir::Shape &loop_shape, size_t copy_len)
 
void readString (std::string &str, std::ifstream &stream)
 Helper function for reading string from stream.
 
void readBool (bool &quant, std::ifstream &stream)
 Helper function for reading bool from stream.
 
void printString (const std::string &str, std::ofstream &stream)
 
void printBool (bool quant, std::ofstream &stream)
 
std::pair< float, float > minmaxFrom (const backend::ITensor *tensor)
 

Typedef Documentation

◆ BackendSet

Definition at line 35 of file BackendSet.h.

◆ IOMinMaxMap

Definition at line 56 of file MinMaxMap.h.

◆ MeasurementData

using onert::exec::MeasurementData = typedef std::unordered_map< const backend::Backend *, std::unordered_map<std::string, std::unordered_map<bool, std::map<uint32_t, int64_t> >> >

table, that contains execution time of an operation on some backend for different input sizes and transfer time from one backend to another for various input sizes (permutation time)

          backend ->  op ->  quant->  size   --> time

_measurements[Backend*]["string"][bool][uint32_t] = int64_t

Definition at line 39 of file JSONExecTime.h.

◆ OpMinMaxMap

Definition at line 47 of file MinMaxMap.h.

Enumeration Type Documentation

◆ ObserverType

enum class onert::exec::ObserverType
strong
Enumerator
PROFILE 
TRACING 
MINMAX_DUMP 

Definition at line 36 of file ExecutionObservers.h.

Function Documentation

◆ CopyDynamic()

void onert::exec::CopyDynamic ( const ::onert::backend::ITensor src,
const ::onert::backend::ITensor dst,
uint8_t *  dst_buffer,
const ::onert::ir::Shape loop_shape,
size_t  copy_len 
)
inline

Definition at line 58 of file IPermuteFunction.h.

60{
61 ShapeLoop(loop_shape, [&](const onert::ir::Coordinates &coords) {
62 // Copy src tensor's data to dst_buffer with calculated offset of dst tensor
63 memcpy(dst_buffer + dst->calcOffset(coords), src->buffer() + src->calcOffset(coords), copy_len);
64 });
65}
Array< CornerBox > coords
virtual size_t calcOffset(const ir::Coordinates &coords) const =0
virtual uint8_t * buffer() const =0
Class to represent position(offset) of tensor. Assume that the front is higher dimensional....
Definition Coordinates.h:37
void ShapeLoop(const onert::ir::Shape &shape, L lambda_function)
Definition Utils.h:60

References coords, and ShapeLoop().

◆ CopyStatic()

void onert::exec::CopyStatic ( const uint8_t *  src_buffer,
uint8_t *  dst_buffer,
const std::vector< size_t > &  src_offsets,
const std::vector< size_t > &  dst_offsets,
size_t  copy_len 
)
inline

Definition at line 47 of file IPermuteFunction.h.

50{
51 assert(src_offsets.size() == dst_offsets.size());
52 for (size_t i = 0; i < src_offsets.size(); ++i)
53 {
54 memcpy(dst_buffer + dst_offsets.at(i), src_buffer + src_offsets.at(i), copy_len);
55 }
56}

◆ minmaxFrom()

std::pair< float, float > onert::exec::minmaxFrom ( const backend::ITensor tensor)

Definition at line 36 of file MinMaxRecorder.cc.

37{
38 const auto data = reinterpret_cast<float *>(tensor->buffer());
39 const auto num_elements = tensor->total_size() / sizeof(float);
40
41 float max = std::numeric_limits<float>::lowest();
42 float min = std::numeric_limits<float>::max();
43
44 bool all_nan = true;
45 for (size_t i = 0; i < num_elements; ++i)
46 {
47 const float number = data[i];
48 if (std::isnan(number))
49 continue;
50
51 if (number == std::numeric_limits<float>::lowest())
52 continue;
53
54 all_nan = false;
55
56 if (number > max)
57 max = number;
58
59 if (number < min)
60 min = number;
61 }
62
63 if (all_nan)
64 throw std::runtime_error("All values are NaN(Not a Number)");
65
66 return {min, max};
67}

Referenced by onert::exec::MinMaxRecorder::handleJobEnd(), and onert::exec::MinMaxRecorder::handleSubgraphBegin().

◆ printBool()

void onert::exec::printBool ( bool  quant,
std::ofstream &  stream 
)

Definition at line 60 of file JSONExecTime.cc.

60{ stream << "\"" << quant << "\""; }

Referenced by onert::exec::JSON::storeOperationsExecTime().

◆ printString()

void onert::exec::printString ( const std::string &  str,
std::ofstream &  stream 
)

Definition at line 58 of file JSONExecTime.cc.

58{ stream << "\"" << str << "\""; }

Referenced by onert::exec::JSON::storeOperationsExecTime().

◆ readBool()

void onert::exec::readBool ( bool &  quant,
std::ifstream &  stream 
)

Helper function for reading bool from stream.

Parameters
quantOutput bool
streamFile stream

Definition at line 50 of file JSONExecTime.cc.

51{
52 char buf;
53 stream.get(buf);
54 quant = (buf == '1');
55 stream.get(buf);
56}

◆ readString()

void onert::exec::readString ( std::string &  str,
std::ifstream &  stream 
)

Helper function for reading string from stream.

Parameters
strOutput string
streamFile stream

Definition at line 31 of file JSONExecTime.cc.

32{
33 str.clear();
34 char buf;
35 while (stream.good())
36 {
37 stream.get(buf);
38 if (buf == '"')
39 break;
40 str.push_back(buf);
41 }
42}

◆ UpdateOffsets()

void onert::exec::UpdateOffsets ( ::onert::backend::ITensor src,
::onert::backend::ITensor dst,
const ::onert::ir::Shape loop_shape,
std::vector< size_t > &  src_offsets,
std::vector< size_t > &  dst_offsets 
)
inline

Definition at line 37 of file IPermuteFunction.h.

40{
41 ShapeLoop(loop_shape, [&](const onert::ir::Coordinates &coords) {
42 src_offsets.emplace_back(src->calcOffset(coords));
43 dst_offsets.emplace_back(dst->calcOffset(coords));
44 });
45}

References onert::backend::ITensor::calcOffset(), coords, and ShapeLoop().