at.dms.kjc.spacedynamic
Class Layout

java.lang.Object
  extended by at.dms.util.Utils
      extended by at.dms.kjc.spacedynamic.Layout
All Implemented Interfaces:
DeepCloneable, FlatVisitor, StreamGraphVisitor, Serializable

public class Layout
extends Utils
implements StreamGraphVisitor, FlatVisitor

The Layout class generates mapping of filters to raw tiles. It operates on the entire StreamGraph.

See Also:
Serialized Form

Field Summary
static int ANNEALITERATIONS
           
static double DYN_CROSSED_ROUTE
           
static double DYN_MULT
          cost function constants *
static double ILLEGAL_WEIGHT
           
static int MAXTEMPITERATIONS
           
static double MEMORY_SCALE
           
static int MINTEMPITERATIONS
           
 Router router
           
static double ROUTER_WEIGHT
           
static double TFACTR
           
 
Fields inherited from class at.dms.util.Utils
EMPTY_LIST, getForLoopCallers
 
Constructor Summary
Layout(SpdStreamGraph streamGraph)
           
 
Method Summary
static boolean assignedJoiner(FlatNode node)
          Decide whether this joiner should be assigned to a tile.
static boolean assignToAComputeNode(FlatNode node)
          Return true if this flatnode is or should be assigned to a compute node (a tile or a port)
static boolean assignToATile(FlatNode node)
          return true if this flatnode is or should be assigned to tile *
 void dumpLayout(String fileName)
           
 void fileAssign()
          read the layout from a new-line separated file *
 ComputeNode getComputeNode(FlatNode node)
          return the compute node (tile or ioport) assigned to
 ComputeNode getComputeNode(SIROperator str)
          return the compute node (tile or ioport) assigned to
 HashSet<FlatNode> getIdentities()
           
 HashSet<ComputeNode> getIntermediateTiles()
           
 HashSet<FlatNode> getJoiners()
           
 FlatNode getNode(RawTile tile)
          Return the flatNode assigned to this
 RawChip getRawChip()
           
 RawTile getTile(FlatNode str)
          Returns the tile number assignment for
 RawTile getTile(SIROperator str)
          Returns the tile number assignment for
 int getTileNumber(FlatNode node)
          Return the tile number for the
 int getTileNumber(SIROperator str)
          Return the tile number for the
 Set<ComputeNode> getTiles()
           
 int getTilesAssigned()
           
 void handAssign()
           
 boolean isAssigned(FlatNode node)
           
 boolean isAssigned(RawTile tile)
           
 boolean isIntermediateTile(RawTile tile)
           
 double placementCost(boolean debug)
          return the cost of this layout calculated by the cost function, if the cost is negative, this layout is illegal.
 void simAnnealAssign()
           
 void singleFilterAssignment()
          Assign a StreamGraph that is composed of one filter in one SSG on a RawChip with one tile
 void visitNode(FlatNode node)
          visit each flatnode and decide whether is should be assigned *
 void visitStaticStreamGraph(SpdStaticStreamGraph ssg)
          visit each node of the ssg and find out which flatnodes should be assigned to tiles
 
Methods inherited from class at.dms.util.Utils
asPercent, cellMathEquivalent, cMathEquivalent, cppMathEquivalent, deepClone, deepCloneInto, equalArrays, fail, getEnvironmentVariable, getExpression, hasPeeks, initArray, initArray, initLiteralArray, intArrayToList, isMathMethod, isUniform, kopi_assert, kopi_assert, makeCountdownForLoop, makeDotFileName, makeForLoop, makeForLoop, makeForLoop, makeForLoopFieldIndex, makeForLoopLocalIndex, nextPow2, passThruParens, peelMarkers, popBeforePeek, readFile, removeUnusedPops, replaceAll, setupDotFileName, simplifyMathMethod, splitQualifiedName, splitQualifiedName, toArray, toIntArray, toVector, voidToInt, writeFile
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

router

public Router router

