at.dms.kjc.spacetime
Class DirectCommunication

java.lang.Object
  extended by at.dms.kjc.spacetime.RawExecutionCode
      extended by at.dms.kjc.spacetime.DirectCommunication

public class DirectCommunication
extends RawExecutionCode

If we can, this class will generate filter code that does not use a peek buffer, so just read the values from the static network and write them to the static network. It will only work if the code does not peek and if it has all pops before pushes. It adheres to the interface defined in RawExecutionCode.

Author:
mgordon

Field Summary
 
Fields inherited from class at.dms.kjc.spacetime.RawExecutionCode
ARRAY_COPY, ARRAY_INDEX, arrayReceiveMethod, exeIndex, exeIndex1, filterInfo, gdnInput, gdnOutput, gdnReceiveMethod, gdnSendMethod, generatedVariables, initSchedFunction, initStage, INLINE_WORK, layout, primePumpMethod, primePumpStage, rateMatchSendMethod, recvBuffer, recvBufferBits, recvBufferIndex, recvBufferSize, recvIndex, sendBuffer, sendBufferIndex, simpleIndex, staticReceiveMethod, staticSendMethod, steadySchedFunction, steadyStage, structReceiveMethodPrefix, structReceivePrefix, structReceivePrefixDynamic, structReceivePrefixStatic, tile, uniqueID, workCounter
 
Constructor Summary
DirectCommunication(RawTile tile, FilterInfo filterInfo, Layout layout)
          Create a new object that is ready to convert filterInfo's communication into direct communication over Raw's network.
 
Method Summary
 JMethodDeclaration[] getHelperMethods()
          Return an array of methods for any helper methods that we create or that were present in this filter.
 JMethodDeclaration getInitStageMethod()
          Calculate and return the method that implements the init stage computation for this filter.
 JMethodDeclaration getPrimePumpMethod()
          Calculate and return the method that will implement one execution of this filter in the primepump stage.
 JBlock getSteadyBlock()
          Return the block to call the work function in the steady state
 JFieldDeclaration[] getVarDecls()
          Return the variables that are generated by this pass and that need to be added to the fields of the tile.
static boolean testDC(FilterInfo fi)
          Test if we can generate direct communication code for this filter meaning there are no peeks, that all pops come before all pushes, its not a two stage filter, and it does not have items remaining on its inputs buffer after the init stage.
 
Methods inherited from class at.dms.kjc.spacetime.RawExecutionCode
boundToSwitchStmt, constToSwitchStmt, gdnCacheAlign, gdnDisregardIncoming, gdnDummyOutgoing, gdnReceive, getUniqueID, sendRatesToSwitch, setDynMsgHeader, setupGDNStore
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DirectCommunication

public DirectCommunication(RawTile tile,
                           FilterInfo filterInfo,
                           Layout layout)
Create a new object that is ready to convert filterInfo's communication into direct communication over Raw's network.

Parameters:
tile - The tile filterInfo is mapped to.
filterInfo - The filter to convert.
layout - The layout of the application.
Method Detail

testDC

public static boolean testDC(FilterInfo fi)
Test if we can generate direct communication code for this filter meaning there are no peeks, that all pops come before all pushes, its not a two stage filter, and it does not have items remaining on its inputs buffer after the init stage.

Parameters:
fi - The filter.
Returns:
True if we can generate direct communication code (no peek buffer) for the filter.

getVarDecls

public JFieldDeclaration[] getVarDecls()
Return the variables that are generated by this pass and that need to be added to the fields of the tile.

Specified by:
getVarDecls in class RawExecutionCode
Returns:
The variables that are generated by this pass.

getPrimePumpMethod

public JMethodDeclaration getPrimePumpMethod()
Calculate and return the method that will implement one execution of this filter in the primepump stage. This method may be called multiple times depending on the number of stages in the primepump stage itself.

Specified by:
getPrimePumpMethod in class RawExecutionCode
Returns:
The method that implements one stage of the primepump exeuction of this filter.

getInitStageMethod

public JMethodDeclaration getInitStageMethod()
Calculate and return the method that implements the init stage computation for this filter. It should be called only once in the generated code.

This does not include the call to the init function of the filter. That is done in ComputeCodeStore.addInitFunctionCall(at.dms.kjc.JMethodDeclaration).

Specified by:
getInitStageMethod in class RawExecutionCode
Returns:
The method that implements the init stage for this filter.

getHelperMethods

public JMethodDeclaration[] getHelperMethods()
Return an array of methods for any helper methods that we create or that were present in this filter. They need to be added to the methods of the entire tile.

Specified by:
getHelperMethods in class RawExecutionCode
Returns:
helper methods that need to be placed in the tile's code.

getSteadyBlock

public JBlock getSteadyBlock()
Return the block to call the work function in the steady state

Specified by:
getSteadyBlock in class RawExecutionCode
Returns:
The block we should inline to execute the steady-state