at.dms.kjc.spacetime
Class RawExecutionCode

java.lang.Object
  extended by at.dms.kjc.spacetime.RawExecutionCode
Direct Known Subclasses:
BufferedCommunication, DirectCommunication

public abstract class RawExecutionCode
extends Object

This abstract class defines an interface for filter code generators. These generator add code necessary to execute the filter on raw, generating SIR code.

Author:
mgordon

Field Summary
static String ARRAY_COPY
           
static String ARRAY_INDEX
           
static String arrayReceiveMethod
           
static String exeIndex
           
static String exeIndex1
           
protected  FilterInfo filterInfo
           
protected  boolean gdnInput
          true if this filter has dynamic network input, this will only happen when the filters is connected to a inputtracenode and on the dynamic net
protected  boolean gdnOutput
          true if this filter has dynamic network output, this will only happen if hte filter is connected to an outputtrcenode allocated to the gdn
static String gdnReceiveMethod
           
static String gdnSendMethod
           
protected  GeneratedVariables generatedVariables
           
static String initSchedFunction
           
static String initStage
           
protected static boolean INLINE_WORK
           
protected  Layout layout
           
protected  JMethodDeclaration primePumpMethod
          the method that executes each stage of the prime pump schedule
static String primePumpStage
           
static String rateMatchSendMethod
           
static String recvBuffer
          fields for the var names we introduce
static String recvBufferBits
           
static String recvBufferIndex
           
static String recvBufferSize
           
static String recvIndex
           
static String sendBuffer
           
static String sendBufferIndex
           
static String simpleIndex
           
static String staticReceiveMethod
           
static String staticSendMethod
           
static String steadySchedFunction
           
static String steadyStage
           
static String structReceiveMethodPrefix
           
static String structReceivePrefix
          the prefix for the c method to receive structs over a network
static String structReceivePrefixDynamic
          the c method that is used to receive structs over the gdn
static String structReceivePrefixStatic
          the c method that is used to receive structs over the static net
protected  RawTile tile
          the tile this filter is mapped to
protected  int uniqueID
           
static String workCounter
           
 
Constructor Summary
RawExecutionCode(RawTile tile, FilterInfo filterInfo, Layout layout)
           
 
Method Summary
static JStatement boundToSwitchStmt(int constant)
           
static JStatement constToSwitchStmt(int constant)
           
protected  JBlock gdnCacheAlign(boolean init)
          Generate code to complete the dram transactions because we have to align dram transfers to cache-line sized transfers.
static JBlock gdnDisregardIncoming(int words)
           
static JBlock gdnDummyOutgoing(int words)
           
 JStatement gdnReceive(boolean integer, JExpression recvInto)
           
abstract  JMethodDeclaration[] getHelperMethods()
           
abstract  JMethodDeclaration getInitStageMethod()
           
abstract  JMethodDeclaration getPrimePumpMethod()
           
abstract  JBlock getSteadyBlock()
           
static int getUniqueID()
           
abstract  JFieldDeclaration[] getVarDecls()
           
protected  void sendRatesToSwitch(FilterInfo filterInfo, JBlock workBlock)
          If we are in the prime pump or the steady state, we may be compressing the switch code and if so, we need to send the push rate and the pop rate to the switch for loop bounds.
 JStatement setDynMsgHeader()
           
protected  JStatement setupGDNStore(SchedulingPhase whichPhase)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

structReceivePrefix

public static String structReceivePrefix
the prefix for the c method to receive structs over a network


structReceivePrefixStatic

public static String structReceivePrefixStatic
the c method that is used to receive structs over the static net


structReceivePrefixDynamic

public static String structReceivePrefixDynamic
the c method that is used to receive structs over the gdn


INLINE_WORK

protected static final boolean INLINE_WORK
See Also:
Constant Field Values

recvBuffer

public static String recvBuffer
fields for the var names we introduce


recvBufferSize

public static String recvBufferSize

recvBufferBits

public static String recvBufferBits

sendBuffer

public static String sendBuffer

sendBufferIndex

public static String sendBufferIndex

rateMatchSendMethod

public static String rateMatchSendMethod

recvBufferIndex

public static String recvBufferIndex

recvIndex

public static String recvIndex

simpleIndex

public static String simpleIndex

exeIndex

public static String exeIndex

exeIndex1

public static String exeIndex1

ARRAY_INDEX

