ONE - On-device Neural Engine
Loading...
Searching...
No Matches
onert_micro::execute::OMRuntimeKernel Class Reference

#include <OMRuntimeKernel.h>

Collaboration diagram for onert_micro::execute::OMRuntimeKernel:

Public Member Functions

 OMRuntimeKernel ()=default
 
 OMRuntimeKernel (const OMRuntimeKernel &)=delete
 
 OMRuntimeKernel (OMRuntimeKernel &&)=delete
 
 ~OMRuntimeKernel ()=default
 
OMRuntimeKerneloperator= (const OMRuntimeKernel &)=delete
 
OMRuntimeKernel && operator= (const OMRuntimeKernel &&)=delete
 
OMStatus readKernel (uint16_t op_index, core::OMRuntimeContext &runtime_context)
 
OMStatus getDataFromStorage (uint16_t op_index, core::OMRuntimeStorage &storage, core::OMRuntimeContext &context)
 

Data Fields

const circle::Tensor * inputs [maxInputSize] = {nullptr}
 
const circle::Tensor * outputs [maxOutputSize] = {nullptr}
 
uint8_t * inputs_data [maxInputSize] = {nullptr}
 
uint8_t * outputs_data [maxOutputSize] = {nullptr}
 
int32_t inputs_index [maxInputSize] = {-1}
 
int32_t outputs_index [maxOutputSize] = {-1}
 
uint32_t outputs_num = 0
 
uint32_t inputs_num = 0
 
const circle::Operator * first_operator = nullptr
 

Detailed Description

Definition at line 34 of file OMRuntimeKernel.h.

Constructor & Destructor Documentation

◆ OMRuntimeKernel() [1/3]

onert_micro::execute::OMRuntimeKernel::OMRuntimeKernel ( )
default

◆ OMRuntimeKernel() [2/3]

onert_micro::execute::OMRuntimeKernel::OMRuntimeKernel ( const OMRuntimeKernel )
delete

◆ OMRuntimeKernel() [3/3]

onert_micro::execute::OMRuntimeKernel::OMRuntimeKernel ( OMRuntimeKernel &&  )
delete

◆ ~OMRuntimeKernel()

onert_micro::execute::OMRuntimeKernel::~OMRuntimeKernel ( )
default

Member Function Documentation

◆ getDataFromStorage()

OMStatus onert_micro::execute::OMRuntimeKernel::getDataFromStorage ( uint16_t  op_index,
core::OMRuntimeStorage storage,
core::OMRuntimeContext context 
)

Definition at line 67 of file OMRuntimeKernel.cpp.

70{
71 OMStatus status = Ok;
72
73 for (uint32_t i = 0; i < inputs_num; ++i)
74 {
75 if (inputs_index[i] == -1)
76 continue;
77 status = storage.getDataByTensorIndex(&inputs_data[i], inputs_index[i]);
78 if (inputs_data[i] == nullptr)
79 status = context.getConstDataByTensorIndex(&inputs_data[i], inputs_index[i]);
80 if (status != Ok)
81 return status;
82 }
83
84 for (uint32_t i = 0; i < outputs_num; ++i)
85 {
86 if (outputs_index[i] == -1)
87 continue;
88 status = storage.getDataByTensorIndex(&outputs_data[i], outputs_index[i]);
89
90 if (storage.getKernelType(op_index) == core::Inplace)
91 {
94
95 if (status != Ok)
96 return status;
97
98 status = storage.saveDataToTensorIndex(outputs_data[i], outputs_index[i]);
99 }
100 }
101
102 return status;
103}
OMStatus getConstDataByTensorIndex(uint8_t **data, uint16_t tensor_index)
OMKernelType getKernelType(uint16_t op_index)
OMStatus removeTensorFromTensorIndexToData(uint16_t tensor_index)
OMStatus getDataByTensorIndex(uint8_t **data, uint16_t tensor_index)
OMStatus saveDataToTensorIndex(uint8_t *data, uint16_t tensor_index)
uint8_t * outputs_data[maxOutputSize]

References onert_micro::core::OMRuntimeContext::getConstDataByTensorIndex(), onert_micro::core::OMRuntimeStorage::getDataByTensorIndex(), onert_micro::core::OMRuntimeStorage::getKernelType(), onert_micro::core::Inplace, onert_micro::Ok, onert_micro::core::OMRuntimeStorage::removeTensorFromTensorIndexToData(), and onert_micro::core::OMRuntimeStorage::saveDataToTensorIndex().

