at.dms.kjc.vanillaSlice
Class UniBackEndFactory

java.lang.Object
  extended by at.dms.kjc.backendSupport.BackEndFactory<UniProcessors,UniProcessor,UniComputeCodeStore,Integer>
      extended by at.dms.kjc.vanillaSlice.UniBackEndFactory

public class UniBackEndFactory
extends BackEndFactory<UniProcessors,UniProcessor,UniComputeCodeStore,Integer>

Specialization of BackEndFactory for uniprocessor backend. Provides some specializations for the uniprocssor backend directly, and links to others in separate classes.

Author:
dimock

Field Summary
static String iterationBound
          name of variable used as bound for number of iterations.
 
Fields inherited from class at.dms.kjc.backendSupport.BackEndFactory
layout
 
Constructor Summary
UniBackEndFactory(Integer numProcessors)
          Constructor if creating UniBackEndFactory before layout Creates numProcessors processors.
UniBackEndFactory(UniProcessors processors)
          Constructor if creating UniBackEndFactory after layout.
 
Method Summary
 BackEndScaffold getBackEndMain()
           
 Channel getChannel(Edge e)
          Back end needs to generate subclasses of channel.
 Channel getChannel(SliceNode src, SliceNode dst)
          Back end needs to generate subclasses of channel.
 CodeStoreHelper getCodeStoreHelper(SliceNode node)
          Select a CodeStoreHelper subclass given a SliceNode.
 UniComputeCodeStore getComputeCodeStore(UniProcessor parent)
           
 UniProcessor getComputeNode(Integer specifier)
          Get a specified compute node.
 UniProcessors getComputeNodes()
           
 void processFilterSliceNode(FilterSliceNode filter, SchedulingPhase whichPhase, UniProcessors computeNodes)
          Process a filter slice node: find the correct ProcElement(s) and add code and buffers.
 void processFilterSlices(Slice slice, SchedulingPhase whichPhase, UniProcessors computeNodes)
          Process all filter slice nodes in a Slice (just one in a SimpleSlice): find the correct ProcElement(s) and add filter code.
 void processInputSliceNode(InputSliceNode input, SchedulingPhase whichPhase, UniProcessors computeNodes)
          Process an input slice node: find the correct ProcElement(s) and add joiner code, and buffers.
 void processOutputSliceNode(OutputSliceNode output, SchedulingPhase whichPhase, UniProcessors computeNodes)
          Process an output slice node: find the correct ProcElement(s) and add splitter code, and buffers.
 
Methods inherited from class at.dms.kjc.backendSupport.BackEndFactory
getChannels, getLayout, setLayout, sliceHasDownstreamChannel, sliceHasUpstreamChannel, sliceNeedsJoinerCode, sliceNeedsJoinerWorkFunction, sliceNeedsPeekBuffer, sliceNeedsPokeBuffer, sliceNeedsSplitterCode, sliceNeedsSplitterWorkFunction
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

iterationBound

public static final String iterationBound
name of variable used as bound for number of iterations.

See Also:
Constant Field Values
Constructor Detail

UniBackEndFactory

public UniBackEndFactory(Integer numProcessors)
Constructor if creating UniBackEndFactory before layout Creates numProcessors processors.

Parameters:
numProcessors - number of processors to create.

UniBackEndFactory

public UniBackEndFactory(UniProcessors processors)
Constructor if creating UniBackEndFactory after layout. Call it with same collection of processors used in Layout.

Parameters:
processors - the existing collection of processors.
Method Detail

getBackEndMain

public BackEndScaffold getBackEndMain()
Specified by:
getBackEndMain in class BackEndFactory<UniProcessors,UniProcessor,UniComputeCodeStore,Integer>
Returns:
Singleton to generate Channels and ComputeCodeStores for the ComputeNodes.

getComputeNodes

public UniProcessors getComputeNodes()
Specified by:
getComputeNodes in class BackEndFactory<UniProcessors,UniProcessor,UniComputeCodeStore,Integer>
Returns:
Get the (unique) collection of nodes involved in computation.

getComputeCodeStore