public static String ARRAY_INDEX

ARRAY_COPY

public static String ARRAY_COPY

initSchedFunction

public static String initSchedFunction

steadySchedFunction

public static String steadySchedFunction

staticReceiveMethod

public static String staticReceiveMethod

gdnReceiveMethod

public static String gdnReceiveMethod

staticSendMethod

public static String staticSendMethod

gdnSendMethod

public static String gdnSendMethod

structReceiveMethodPrefix

public static String structReceiveMethodPrefix

arrayReceiveMethod

public static String arrayReceiveMethod

initStage

public static String initStage

steadyStage

public static String steadyStage

primePumpStage

public static String primePumpStage

workCounter

public static String workCounter

uniqueID

protected int uniqueID

generatedVariables

protected GeneratedVariables generatedVariables

filterInfo

protected FilterInfo filterInfo

primePumpMethod

protected JMethodDeclaration primePumpMethod
the method that executes each stage of the prime pump schedule


gdnInput

protected boolean gdnInput
true if this filter has dynamic network input, this will only happen when the filters is connected to a inputtracenode and on the dynamic net


gdnOutput

protected boolean gdnOutput
true if this filter has dynamic network output, this will only happen if hte filter is connected to an outputtrcenode allocated to the gdn


tile

protected RawTile tile
the tile this filter is mapped to


layout

protected Layout layout
Constructor Detail

RawExecutionCode

public RawExecutionCode(RawTile tile,
                        FilterInfo filterInfo,
                        Layout layout)
Method Detail

getUniqueID

public static int getUniqueID()

getVarDecls

public abstract JFieldDeclaration[] getVarDecls()

getHelperMethods

public abstract JMethodDeclaration[] getHelperMethods()

getInitStageMethod

public abstract JMethodDeclaration getInitStageMethod()
Returns:
the method we should call to execute the init stage.

getSteadyBlock

public abstract JBlock getSteadyBlock()
Returns:
The block we should inline to execute the steady-state

getPrimePumpMethod

public abstract JMethodDeclaration getPrimePumpMethod()
Returns:
The method to call for one execution of the filter in the prime pump stage.

constToSwitchStmt

public static JStatement constToSwitchStmt(int constant)

boundToSwitchStmt

public static JStatement boundToSwitchStmt(int constant)

setupGDNStore

protected JStatement setupGDNStore(SchedulingPhase whichPhase)
Parameters:
init - true if init
primepump - true if primepump
Returns:
The SIR code necessary to set the dynamic message header used when we send data over the gdn. Also, if we are sending data to a dram that we are not the owner of and no other filter in our slice is allocated to the owner tile, we have to wait until we receive a word over that static network (it will be from the owner), this will tell us that the owner of the dram has issued the store command to the dram and we can proceed with writing data to the dram.

gdnReceive

public JStatement gdnReceive(boolean integer,
                             JExpression recvInto)
Parameters:
integer - if true use csti_integer, false use csti_fp
recvInto - The expression to receive into
Returns:
A statement to receive into
recvInto
from the static network.

setDynMsgHeader

public JStatement setDynMsgHeader()
Returns:
The SIR code necessary to set the dynamic message header used when we send data over the gdn.

sendRatesToSwitch

protected void sendRatesToSwitch(FilterInfo filterInfo,
                                 JBlock workBlock)
If we are in the prime pump or the steady state, we may be compressing the switch code and if so, we need to send the push rate and the pop rate to the switch for loop bounds. This function will decide if we need to do that and if so, do it (append the ins to
workBlock
).

Parameters:
filterInfo -
workBlock -

gdnDisregardIncoming

public static JBlock gdnDisregardIncoming(int words)
Parameters:
words -
Returns:
Return code to receive
words
words into a dummy variable defined in TraceIRToC over the gdn.

gdnDummyOutgoing

public static JBlock gdnDummyOutgoing(int words)
Parameters:
words -
Returns:
Return code to send
words
words over the gdn using a predefined header.

gdnCacheAlign

protected JBlock gdnCacheAlign(boolean init)
Generate code to complete the dram transactions because we have to align dram transfers to cache-line sized transfers. Only do this if we are sending or receiving over the gdn. ??param wordsSent The number of words sent during the execution of the stage. ??param wordsReceived The number of words received during the execution of the stage.

Parameters:
init - Are we in the init stage? Used to calculate the number of items we generate and receive.
Returns:
???