ONE - On-device Neural Engine
Loading...
Searching...
No Matches
onert::backend::ruy::KernelGenerator Class Reference

#include <KernelGenerator.h>

Collaboration diagram for onert::backend::ruy::KernelGenerator:

Public Member Functions

 KernelGenerator (const ir::Graph &graph, const std::shared_ptr< TensorBuilder > &tensor_builder, const std::shared_ptr< basic::TensorRegistry > &tensor_reg, const std::shared_ptr< custom::IKernelBuilder > &kernel_builder, const std::shared_ptr< ExternalContext > &external_context)
 
std::unique_ptr< exec::FunctionSequencegenerate (ir::OperationIndex ind) override
 
- Public Member Functions inherited from onert::backend::basic::KernelGeneratorBase
virtual ~KernelGeneratorBase ()=default
 
 KernelGeneratorBase (const ir::Graph &graph)
 
- Public Member Functions inherited from onert::ir::OperationVisitor
virtual ~OperationVisitor ()=default
 

Additional Inherited Members

- Protected Member Functions inherited from onert::backend::basic::KernelGeneratorBase
std::unique_ptr< exec::IFunctionreleaseFunction ()
 
- Protected Attributes inherited from onert::backend::basic::KernelGeneratorBase
const ir::Graph_graph
 
std::unique_ptr< exec::IFunction_return_fn
 

Detailed Description

Definition at line 37 of file KernelGenerator.h.

Constructor & Destructor Documentation

◆ KernelGenerator()

onert::backend::ruy::KernelGenerator::KernelGenerator ( const ir::Graph graph,
const std::shared_ptr< TensorBuilder > &  tensor_builder,
const std::shared_ptr< basic::TensorRegistry > &  tensor_reg,
const std::shared_ptr< custom::IKernelBuilder > &  kernel_builder,
const std::shared_ptr< ExternalContext > &  external_context 
)

Member Function Documentation

◆ generate()

std::unique_ptr< exec::FunctionSequence > onert::backend::ruy::KernelGenerator::generate ( ir::OperationIndex  ind)
overridevirtual

Implements onert::backend::basic::KernelGeneratorBase.

Definition at line 38 of file KernelGenerator.cc.

39{
40 auto ret = std::make_unique<exec::FunctionSequence>();
41
42 assert(_tensor_builder->dynamicTensorManager());
43 assert(_tensor_reg);
44
45 // Prepare to handle dynamic tensors later
46 auto dyn_ctx = std::make_shared<exec::FunctionSequence::DynamicTensorCtx>();
47 {
48 dyn_ctx->op = &_operations_ctx.at(ind);
49 dyn_ctx->dynamic_shape_inferer = std::make_shared<exec::DynamicShapeInferer>(_tensor_reg);
50 }
51 ret->dynamic_tensor_ctx(dyn_ctx);
52
53 auto &op = _graph.operations().at(ind);
54 op.accept(*this);
55 assert(_return_fn); // _return_fn must have been generated
56 ret->append(std::move(_return_fn));
57
58 for (const auto &ind : (op.getInputs() | ir::Remove::UNDEFINED) + op.getOutputs())
59 {
60 auto tensor = _tensor_reg->getNativeTensor(ind);
61 if (tensor)
62 {
63 tensor->increase_ref();
64 }
65 }
66 return ret;
67}
std::unique_ptr< exec::IFunction > _return_fn
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.

References onert::backend::basic::KernelGeneratorBase::_graph, onert::backend::basic::KernelGeneratorBase::_return_fn, onert::util::ObjectManager< Index, Object >::at(), onert::ir::Graph::operations(), and onert::ir::UNDEFINED.


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