MLIR  20.0.0git
Public Member Functions | Public Attributes | List of all members
CommutativeOperand Struct Reference

Stores a commutative operand along with its BFS traversal information. More...

Public Member Functions

void pushAncestor (Operation *op)
 Push an ancestor into the operand's BFS information structure. More...
 
void refreshKey ()
 Refresh the key. More...
 
void popFrontAndPushAdjacentUnvisitedAncestors ()
 Pop the front ancestor, if any, from the queue and then push its adjacent unvisited ancestors, if any, to the queue (this is the main body of the BFS algorithm). More...
 

Public Attributes

Value operand
 Stores the operand. More...
 
std::queue< Operation * > ancestorQueue
 Stores the queue of ancestors of the operand's BFS traversal at a particular point in time. More...
 
DenseSet< Operation * > visitedAncestors
 Stores the list of ancestors that have been visited by the BFS traversal at a particular point in time. More...
 
SmallVector< AncestorKey, 4 > key
 Stores the operand's "key". More...
 

Detailed Description

Stores a commutative operand along with its BFS traversal information.

Definition at line 74 of file CommutativityUtils.cpp.

Member Function Documentation

◆ popFrontAndPushAdjacentUnvisitedAncestors()

void CommutativeOperand::popFrontAndPushAdjacentUnvisitedAncestors ( )
inline

Pop the front ancestor, if any, from the queue and then push its adjacent unvisited ancestors, if any, to the queue (this is the main body of the BFS algorithm).

Definition at line 143 of file CommutativityUtils.cpp.

References mlir::Value::getDefiningOp(), and mlir::Operation::getOperands().

◆ pushAncestor()

void CommutativeOperand::pushAncestor ( Operation op)
inline

Push an ancestor into the operand's BFS information structure.

This entails it being pushed into the queue (always) and inserted into the "visited ancestors" list (iff it is an op rather than a block argument).

Definition at line 118 of file CommutativityUtils.cpp.

◆ refreshKey()

void CommutativeOperand::refreshKey ( )
inline

Refresh the key.

Refreshing a key entails making it up-to-date with the operand's BFS traversal that has happened till that point in time, i.e, appending the existing key with the front ancestor's "AncestorKey". Note that a key directly reflects the BFS and thus needs to be refreshed during the progression of the traversal.

Definition at line 131 of file CommutativityUtils.cpp.

Member Data Documentation

◆ ancestorQueue

std::queue<Operation *> CommutativeOperand::ancestorQueue

Stores the queue of ancestors of the operand's BFS traversal at a particular point in time.

Definition at line 80 of file CommutativityUtils.cpp.

◆ key

SmallVector<AncestorKey, 4> CommutativeOperand::key

Stores the operand's "key".

This "key" is defined as a list of the "AncestorKeys" associated with the ancestors of this operand, in a breadth-first order.

So, if an operand, say A, was produced as follows:

<block argument> <block argument> \ / \ / arith.subi arith.constant \ / arith.addi | returns A

Then, the ancestors of A, in the breadth-first order are: arith.addi, arith.subi, arith.constant, <block argument>, and <block argument>.

Thus, the "key" associated with operand A is: { {type: NON_CONSTANT_OP, opName: "arith.addi"}, {type: NON_CONSTANT_OP, opName: "arith.subi"}, {type: CONSTANT_OP, opName: "arith.constant"}, {type: BLOCK_ARGUMENT, opName: ""}, {type: BLOCK_ARGUMENT, opName: ""} }

Definition at line 113 of file CommutativityUtils.cpp.

◆ operand

Value CommutativeOperand::operand

Stores the operand.

Definition at line 76 of file CommutativityUtils.cpp.

◆ visitedAncestors

DenseSet<Operation *> CommutativeOperand::visitedAncestors

Stores the list of ancestors that have been visited by the BFS traversal at a particular point in time.

Definition at line 84 of file CommutativityUtils.cpp.


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