ONE - On-device Neural Engine
Loading...
Searching...
No Matches
onert_micro::import::OMKernelConfiguration Struct Reference

#include <OMKernelConfiguration.h>

Static Public Member Functions

static OMStatus configureKernels (OMConfigureArgs &)
 

Detailed Description

Definition at line 31 of file OMKernelConfiguration.h.

Member Function Documentation

◆ configureKernels()

OMStatus OMKernelConfiguration::configureKernels ( OMConfigureArgs configure_args)
static

Definition at line 25 of file OMKernelConfiguration.cpp.

26{
27 OMRuntimeContext &runtime_context = configure_args.runtime_context;
28 const reader::CircleOperators *operators = runtime_context.getCircleOperators();
29
30 const auto num_operators = static_cast<uint16_t>(operators->size());
31 const auto op_codes = runtime_context.getCircleOpcodes();
32
33 OMStatus status = Ok;
34 for (uint16_t i = 0; i < num_operators; ++i)
35 {
37 const circle::Operator *op = operators->operator[](i);
38 uint32_t index = op->opcode_index();
39
40 assert(index < op_codes->size());
41
42 const auto opcode = op_codes->operator[](index);
43
44 status = core::getBuilderId(opcode, builder_id);
45
46 assert(status == Ok);
47 if (status != Ok)
48 return status;
49
50 KernelConfigureFunc *configure_func = nullptr;
51 if (size_t(builder_id) < size_t(core::OMBuilderID::BuiltinOperatorsSize))
52 {
53 // Builtin operator
54 status = kernel_builtin_configure.getKernelConfigureFunc(builder_id, &configure_func);
55 }
56 else
57 {
58 // Custom
59 status = kernel_custom_configure.getKernelConfigureFunc(builder_id, &configure_func);
60 }
61
62 assert(configure_func != nullptr);
63
64 if (status != Ok)
65 return status;
66
67 configure_args.kernel_index = i;
68 status = configure_func(configure_args);
69 assert(status == Ok && "");
70 }
71
72 return status;
73}
uoffset_t size() const
const reader::CircleOperatorCodes * getCircleOpcodes()
const reader::CircleOperators * getCircleOperators()
OMStatus getKernelConfigureFunc(core::OMBuilderID builderID, KernelConfigureFunc **configure_func) const
OMStatus getKernelConfigureFunc(core::OMBuilderID builderID, KernelConfigureFunc **configure_func) const
loco::GraphInputIndex index(const TFPlaceholder *node)
Definition TFNode.cpp:54
OMStatus getBuilderId(const circle::OperatorCode *opcode, core::OMBuilderID &builderID)
constexpr KernelBuiltinConfigureRegistry kernel_builtin_configure
OMStatus(const OMConfigureArgs &) KernelConfigureFunc
constexpr KernelCustomConfigureRegistry kernel_custom_configure
int32_t size[5]
Definition Slice.cpp:35
core::OMRuntimeContext & runtime_context

References onert_micro::core::BuiltinOperatorsSize, onert_micro::core::getBuilderId(), onert_micro::core::OMRuntimeContext::getCircleOpcodes(), onert_micro::core::OMRuntimeContext::getCircleOperators(), onert_micro::import::KernelBuiltinConfigureRegistry::getKernelConfigureFunc(), onert_micro::import::KernelCustomConfigureRegistry::getKernelConfigureFunc(), onert_micro::import::kernel_builtin_configure, onert_micro::import::kernel_custom_configure, onert_micro::import::OMConfigureArgs::kernel_index, onert_micro::Ok, onert_micro::import::OMConfigureArgs::runtime_context, flatbuffers::Vector< T >::size(), size, and onert_micro::core::Size.

Referenced by onert_micro::core::OMRuntimeModule::importModel().


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