Referenced by onert_micro::execute::execute_arg_common(), onert_micro::execute::execute_relu_common(), onert_micro::execute::execute_reshape_common(), onert_micro::execute::readKernelDataTISO(), onert_micro::execute::SISOHeader(), and onert_micro::execute::TISOHeader().

◆ operator=() [1/2]

OMRuntimeKernel && onert_micro::execute::OMRuntimeKernel::operator= ( const OMRuntimeKernel &&  )
delete

◆ operator=() [2/2]

OMRuntimeKernel & onert_micro::execute::OMRuntimeKernel::operator= ( const OMRuntimeKernel )
delete

◆ readKernel()

OMStatus onert_micro::execute::OMRuntimeKernel::readKernel ( uint16_t  op_index,
core::OMRuntimeContext runtime_context 
)

Definition at line 22 of file OMRuntimeKernel.cpp.

24{
25 first_operator = runtime_context.getCircleOperatorAt(op_index);
26 const circle::Operator *last_operator = runtime_context.getCircleOperatorAt(op_index);
27
28 inputs_num = first_operator->inputs()->size();
29 assert(inputs_num <= maxInputSize);
30
31 if (inputs_num > maxInputSize)
32 return UnknownError;
33
34 outputs_num = last_operator->outputs()->size();
35 assert(outputs_num <= maxOutputSize);
36
37 if (outputs_num > maxOutputSize)
38 return UnknownError;
39
40 assert(inputs_num > 0 and outputs_num > 0);
41
42 // Read inputs
43 {
44 const auto *inputs_op = first_operator->inputs();
45 for (uint32_t i = 0; i < inputs_num; ++i)
46 {
47 inputs_index[i] = inputs_op->operator[](i);
48 if (inputs_index[i] != -1)
49 inputs[i] = runtime_context.getTensorByIndex(inputs_index[i]);
50 }
51 }
52 // Read outputs
53 {
54 const auto *outputs_op = last_operator->outputs();
55 for (uint32_t i = 0; i < outputs_num; ++i)
56 {
57 outputs_index[i] = outputs_op->operator[](i);
58 if (outputs_index[i] != -1)
59 outputs[i] = runtime_context.getTensorByIndex(outputs_index[i]);
60 }
61 }
62
63 return Ok;
64}
const circle::Operator * getCircleOperatorAt(uint16_t index)
const circle::Tensor * getTensorByIndex(int32_t tensor_index)
const circle::Operator * first_operator
const circle::Tensor * outputs[maxOutputSize]
const circle::Tensor * inputs[maxInputSize]

References first_operator, onert_micro::core::OMRuntimeContext::getCircleOperatorAt(), onert_micro::core::OMRuntimeContext::getTensorByIndex(), inputs, inputs_index, inputs_num, onert_micro::Ok, outputs, outputs_index, outputs_num, and onert_micro::UnknownError.

Referenced by onert_micro::import::helpers::configure_arg_kernel_common(), onert_micro::import::helpers::configure_floor_kernel_common(), onert_micro::import::helpers::configure_pad_kernel_common(), onert_micro::import::helpers::configure_pooling_kernel_common(), onert_micro::import::helpers::configure_SISO_kernel(), onert_micro::import::helpers::configure_spaces_batches_nd_kernel_common(), onert_micro::import::helpers::configure_TISO_kernel(), onert_micro::execute::execute_arg_common(), onert_micro::execute::execute_relu_common(), onert_micro::execute::execute_reshape_common(), onert_micro::execute::readKernelDataTISO(), onert_micro::import::SISOHeader(), onert_micro::execute::SISOHeader(), onert_micro::import::TISOHeader(), and onert_micro::execute::TISOHeader().

Field Documentation

◆ first_operator

const circle::Operator* onert_micro::execute::OMRuntimeKernel::first_operator = nullptr

◆ inputs

◆ inputs_data

◆ inputs_index

int32_t onert_micro::execute::OMRuntimeKernel::inputs_index[maxInputSize] = {-1}

Definition at line 57 of file OMRuntimeKernel.h.

57{-1};

Referenced by readKernel().

◆ inputs_num

uint32_t onert_micro::execute::OMRuntimeKernel::inputs_num = 0

Definition at line 61 of file OMRuntimeKernel.h.

Referenced by readKernel().

◆ outputs

◆ outputs_data

◆ outputs_index

int32_t onert_micro::execute::OMRuntimeKernel::outputs_index[maxOutputSize] = {-1}

Definition at line 58 of file OMRuntimeKernel.h.

58{-1};

Referenced by readKernel().

◆ outputs_num

uint32_t onert_micro::execute::OMRuntimeKernel::outputs_num = 0

Definition at line 60 of file OMRuntimeKernel.h.

Referenced by readKernel().


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