at.dms.kjc.cluster
Class ClusterFusion

java.lang.Object
  extended by at.dms.kjc.cluster.ClusterFusion
All Implemented Interfaces:
FlatVisitor

public class ClusterFusion
extends Object
implements FlatVisitor

the class finds splitters / joiners that need to be fused with filters.
(Not exactly: AD. allows manual fusing, also has something to do with creating partition numbers a.k.a. threads.)


Constructor Summary
ClusterFusion()
           
 
Method Summary
static Set<FlatNode> fusedWith(FlatNode node)
          Pass a Flatnode and get back a set of nodes that the passed node is fused with.
static FlatNode getLocalMaster(FlatNode node)
          Get node that the passed node was fused to.
static FlatNode getMaster(FlatNode node)
          Get node that the passed node was fused to.
static String getPartition(FlatNode node)
          Returns partition that should execute on.
static boolean isEliminated(FlatNode node)
          Has passed node been eliminated in favor of some other representative of fused region?
static void setPartitionMap(HashMap<SIROperator,Integer> pmap)
          Clobber 'partitionmap'.
 void visitNode(FlatNode node)
          Cluster partitioning.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClusterFusion

public ClusterFusion()
Method Detail

setPartitionMap

public static void setPartitionMap(HashMap<SIROperator,Integer> pmap)
Clobber 'partitionmap'. Seems to be used in ClusterBackend to record results of cachopts and other partitioners.

Parameters:
pmap - a map from SIROperators to partition numbers.

isEliminated

public static boolean isEliminated(FlatNode node)
Has passed node been eliminated in favor of some other representative of fused region?

Parameters:
node - a FlatNode
Returns:
true if this node has been fused to another node (by being second argument to 'fuseTo')

fusedWith

public static Set<FlatNode> fusedWith(FlatNode node)
Pass a Flatnode and get back a set of nodes that the passed node is fused with.

Parameters:
node - f FlatNode
Returns:
Set of all nodes passed node is fused with, not including passed node.A

getLocalMaster

public static FlatNode getLocalMaster(FlatNode node)
Get node that the passed node was fused to. (this is the original result of fusion, the returned node may not be the representative node of a fused section if it has itself been fused into yet another node).

Parameters:
node -
Returns:
a FlatNode or null if the passed node was never fused.

getMaster

public static FlatNode getMaster(FlatNode node)
Get node that the passed node was fused to.
this should be the transitive closure of @{link #getLocalMaster}

Parameters:
node -
Returns:
a FlatNode or null if the passed node was never fused.

visitNode

public void visitNode(FlatNode node)
Cluster partitioning. Does nothing if partitionMap already assigns a node to a partition. Otherwise: (1) If splitter -- with sumOfWeights != 0 -- is preceeded by filter, fuse it to filter. (2) If joiner -- with sumOfWeights != 0 -- is followed by filter, splitter or joiner, fuse it to the following filter splitter or joiner. if (KjcOptions.fusion) { ClusterFusion.setPartitionMap(partitionMap); graphFlattener.top.accept(new ClusterFusion(), new HashSet(), true); }

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

getPartition

public static String getPartition(FlatNode node)
Returns partition that should execute on. WTF? what is this thread referred to? Line above would indicate that thread is the parameter which is a Flatnode, but threads elsewhere are numbers, and this method returns strings... Algorithm: If fused with anything else, return partition of its 'nodeMaster' else If a filter, return partition number for it + 1 as string. If a joiner followed by a filter, return the filter's partition. else do something with preceeding operators to get partition... (Janis?) If a splitter and at top of program, return "1" else if a splitter preceeded by a filter, return partition of filter. else do something with following operators to get partition... (Janis?)

Parameters:
node - ??
Returns:
??