|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectat.dms.kjc.flatgraph.FlatNode
public final class FlatNode
This class represents a node in the flattened graph. It has incoming edges
with associated weights and outgoing edges with associated weights. The edges
point to other FlatNodes.
A FlatNode is unlike a StreamIt filter; each node
can have multiple input and output. However, this feature is current not
utilized because GraphFlattener
just converts each filter/splitter/joiner
into a FlatNode, so that filter FlatNodes are single input/single output, splitter
FlatNodes are single input/multiple output. The spacedynamic backend and the raw
backend rely on this translation of the StreamIt Graph.
For nodes with multiple output, duplicate round-robins have 1 as the output
weight for all of their output arcs. One must use the type of the splitter in
contents to see what type of splitter is used. @see #contents The same goes for
the types of joiners although there are only round-robin joiners supported in StreamIt
currently.
Field Summary | |
---|---|
SIROperator |
contents
The operator this node contains (either a splitter, joiner, or filter) |
int |
currentEdge
the current outgoing edge we are connecting, all edges before this are connected, used during construction |
int |
currentIncoming
the current inedges we are connecting, all edges before this are connected, used during construction |
FlatNode[] |
incoming
The incoming edges of this FlatNode |
int[] |
incomingWeights
The round robin weights of each incoming arc |
int |
inputs
The number of inputs (number of input arcs |
SIROperator |
oldContents
Used by synch removal to remember the old sir Operator |
int |
schedDivider
Used by synch removal to calcuate the new multiplicity of this node |
int |
schedMult
Used by synch removal to calcuate the new multiplicity of this node |
int |
ways
The number of outputs (number of output arcs |
int[] |
weights
The weights of each outgoing arc |
Constructor Summary | |
---|---|
FlatNode(SIROperator op)
Create a new FlatNode with op as the underlying SIROperator. |
Method Summary | |
---|---|
void |
accept(FlatVisitor v,
HashSet<FlatNode> set,
boolean reset)
Accept a FlatVisitor v, that will visit this node. |
void |
addEdges(FlatNode to)
Add a outgoing edge from this node to to. |
static void |
addEdges(FlatNode from,
FlatNode to)
Add an edge between from to to. |
void |
addEdgeTo(FlatNode to)
Add an edge at this FlatNode to to. |
void |
addIncomingFrom(FlatNode from)
Add an incoming edge at this node from from. |
FlatNode[] |
getEdges()
|
SIRFilter |
getFilter()
If underlying SIROperator is an SIRFilter, return the SIRFilter, otherwise throw an exception. |
int |
getIncomingWay(FlatNode prev)
Return the index into the incoming weights and edges structures that holds the edge with source prev. |
int |
getIncomingWeight(FlatNode prev)
return The incoming weight that is associated with the incoming edge that connects from prev. |
static int |
getItemsPushed(FlatNode from,
FlatNode to)
Return the number of items pushed from *from* to *to* on each iteration of *from*. |
String |
getName()
Return the name of the underlying SIROperator with the FlatNode's unique ID appended. |
int |
getPartialIncomingSum(int i)
Get the partial sum of incoming weight 0 thru i - 1. |
int |
getPartialOutgoingSum(int i)
Get partial sum of outgoing weights 0 thru i - 1. |
int |
getTotalIncomingWeights()
Return the sum of the weights on the incoming edges. |
int |
getTotalOutgoingWeights()
Return the sum of the weights of the outgoing edges. |
int |
getWay(FlatNode to)
Return the index into the outgoing weights and edges structures that holds the edge to to. |
int |
getWeight(FlatNode to)
Return the outgoing weight that is associated with the outgoing edge that points to to. |
int |
hashCode()
Now uses uin to implement deterministic hashcode system. |
boolean |
isDuplicateSplitter()
Return True if the underlying SIROperator is an SIRSplitter that is a duplicate splitter. |
boolean |
isFeedbackIncomingEdge(int i)
Return True if the underlying SIROperator is a joiner and that joiner is directly contained in an SIRFeedbackLoop and the incoming edge at i is the feed-back path. |
boolean |
isFeedbackJoiner()
Return True if the underlying SIROperator is a joiner and that joiner is directly contained in an SIRFeedbackLoop. |
boolean |
isFilter()
Return True if the the underlying SIROperator is a SIRFilter. |
boolean |
isJoiner()
Return True if the underlying SIROperator is an SIRJoiner |
boolean |
isNullJoiner()
|
boolean |
isNullSplitter()
Return true if this flat node is a null splitter. |
boolean |
isSplitter()
Return True if the underlying SIROperator is an SIRSplitter |
boolean |
isTopFilter()
Return True if the the underlying SIROperator is a SIRFilter and could be at the top of a program |
double |
joiningRatio(FlatNode in)
Return the ratio items that gets joined from the node in. |
void |
removeBackEdge(FlatNode from)
Remove the incoming edge to this Flatnode from from. |
void |
removeEdges()
Remove all downstream edges this node. |
void |
removeForwardEdge(FlatNode to)
Remove the outgoing edge to the Flatnode to. |
void |
removeIncoming()
Remove all incoming edges at this node, but this does not remove the associated edges from the source nodes. |
void |
setEdge(int offset,
FlatNode newEdge)
Set an edge in the outgoing edges. |
void |
setEdges(FlatNode[] edges)
Replace all of the outgoing edges. |
double |
splittingRatio(FlatNode out)
Return the ratio of itms that gets split to the node out. |
void |
swapSplitterEdges()
This function is called by GraphFlattener
after GraphFlattener.createGraph(at.dms.kjc.sir.SIROperator) is called. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public SIROperator contents
public FlatNode[] incoming
public int[] incomingWeights
public int[] weights
public int inputs
public int ways
public int currentEdge
public int currentIncoming
public int schedMult
public int schedDivider
public SIROperator oldContents
Constructor Detail |
---|
public FlatNode(SIROperator op)
op
- The SIROperator that this FlatNode represents.Method Detail |
---|
public void removeEdges()
public void removeIncoming()
public void removeForwardEdge(FlatNode to)
to
- The FlatNode whose edge we want to remove.public double splittingRatio(FlatNode out)
out
- An outgoing node.
public double joiningRatio(FlatNode in)
in
- An incoming node.
public void removeBackEdge(FlatNode from)
from
- The FlatNode whose edge we want to remove.public void addEdges(FlatNode to)
to
- The node to connect to.public static void addEdges(FlatNode from, FlatNode to)
from
- The source nodeto
- The dest nodepublic void addEdgeTo(FlatNode to)
to
- The new edge's destination.public void addIncomingFrom(FlatNode from)
from
- The source of the new edge.public void swapSplitterEdges()
GraphFlattener
after GraphFlattener.createGraph(at.dms.kjc.sir.SIROperator)
is called. It
is called for each splitter of a feedback loop. GraphFlattener.createGraph(at.dms.kjc.sir.SIROperator)
connects the outgoing edges of the splitter of a feedback in the reverse order and
this swaps them.
public void accept(FlatVisitor v, HashSet<FlatNode> set, boolean reset)
v
- The FlatVisitor to call.set
- The FlatNodes we have already visited.reset
- If true, reset set to be empty.public int hashCode()
uin
to implement deterministic hashcode system.
It has the added
benefit that a FlatNode's identity isn't tied to it's inputs, ways, etc
not changing ie now hashcode is synched with equals() and equality
doesn't change just because ones ways, etc changes
hashCode
in class Object
public String getName()
public boolean isFilter()
public boolean isTopFilter()
public boolean isJoiner()
public boolean isSplitter()
public boolean isDuplicateSplitter()
public boolean isNullSplitter()
public boolean isNullJoiner()
public boolean isFeedbackJoiner()
public boolean isFeedbackIncomingEdge(int i)
int
- i: the edge number.
public String toString()
toString
in class Object
getName()
public int getTotalIncomingWeights()
public int getTotalOutgoingWeights()
public int getPartialOutgoingSum(int i)
public int getPartialIncomingSum(int i)
public int getIncomingWeight(FlatNode prev)
prev
- The source we are interested it.
public int getWeight(FlatNode to)
to
-
public int getWay(FlatNode to)
to
- The dest of the edge.
public int getIncomingWay(FlatNode prev)
prev
- The source of the edge.
public SIRFilter getFilter()
public static int getItemsPushed(FlatNode from, FlatNode to)
from
- : the node pushing the itemsto
- : the node receiving the pushed items
public void setEdges(FlatNode[] edges)
the
- array the edges to set.public void setEdge(int offset, FlatNode newEdge)
offset
- edge number (0 based)newEdge
- edge to replace existing edge at the offset.public FlatNode[] getEdges()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |