at.dms.kjc.sir.lowering.partition
Class RefactorSplitJoin

java.lang.Object
  extended by at.dms.kjc.sir.lowering.partition.RefactorSplitJoin

public class RefactorSplitJoin
extends Object


Constructor Summary
RefactorSplitJoin()
           
 
Method Summary
static SIRStream addDeepRectangularSyncPoints(SIRStream str)
          Returns new version of
static SIRSplitJoin addHierarchicalChildren(SIRSplitJoin sj, PartitionGroup partition)
          Given a splitjoin
static SIRPipeline addSyncPoints(SIRSplitJoin sj, PartitionGroup partition)
          Given that all of the children of
static SIRStream convertToPipeline(SIRSplitJoin sj)
          Converts
static boolean raiseSJChildren(SIRSplitJoin sj)
          Raises as many children of
static boolean removeMatchingSyncPoints(SIRPipeline pipe)
          Does the opposite transformation of
static boolean removeSyncPoints(SIRPipeline pipe)
          Removes all sync points that it can in a structued way in
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RefactorSplitJoin

public RefactorSplitJoin()
Method Detail

convertToPipeline

public static SIRStream convertToPipeline(SIRSplitJoin sj)
Converts
sj
to a pipeline, where the left-most children of the
sj
are the top-most elements of the pipeline. Initial input is passed through so that lower stages of the pipe can operate on it. Only works on splitjoins that have filters for children, that these filters have an integral pop/push ratio (this could possibly be lifted with more clever scheduling) and that have the same input and output type. Otherwise this returns the original
sj
. Note that this is an immutable method -- does not modify
sj
or its parent.


addHierarchicalChildren

public static SIRSplitJoin addHierarchicalChildren(SIRSplitJoin sj,
                                                   PartitionGroup partition)
Given a splitjoin
sj
and a partitioning
partition
of its children, returns a new splitjoin with each partition factored into its own child splitjoin. Note that this is an immutable method -- does not modify
sj
or its parent.


addDeepRectangularSyncPoints

public static SIRStream addDeepRectangularSyncPoints(SIRStream str)
Returns new version of
str
into one in which all splitjoins contained in any children are made rectangular and have synchronization after each child. Also mutates
str
.


addSyncPoints

public static SIRPipeline addSyncPoints(SIRSplitJoin sj,
                                        PartitionGroup partition)
Given that all of the children of
sj
are pipelines and that
partition
describes a partitioning for such a pipeline, re-arrange
sj
into a pipeline of several splitjoins, each of which has children corresponding to a segment of
partition
: | | . . / | \ / | \ | | | | | | | | | ===> \ | / | | | . \ | / / | \ . | | | | \ | / | . Note that this is an immutable method -- does not modify
sj
or its parent.


removeSyncPoints

public static boolean removeSyncPoints(SIRPipeline pipe)
Removes all sync points that it can in a structued way in
pipe
. Note that this might INCREASE the tile count because more joiners are introduced into the graph. If this is not desired, use only removeMatchingSyncPoints (below). Note that this method MUTATES its argument.


removeMatchingSyncPoints

public static boolean removeMatchingSyncPoints(SIRPipeline pipe)
Does the opposite transformation of
addSyncPoints
above. If any two adjacent children in
pipe
are splitjoins where the weights of the upstream joiner exactly match the weights of the downstream joiner, then the splitjoins can be combined into a single splitjoin. If this is the case, then
pipe
is mutated. This is intended only as a reverse routine for the above sync. addition. In particular, it doesn't deal with duplicate splitters or 1-way splitters, and it doesn't attempt to "duplicate" or "unroll" whole streams in order for synchronization to match up. This guarantees that the tile count is not increased by the procedure. Returns whether or not any change was made. Note that this method MUTATES its argument.


raiseSJChildren

public static boolean raiseSJChildren(SIRSplitJoin sj)
Raises as many children of
sj
as it can into
sj
, using helper functions below. Note that this method MUTATES its argument.