|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectat.dms.kjc.sir.lowering.partition.ManualPartition
public class ManualPartition
Represents an interface to the StreamIt compiler that allows the programmer to specify how the partitioning / load balancing is done. To use the interface, follow these steps: ------------------ 1. Run the StreamIt compiler once on the input file: strc MyInput.str This will produce a "numbered.dot" file which assigns a unique number to each filter and stream container in the graph. (You can view dot with "dotty numbered.dot" or by converting to postscript, "dot -Tps numbered.dot -o numbered.ps.) ------------------ 2. Start writing your own class that implements the following function: public static void manualPartition(SIRStream str) { ... } Let's say you wrote this in "MyPartitioner.java". ------------------ 3. Use the API in ManualPartition, given below, to implement your manualPartition function. The basic idea is that you can lookup any stream based on its number (which you get from the graph). This will give you back an SIRStream object. With these objects, you can do the following operations: - fusion - collapse a whole stream container into 1 - collapse only certain children of a given container - fission: split a filter into a splitjoin - refactoring - create / eliminate hierarchical pipelines or splitjoins - create / eliminate synchronization points in symmetrical splitjoins - partitioning - you can run our own greedy or dynamic-programming partitioner on a hierarchical unit, asking it to automatically fuse or fiss to a given number of tiles There is also a function "printGraph" for printing a new numbered graph, in case you want to check that your transformations are working as expected. This also lets you see the numbers assigned to newly-created streams. ------------------ 4. Run your manual partitioning with the following command line: strc -r4 -manual MyPartitioner MyFile.str This will call your MyPartitioner.manualPartition function using reflection. It will not do any automatic partitioning for the given stream. [This command line also targets a 4x4 Raw machine; you could target other configurations, too.] ------------------ EXAMPLES. We have implemented two examples in for our Beamformer benchmark, which is in the following directory of CVS: streams/apps/benchmarks/beamformer/streamit The files are called: MyPartition1.java MyPartition2.java The first one implements a simple partitioning in which each pipeline is fused, and then the width of a splitjoin is decreased from 4 to 2. The second one is more sophisticated: it adds a synchronization point, collapsing the top of the splitjoin from 12 to 1 and the bottom from 12 to 6.
Constructor Summary | |
---|---|
ManualPartition()
|
Method Summary | |
---|---|
static SIRPipeline |
addHierarchicalChild(SIRPipeline pipe,
int first,
int last)
Returns a new pipeline that is like 'pipe' but replaces children at indices first...last with a pipeline that contains those children. |
static SIRPipeline |
addHierarchicalChildren(SIRPipeline pipe,
PartitionGroup partitions)
Given a pipeline 'pipe' and a partitioning 'partition' of its children, returns a new pipeline that has all the elements of each partition factored into their own pipelines. |
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. |
static SIRPipeline |
addSyncPoints(SIRSplitJoin sj,
PartitionGroup partitions)
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': | | . |
static SIRStream |
convertToPipeline(SIRSplitJoin sj)
Tries to convert 'sj' into a pipeline. |
static void |
destroyArrays(SIRStream str)
Attempts to break down arrays in all children of 'str' into local variables, and to remove array declarations that are unneeded. |
static SIRStream |
doit(SIRStream str)
Invokes the "manualPartition" method in class specified by KjcOptions.manual. |
static SIRSplitJoin |
fission(SIRFilter filter,
int reps)
Splits 'filter' into a 'reps'-way splitjoin. |
static SIRSplitJoin |
fission(SIRFilter filter,
int reps,
int[] workRatio)
Splits 'filter' into a 'reps'-way splitjoin, and divides work among the resulting filters according to 'workRatio'. |
static SIRStream |
fuse(SIRPipeline pipeline,
PartitionGroup partitions)
Fuses some components of a pipeline together. |
static SIRStream |
fuse(SIRSplitJoin splitjoin,
PartitionGroup partitions)
Fuses some components of a splitjoin together. |
static SIRStream |
fuse(SIRStream str)
Fuses all of 'str' into a single filter. |
static SIRStream |
fusePipelinesOfFilters(SIRStream str)
Fuses all adjacent filters whos parent is a pipeline. |
static SIRStream |
fusePipelinesOfStatelessFilters(SIRStream str)
Fuses any two adjacent FILTERS in 'str' so long as: - the shared parent of the filter is a pipeline - the result of fusion will be stateless If a complete pipeline is fused, then it is treated as a single filter in considering fusion within the pipeline's parent. |
static SIRStream |
fusePipelinesOfStatelessStreams(SIRStream str)
Fuses any two adjacent STREAMS in 'str' so long as: - the shared parent of the filter is a pipeline - the result of fusion will be stateless If a complete pipeline is fused, then it is treated as a single filter in considering fusion within the pipeline's parent. |
static SIRStream |
getStream(SIRStream str,
int num)
Returns stream contained within 'str' that has unique id number 'num'. |
static SIRStream |
getStream(SIRStream str,
String name)
Returns stream by given |
static SIRStream[] |
getStreams(SIRStream str,
String prefix)
Returns set of all child streams of 'str' (including 'str', possibly) that have a name beginning with a given prefix. |
static SIRStream[] |
getStreamsContaining(SIRStream str,
String subStr)
Returns set of all child streams of 'str' (including 'str', possibly) that have a name that contains 'subStr'. |
static boolean |
isFissable(SIRFilter filter)
Returns whether or not 'filter' is fissable by the StreamIt compiler. |
static SIRStream |
partition(SIRStream str,
int targetTiles)
Runs dynamic programming partitioner on 'str', aiming to reduce the number of tiles needed to 'targetTiles'. |
static SIRStream |
partitionGreedy(SIRStream str,
int targetTiles)
Runs greedy partitioner on 'str', aiming to reduce the number of tiles needed to 'targetTiles'. |
static void |
printGraph(SIRStream str,
String filename)
Outputs numbered dot graph for 'str', by name of 'filename'.dot. |
static boolean |
raiseSJChildren(SIRSplitJoin sj)
Raises as many children of 'sj' as it can into 'sj'. |
static boolean |
removeMatchingSyncPoints(SIRPipeline pipe)
Does the opposite transformation of 'addSyncPoints' above. |
static boolean |
removeSyncPoints(SIRPipeline pipe)
Removes all synchronization points between child splitjoins in 'pipe'. |
static void |
unroll(SIRStream str,
int limit)
Performs loop unrolling up to 'limit' in all methods of all deep children within 'str'. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ManualPartition()
Method Detail |
---|
public static SIRStream doit(SIRStream str)
public static void printGraph(SIRStream str, String filename)
public static SIRStream getStream(SIRStream str, int num)
public static SIRStream[] getStreams(SIRStream str, String prefix)
public static SIRStream[] getStreamsContaining(SIRStream str, String subStr)
public static SIRStream getStream(SIRStream str, String name)
public static SIRStream partition(SIRStream str, int targetTiles)
public static SIRStream partitionGreedy(SIRStream str, int targetTiles)
public static SIRStream fuse(SIRStream str)
public static SIRStream fuse(SIRPipeline pipeline, PartitionGroup partitions)
public static SIRStream fuse(SIRSplitJoin splitjoin, PartitionGroup partitions)
public static SIRStream fusePipelinesOfStatelessFilters(SIRStream str)
public static SIRStream fusePipelinesOfStatelessStreams(SIRStream str)
public static SIRStream fusePipelinesOfFilters(SIRStream str)
public static boolean isFissable(SIRFilter filter)
public static SIRSplitJoin fission(SIRFilter filter, int reps)
public static SIRSplitJoin fission(SIRFilter filter, int reps, int[] workRatio)
public static SIRPipeline addHierarchicalChild(SIRPipeline pipe, int first, int last)
public static SIRPipeline addHierarchicalChildren(SIRPipeline pipe, PartitionGroup partitions)
public static SIRSplitJoin addHierarchicalChildren(SIRSplitJoin sj, PartitionGroup partition)
public static SIRPipeline addSyncPoints(SIRSplitJoin sj, PartitionGroup partitions)
public static boolean removeSyncPoints(SIRPipeline pipe)
public static boolean removeMatchingSyncPoints(SIRPipeline pipe)
public static boolean raiseSJChildren(SIRSplitJoin sj)
public static SIRStream convertToPipeline(SIRSplitJoin sj)
public static void unroll(SIRStream str, int limit)
public static void destroyArrays(SIRStream str)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |