ONE - On-device Neural Engine
Loading...
Searching...
No Matches
onert::compiler::pass::ConstantLoweringPass Class Reference

#include <ConstantLoweringPass.h>

Collaboration diagram for onert::compiler::pass::ConstantLoweringPass:

Public Member Functions

std::string id () final
 Returns string id for this pass. Same with class name.
 
void callback (const ir::OperationIndex &index, ir::IOperation &node) final
 Be called for all nodes of graph.
 
 LoweredOperationPass (ILoweredGraph &lowered_graph)
 
- Public Member Functions inherited from onert::compiler::pass::LoweredOperationPass
 LoweredOperationPass (ILoweredGraph &lowered_graph)
 
virtual ~LoweredOperationPass ()=default
 
- Public Member Functions inherited from onert::compiler::pass::OperationPass
virtual ~OperationPass ()=default
 
void run () final
 Run the pass.
 
 Pass (ir::Graph &graph)
 
- Public Member Functions inherited from onert::compiler::pass::Pass
 Pass (ir::Graph &graph)
 
virtual ~Pass ()=default
 
- Public Member Functions inherited from onert::compiler::pass::IPass
virtual ~IPass ()=default
 

Additional Inherited Members

- Protected Attributes inherited from onert::compiler::pass::LoweredOperationPass
ILoweredGraph_lowered_graph
 
- Protected Attributes inherited from onert::compiler::pass::Pass
ir::Graph_graph
 

Detailed Description

Definition at line 30 of file ConstantLoweringPass.h.

Member Function Documentation

◆ callback()

void onert::compiler::pass::ConstantLoweringPass::callback ( const ir::OperationIndex index,
ir::IOperation node 
)
finalvirtual

Be called for all nodes of graph.

Parameters
indexis the index of a node in graph
nodeis the node in graph

Implements onert::compiler::pass::LoweredOperationPass.

Definition at line 31 of file ConstantLoweringPass.cc.

32{
33 const auto backend = _lowered_graph.lower_info().operation.at(node_index);
34
35 // Now this runtime does not support the node making output of operation as constant
36 for (const auto &input : node.getInputs() | ir::Remove::DUPLICATED | ir::Remove::UNDEFINED)
37 {
38 auto &object = _graph.operands().at(input);
39 if (object.isConstant())
40 {
41 // All constant operand are already assinged at each backend by ContantInsertionPass. So a
42 // constant has `def` and `use` as the same backend
43 auto operand_li = std::make_unique<compiler::OperandLowerInfo>();
44 operand_li->addDefBackend(backend);
45 operand_li->addUseBackend(backend);
46 _lowered_graph.lower_info().operand.set(input, std::move(operand_li));
47 }
48 }
49}
const Operands & operands() const override
Definition Graph.h:112
const Object & at(const Index &index) const
Get the object that is associated with the given index.
std::unordered_map< ir::OperationIndex, const backend::Backend * > operation
util::ObjectManager< ir::OperandIndex, OperandLowerInfo > operand
virtual const compiler::GraphLowerInfo & lower_info() const =0

References onert::compiler::pass::Pass::_graph, onert::compiler::pass::LoweredOperationPass::_lowered_graph, onert::util::ObjectManager< Index, Object >::at(), onert::ir::DUPLICATED, onert::ir::IOperation::getInputs(), onert::compiler::ILoweredGraph::lower_info(), onert::compiler::GraphLowerInfo::operand, onert::ir::Graph::operands(), onert::compiler::GraphLowerInfo::operation, and onert::ir::UNDEFINED.

◆ id()

std::string onert::compiler::pass::ConstantLoweringPass::id ( )
inlinefinalvirtual

Returns string id for this pass. Same with class name.

Returns
string id

Implements onert::compiler::pass::LoweredOperationPass.

Definition at line 36 of file ConstantLoweringPass.h.

36{ return "ConstantLoweringPass"; }

◆ LoweredOperationPass()

onert::compiler::pass::LoweredOperationPass::LoweredOperationPass ( ILoweredGraph lowered_graph)
inline

Definition at line 33 of file LoweredOperationPass.h.

34 : OperationPass{lowered_graph.graph()}, _lowered_graph{lowered_graph}
35 {
36 // DO NOTHING
37 }

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