DYN_MULT

public static double DYN_MULT
cost function constants *


ILLEGAL_WEIGHT

public static double ILLEGAL_WEIGHT

ROUTER_WEIGHT

public static double ROUTER_WEIGHT

MEMORY_SCALE

public static double MEMORY_SCALE

DYN_CROSSED_ROUTE

public static double DYN_CROSSED_ROUTE

MINTEMPITERATIONS

public static int MINTEMPITERATIONS

MAXTEMPITERATIONS

public static int MAXTEMPITERATIONS

ANNEALITERATIONS

public static int ANNEALITERATIONS

TFACTR

public static double TFACTR
Constructor Detail

Layout

public Layout(SpdStreamGraph streamGraph)
Method Detail

visitStaticStreamGraph

public void visitStaticStreamGraph(SpdStaticStreamGraph ssg)
visit each node of the ssg and find out which flatnodes should be assigned to tiles

Specified by:
visitStaticStreamGraph in interface StreamGraphVisitor

getTilesAssigned

public int getTilesAssigned()

isAssigned

public boolean isAssigned(RawTile tile)

isAssigned

public boolean isAssigned(FlatNode node)

getTiles

public Set<ComputeNode> getTiles()

getJoiners

public HashSet<FlatNode> getJoiners()

getIdentities

public HashSet<FlatNode> getIdentities()

getTile

public RawTile getTile(SIROperator str)
Returns the tile number assignment for
str
, or null if none has been layout It will die if this str should not be assigned to RawTile


getTile

public RawTile getTile(FlatNode str)
Returns the tile number assignment for
str
, or null if none has been layout It will die if
str
should not be assigned to RawTile


getTileNumber

public int getTileNumber(FlatNode node)
Return the tile number for the
node
it will die if the node has not been assigned to a tile


getTileNumber

public int getTileNumber(SIROperator str)
Return the tile number for the
str
it will die if the node has not been assigned to a tile


getNode

public FlatNode getNode(RawTile tile)
Return the flatNode assigned to this
tile
*


getComputeNode

public ComputeNode getComputeNode(FlatNode node)
return the compute node (tile or ioport) assigned to
node
*


getComputeNode

public ComputeNode getComputeNode(SIROperator str)
return the compute node (tile or ioport) assigned to
str
*


getRawChip

public RawChip getRawChip()

dumpLayout

public void dumpLayout(String fileName)

singleFilterAssignment

public void singleFilterAssignment()
Assign a StreamGraph that is composed of one filter in one SSG on a RawChip with one tile


fileAssign

public void fileAssign()
read the layout from a new-line separated file *


handAssign

public void handAssign()

placementCost

public double placementCost(boolean debug)
return the cost of this layout calculated by the cost function, if the cost is negative, this layout is illegal. if
debug
then print out why this layout was illegal


simAnnealAssign

public void simAnnealAssign()

assignToAComputeNode

public static boolean assignToAComputeNode(FlatNode node)
Return true if this flatnode is or should be assigned to a compute node (a tile or a port)


assignToATile

public static boolean assignToATile(FlatNode node)
return true if this flatnode is or should be assigned to tile *


assignedJoiner

public static boolean assignedJoiner(FlatNode node)
Decide whether this joiner should be assigned to a tile. Don't assign null joiners or joiners that output to a joiner.

Parameters:
node - The flatnode to check.
Returns:
True if we should assign this joiner to a tile.

getIntermediateTiles

public HashSet<ComputeNode> getIntermediateTiles()
Returns:
Return the set of tiles that are intermediate hops for routes.

isIntermediateTile

public boolean isIntermediateTile(RawTile tile)
Parameters:
tile - The tile to test.
Returns:
True if this tile is involved in an intermediate hop of a route (not an endpoint).

visitNode

public void visitNode(FlatNode node)
visit each flatnode and decide whether is should be assigned *

Specified by:
visitNode in interface FlatVisitor
Parameters:
node - the node that is being currently visited.