at.dms.kjc.backendSupport
Class GetOrMakeChannel

java.lang.Object
  extended by at.dms.kjc.backendSupport.GetOrMakeChannel
Direct Known Subclasses:
GetOrMakeCellChannel

public class GetOrMakeChannel
extends Object

Create channels of appropriate type for a back end. Provided version creates channels in shared memory, but can be overridden as necessary.

Author:
dimock

Field Summary
protected  BackEndFactory backEndBits
           
 
Constructor Summary
GetOrMakeChannel(BackEndFactory backEndBits)
          Crete a channel selector giving it a BackEndFactory to query.
 
Method Summary
 Channel getOrMakeChannel(Edge e)
          Given an edge e, make the correct sort of channel for it.
protected  Channel makeInterSliceChannel(InterSliceEdge e)
          Create channel between slices.
protected  Channel makeIntraSliceChannel(Edge e)
          For an edge within a slice, create a channel that implements that edge.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

backEndBits

protected BackEndFactory backEndBits
Constructor Detail

GetOrMakeChannel

public GetOrMakeChannel(BackEndFactory backEndBits)
Crete a channel selector giving it a BackEndFactory to query.

Parameters:
backendBits -
Method Detail

getOrMakeChannel

public Channel getOrMakeChannel(Edge e)
Given an edge e, make the correct sort of channel for it.

Parameters:
e - an edge.
Returns:
an existing channel if one exists, else a newly made channel.

makeIntraSliceChannel

protected Channel makeIntraSliceChannel(Edge e)
For an edge within a slice, create a channel that implements that edge. The provided code assumes that (1) there are no filter->filter edges. (2) That there is never a need to buffer data between a filter and a following splitter (i.e. the inter-slice channels connected to by the splitter will provide any necessary bufferring). If this assumption changes then update this code to handle the case.

This routine may need to be overridden in the case where it is necessary to buffer data off chip between a joiner and a filter or between a filter and a splitter, or in the case where we are not using simple slices and there are filter->filter edges.

Parameters:
e - an Edge
Returns:
a channel that implements the edge or null if no data passes over the edge.

makeInterSliceChannel

protected Channel makeInterSliceChannel(InterSliceEdge e)
Create channel between slices. The default version here assumes shared memory, and implements a channel as an array.

A subclass may call super.makeInterSliceChannel(e) if both ends of the channel are laid out on the same ComputeNode and if using an array in the ComputeNode's memory is an appropriate way of communicating. Otherwise a subclass will make a channel of the appropriate type.