public UniComputeCodeStore getComputeCodeStore(UniProcessor parent)
Specified by:
getComputeCodeStore in class BackEndFactory<UniProcessors,UniProcessor,UniComputeCodeStore,Integer>
Returns:
A (unique per parent) ComputeCodeStore.

getComputeNode

public UniProcessor getComputeNode(Integer specifier)
Description copied from class: BackEndFactory
Get a specified compute node. Assumes that BackEndFactory.getComputeNodes() returns a collection of ComputeNode including the desired node.

Specified by:
getComputeNode in class BackEndFactory<UniProcessors,UniProcessor,UniComputeCodeStore,Integer>
Parameters:
specifier - Different instantiations will have different number of arguments to specify which node, so a specifier (String, int, array[int]...) here.
Returns:
a (unique per specifier) ComputeNode

processInputSliceNode

public void processInputSliceNode(InputSliceNode input,
                                  SchedulingPhase whichPhase,
                                  UniProcessors computeNodes)
Process an input slice node: find the correct ProcElement(s) and add joiner code, and buffers. please delegate work to some other object.

Specified by:
processInputSliceNode in class BackEndFactory<UniProcessors,UniProcessor,UniComputeCodeStore,Integer>
Parameters:
input - the InputSliceNode
whichPhase - INIT / PRIMEPUMP / STEADY
rawChip - the available compute nodes.

processFilterSlices

public void processFilterSlices(Slice slice,
                                SchedulingPhase whichPhase,
                                UniProcessors computeNodes)
Process all filter slice nodes in a Slice (just one in a SimpleSlice): find the correct ProcElement(s) and add filter code. please delegate work to some other object.

Specified by:
processFilterSlices in class BackEndFactory<UniProcessors,UniProcessor,UniComputeCodeStore,Integer>
Parameters:
slice - Slice containing filters
whichPhase - INIT / PRIMEPUMP / STEADY
computeNodes - the available compute nodes.

processFilterSliceNode

public void processFilterSliceNode(FilterSliceNode filter,
                                   SchedulingPhase whichPhase,
                                   UniProcessors computeNodes)
Process a filter slice node: find the correct ProcElement(s) and add code and buffers. please delegate work to some other object.

Specified by:
processFilterSliceNode in class BackEndFactory<UniProcessors,UniProcessor,UniComputeCodeStore,Integer>
Parameters:
filter - the FilterSliceNode.
whichPhase - INIT / PRIMEPUMP / STEADY
computeNodes - the available compute nodes.

processOutputSliceNode

public void processOutputSliceNode(OutputSliceNode output,
                                   SchedulingPhase whichPhase,
                                   UniProcessors computeNodes)
Process an output slice node: find the correct ProcElement(s) and add splitter code, and buffers. please delegate work to some other object.

Specified by:
processOutputSliceNode in class BackEndFactory<UniProcessors,UniProcessor,UniComputeCodeStore,Integer>
Parameters:
output - the OutputSliceNode.
whichPhase - INIT / PRIMEPUMP / STEADY
computeNodes - the available compute nodes.

getChannel

public Channel getChannel(Edge e)
Description copied from class: BackEndFactory
Back end needs to generate subclasses of channel. Routine here to get a channel that implements communication over an edge.

Specified by:
getChannel in class BackEndFactory<UniProcessors,UniProcessor,UniComputeCodeStore,Integer>
Parameters:
e - the edge.
Returns:
a channel: preexisting or newly created.

getChannel

public Channel getChannel(SliceNode src,
                          SliceNode dst)
Description copied from class: BackEndFactory
Back end needs to generate subclasses of channel. Routine here to get a channel from a source to a destination.

Specified by:
getChannel in class BackEndFactory<UniProcessors,UniProcessor,UniComputeCodeStore,Integer>
Returns:
a channel: preexisting or newly created.

getCodeStoreHelper

public CodeStoreHelper getCodeStoreHelper(SliceNode node)
Description copied from class: BackEndFactory
Select a CodeStoreHelper subclass given a SliceNode. A CodeStoreHelper generates wrapper code combining code for channels with code for a SliceNode.

Specified by:
getCodeStoreHelper in class BackEndFactory<UniProcessors,UniProcessor,UniComputeCodeStore,Integer>
Parameters:
node - the SliceNode.
Returns:
an instance of CodeStoreHelper