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

An optimization pass that removes Permute operations if possible. More...

#include <PermutationEliminationPass.h>

Collaboration diagram for onert::compiler::pass::PermutationEliminationPass:

Public Member Functions

std::string id () final
 Returns string id for this pass. Same with class name.
 
void callback (const ir::OperationIndex &i, ir::IOperation &n) 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
 
- Public Member Functions inherited from onert::ir::OperationVisitor
virtual ~OperationVisitor ()=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

An optimization pass that removes Permute operations if possible.

There may be some Permute operations that are inserted by PermutationInsertionPass or other passes. This pass checks all Permute operations and eliminates them if Permute in/out tensors are compatible and layouts match.

Permute input tensor is kept and the output is removed for all the cases, except model outputs. As all output tensors have to be builtin backend, so the output is kept.

Note
This is an optimization pass which means that everything should work fine even if this pass was skipped.

Definition at line 43 of file PermutationEliminationPass.h.

Member Function Documentation

◆ callback()

void onert::compiler::pass::PermutationEliminationPass::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 29 of file PermutationEliminationPass.cc.

30{
31 _op_ind = ind;
32 node.accept(*this);
33};

References onert::ir::IOperation::accept().

◆ id()

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

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

Returns
string id

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

Definition at line 49 of file PermutationEliminationPass.h.

49{ return "PermutationEliminationPass"; }

◆ 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: