at.dms.kjc.cell
Class CellBackendFactory

java.lang.Object
  extended by at.dms.kjc.backendSupport.BackEndFactory<CellChip,CellPU,CellComputeCodeStore,Integer>
      extended by at.dms.kjc.cell.CellBackendFactory

public class CellBackendFactory
extends BackEndFactory<CellChip,CellPU,CellComputeCodeStore,Integer>


Constructor Summary
CellBackendFactory(CellChip processors)
          Constructor if creating UniBackEndFactory after layout.
CellBackendFactory(Integer numProcessors)
          Constructor if creating UniBackEndFactory before layout Creates numProcessors processors.
 
Method Summary
 CellBackendScaffold getBackEndMain()
           
 int getCellPUNum(CellPU cpu)
           
 int getCellPUNumForFilter(FilterSliceNode filterNode)
           
 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.
 CellComputeCodeStore getComputeCodeStore(CellPU parent)
           
 CellPU getComputeNode(Integer specifier)
          Get a specified compute node.
 CellChip getComputeNodes()
           
 Layout<CellPU> getLayout()
          Get saved copy of Layout.
 PPU getPPU()
           
 LinkedList<SPU> getSPUs()
           
 void processFilterSliceNode(FilterSliceNode filter, SchedulingPhase whichPhase, CellChip computeNodes)
          Process a filter slice node: find the correct ProcElement(s) and add code and buffers.
 void processFilterSlices(Slice slice, SchedulingPhase whichPhase, CellChip 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, CellChip computeNodes)
          Process an input slice node: find the correct ProcElement(s) and add joiner code, and buffers.
 void processOutputSliceNode(OutputSliceNode output, SchedulingPhase whichPhase, CellChip computeNodes)
          Process an output slice node: find the correct ProcElement(s) and add splitter code, and buffers.
 void setLayout(Layout<CellPU> layout)
          Keep a copy of the Layout: the mapping from SliceNode to ComputeNode.
 
Methods inherited from class at.dms.kjc.backendSupport.BackEndFactory
getChannels, 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
 

Constructor Detail

CellBackendFactory

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

Parameters:
numProcessors - number of processors to create.

CellBackendFactory

public CellBackendFactory(CellChip 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 CellBackendScaffold getBackEndMain()
Specified by:
getBackEndMain in class BackEndFactory<CellChip,CellPU,CellComputeCodeStore,Integer>
Returns:
Singleton to generate Channels and ComputeCodeStores for the ComputeNodes.

setLayout

public void setLayout(Layout<CellPU> layout)
Description copied from class: BackEndFactory
Keep a copy of the Layout: the mapping from SliceNode to ComputeNode.

Overrides:
setLayout in class BackEndFactory<CellChip,CellPU,CellComputeCodeStore,Integer>

getLayout

public Layout<CellPU> getLayout()
Description copied from class: BackEndFactory
Get saved copy of Layout.

Overrides:
getLayout in class BackEndFactory<CellChip,CellPU,CellComputeCodeStore,Integer>
Returns:

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<CellChip,CellPU,CellComputeCodeStore,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<CellChip,CellPU,CellComputeCodeStore,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<CellChip,CellPU,CellComputeCodeStore,Integer>
Parameters:
node - the SliceNode.
Returns:
an instance of CodeStoreHelper

getComputeCodeStore

public CellComputeCodeStore getComputeCodeStore(CellPU parent)
Specified by:
getComputeCodeStore in class BackEndFactory<CellChip,CellPU,CellComputeCodeStore,Integer>
Returns:
A (unique per parent) ComputeCodeStore.

getComputeNode

public CellPU 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<CellChip,CellPU,CellComputeCodeStore,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

getComputeNodes

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

getPPU

public PPU getPPU()

getSPUs

public LinkedList<SPU> getSPUs()

getCellPUNumForFilter

public int getCellPUNumForFilter(FilterSliceNode filterNode)

getCellPUNum

public int getCellPUNum(CellPU cpu)

processFilterSliceNode

public void processFilterSliceNode(FilterSliceNode filter,
                                   SchedulingPhase whichPhase,
                                   CellChip computeNodes)
Description copied from class: BackEndFactory
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<CellChip,CellPU,CellComputeCodeStore,Integer>
Parameters:
filter - the FilterSliceNode.
whichPhase - INIT / PRIMEPUMP / STEADY
computeNodes - the available compute nodes.

processFilterSlices

public void processFilterSlices(Slice slice,
                                SchedulingPhase whichPhase,
                                CellChip computeNodes)
Description copied from class: BackEndFactory
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<CellChip,CellPU,CellComputeCodeStore,Integer>
Parameters:
slice - Slice containing filters
whichPhase - INIT / PRIMEPUMP / STEADY
computeNodes - the available compute nodes.

processInputSliceNode

public void processInputSliceNode(InputSliceNode input,
                                  SchedulingPhase whichPhase,
                                  CellChip computeNodes)
Description copied from class: BackEndFactory
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<CellChip,CellPU,CellComputeCodeStore,Integer>
Parameters:
input - the InputSliceNode
whichPhase - INIT / PRIMEPUMP / STEADY
computeNodes - the available compute nodes.

processOutputSliceNode

public void processOutputSliceNode(OutputSliceNode output,
                                   SchedulingPhase whichPhase,
                                   CellChip computeNodes)
Description copied from class: BackEndFactory
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<CellChip,CellPU,CellComputeCodeStore,Integer>
Parameters:
output - the OutputSliceNode.
whichPhase - INIT / PRIMEPUMP / STEADY
computeNodes - the available compute nodes.