Offload API

This is the Offload API which is used to send work requests to special purpose hardware. More...

Data Structures

struct  __dma_list_entry
 DMAListEntry : A structure that contains a single entry of a DMA list. More...
struct  __wr_group
 WRGroup is used to specify a collection of Work Requests. More...
struct  __work_request
 WorkRequest is used to keep track of and access outstanding work requests. More...
struct  __spe_thread
 An SPE Thread structures which is Used to maintain information about a particular SPE thread that is running on an SPE. More...

Typedefs

typedef __dma_list_entry DMAListEntry
 DMAListEntry : A structure that contains a single entry of a DMA list.
typedef __wr_group WRGroup
 WRGroup is used to specify a collection of Work Requests.
typedef WRGroupWRGroupHandle
 WRGroupHandle structure that is used by Offload API calls.
typedef __work_request WorkRequest
 WorkRequest is used to keep track of and access outstanding work requests.
typedef WorkRequestWRHandle
 WRHandle structure that is used by Offload API calls.
typedef __spe_thread SPEThread
 An SPE Thread structures which is Used to maintain information about a particular SPE thread that is running on an SPE.

Functions

int InitOffloadAPI (void(*cbFunc)(void *) DEFAULT_TO_NULL, void(*gcbFunc)(void *) DEFAULT_TO_NULL, void(*errorFunc)(int, void *, WRHandle) DEFAULT_TO_NULL, char *timingFileName DEFAULT_TO_NULL)
 Initialization function.
void CloseOffloadAPI ()
 Close function.
WRHandle sendWorkRequest (int funcIndex, void *readWritePtr, int readWriteLen, void *readOnlyPtr, int readOnlyLen, void *writeOnlyPtr, int writeOnlyLen, void *userData DEFAULT_TO_NULL, unsigned int flags DEFAULT_TO_NONE, void(*callbackFunc)(void *) DEFAULT_TO_NULL, WRGroupHandle wrGroupHandle DEFAULT_TO_NULL, unsigned int speAffinityMask DEFAULT_TO_ALLSET)
 Creates and sends a work request to one of the SPEs.
WRHandle sendWorkRequest_list (int funcIndex, unsigned int eah, DMAListEntry *dmaList, int numReadOnly, int numReadWrite, int numWriteOnly, void *userData DEFAULT_TO_NULL, unsigned int flags DEFAULT_TO_NONE, void(*callbackFunc)(void *) DEFAULT_TO_NULL, WRGroupHandle wrGroupHandle DEFAULT_TO_NULL, unsigned int speAffinityMask DEFAULT_TO_ALLSET)
 Creates and sends a work request to one of the SPEs.
int isFinished (WRHandle wrHandle)
 Used to check if the specified work request has finished executing (including out-bound data being DMAed back into main memory).
void waitForWRHandle (WRHandle wrHandle)
 Used to wait for the specified WRHandle to finish.
WRGroupHandle createWRGroup (void *userData DEFAULT_TO_NULL, void(*callbackFunc)(void *) DEFAULT_TO_NULL)
 Used to create a Work Request Group to which Work Requests may be added.
void completeWRGroup (WRGroupHandle wrGroupHandle)
 Used to inidicate that all the Work Requests that will be added to the specified Work Request Group have been added.
int isWRGroupFinished (WRGroupHandle wrGroupHandle)
 Used to check whether or not a Work Request Group has finished.
void waitForWRGroupHandle (WRGroupHandle wrGroupHandle)
 Used to wait for a Work Reqeuest Group to finish.
void OffloadAPIProgress ()
 Used to allow the Offload API to make progress.
void OffloadAPIDisplayConfig (FILE *fout)
 Use to display the configuration of the Offload API in the specified file.
int getWorkRequestID (WRHandle wrHandle)
void enableTrace ()
void disableTrace ()
void displayLastWRTimes ()

Variables

spe_program_handle_t spert_main
 The symbol name of the SPE executable that should be linked with the main code.

Detailed Description

This is the Offload API which is used to send work requests to special purpose hardware.

Currently, only IBM's Cell processor is supported. As such, the Offload API is structured around this use. The user supplies a function (funcLookup()) in their code for the SPE. The user can then make work requests to the Offload API. The Offload API will then take care of moving user data (buffers), scheduling the SPE's, etc. Once everything is ready, the user's SPE code (through the user provided funcLookup() function) is called and user defined code is executed on the SPE. Once finished, the Offload API takes care of moving all the data back to main memory and notifying the main processor (the PPE) that the work request has finished.

The prototype for the user provided funcLookup() functions is as follows.

void funcLookup(int funcIndex, void* readWriteptr, int readWriteLen, void* readOnlyPtr, int readOnlyLen, void* writeOnlyPtr, int writeOnlyLen, DMAListEntry* dmaList );

For standard work requests, dmaList will be null. For scatter/gather work requests, the other pointer parameters will be NULL. The xxxLen parameters also have different units based on the type of the work request (in bytes for standard, in units of DMAListEntry structures for scatter/gather). See the documentation for the WorkRequest data atructure for more information on the arguments.


Typedef Documentation

typedef struct __dma_list_entry DMAListEntry

DMAListEntry : A structure that contains a single entry of a DMA list.

typedef struct __wr_group WRGroup

WRGroup is used to specify a collection of Work Requests.

typedef WRGroup* WRGroupHandle

WRGroupHandle structure that is used by Offload API calls.

Definition at line 126 of file spert_ppu.h.

typedef struct __work_request WorkRequest

WorkRequest is used to keep track of and access outstanding work requests.

typedef WorkRequest* WRHandle

WRHandle structure that is used by Offload API calls.

This is what the caller (user of Offload API) keeps track of.

Definition at line 165 of file spert_ppu.h.

typedef struct __spe_thread SPEThread

An SPE Thread structures which is Used to maintain information about a particular SPE thread that is running on an SPE.


Function Documentation

int InitOffloadAPI ( void(*)(void *) DEFAULT_TO_NULL  cbFunc,
void(*)(void *) DEFAULT_TO_NULL  gcbFunc,
void(*)(int, void *, WRHandle) DEFAULT_TO_NULL  errorFunc,
char *timingFileName  DEFAULT_TO_NULL 
)

Initialization function.

This function should be called before any other function in the Offload API. It should only be called once. If no callback function is specified, the isFinished() call should be used to both detect when a work request is finished and to clean-up the WRHandle (see the isFinished() function).

Returns:
Non-zero on success.
Parameters:
cbFunc  Pointer to a function that should be called when a work request completes
gcbFunc  Pointer to a function that should be called when a group of work requests completes
errorFunc  Pointer to a function that should be called if an error is returned by a Work Request on one of the SPEs
DEFAULT_TO_NULL  Pointer to a string containing a file name which will be used when timing data is being produced

Referenced by CmiInitCell().

void CloseOffloadAPI (  ) 

Close function.

This function should be called after all other function calls to the Offload API have been made. It should only be called once.

Referenced by ConverseCommonExit().

WRHandle sendWorkRequest ( int  funcIndex,
void *  readWritePtr,
int  readWriteLen,
void *  readOnlyPtr,
int  readOnlyLen,
void *  writeOnlyPtr,
int  writeOnlyLen,
void *userData  DEFAULT_TO_NULL,
unsigned int flags  DEFAULT_TO_NONE,
void(*)(void *) DEFAULT_TO_NULL  callbackFunc,
WRGroupHandle wrGroupHandle  DEFAULT_TO_NULL,
unsigned int speAffinityMask  DEFAULT_TO_ALLSET 
)

Creates and sends a work request to one of the SPEs.

This method of sending a work request is considered the standard way of sending work requests. Only one of each type of buffer (read/write, read-only, write-only) may be specified (unless one of the WORK_REQUEST_FLAG_RW_IS_RO and WORK_REQUEST_FLAG_RW_IS_WO flags are used).

Returns:
INVALID_WRHandle on failure, a valid WRHandle otherwise.
Parameters:
funcIndex  Index of the function to be called
readWritePtr  Pointer to a readWrite buffer (read before execution, written after)
readWriteLen  Length (in bytes) of the buffer pointed to by readWritePtr
readOnlyPtr  Pointer to a readOnly buffer (read before execution)
readOnlyLen  Length (in bytes) of the buffer pointed to by readOnlyPtr
writeOnlyPtr  Pointer to a writeOnly buffer (written after execution)
writeOnlyLen  Length (in bytes) of the buffer pointed to by writeOnlyPtr
DEFAULT_TO_NULL  A pointer to user defined data that will be passed to the callback function (if there is one) once this request is finished
DEFAULT_TO_NONE  Flags for the work request (see WORK_REQUEST_FLAGS_xxx defines)
callbackFunc  A callback function to use specifically for this work request
DEFAULT_TO_NULL  A handle to a Work Request Group that this Work Request will be added to
DEFAULT_TO_ALLSET  The logical SPE that this work request should be executed on

WRHandle sendWorkRequest_list ( int  funcIndex,
unsigned int  eah,
DMAListEntry dmaList,
int  numReadOnly,
int  numReadWrite,
int  numWriteOnly,
void *userData  DEFAULT_TO_NULL,
unsigned int flags  DEFAULT_TO_NONE,
void(*)(void *) DEFAULT_TO_NULL  callbackFunc,
WRGroupHandle wrGroupHandle  DEFAULT_TO_NULL,
unsigned int speAffinityMask  DEFAULT_TO_ALLSET 
)

Creates and sends a work request to one of the SPEs.

This method of sending a work request is considered a scatter/gather type of work request. Zero-or-more of each kind of buffer (read/write, read-only, write-only) may be specified through the use of the dma list. The DMAListEntry array pointed to by the dmaList parameter should have all of the read-only buffers listed first (numReadOnly of them), followed by all of the read/write buffers (numReadWrite of them), and finally all of the write-only buffers (numWriteOnly of them).

Returns:
INVALID_WRHandle on failure, a valid WRHandle otherwise.
Parameters:
funcIndex  Index of the function to be called
eah  Upper 32-bits of the effective addresses in dma list
dmaList  List of dma list entries (lower 32-bits of effective address and size)
numReadOnly  Number read only pointers in dmaList (should be first in list... i.e. - All readOnly pointers should be before all other types of pointers in dmaList)
numReadWrite  Number of read/write pointers in dmaList (should be second in list... i.e. - All read/write pointers should be after all readOnly pointers and before all writeOnly pointers in dmaList)
numWriteOnly  Number of write only pointers in dmaList (should be third in list... i.e. - After all other types of pointers in dmaList)
DEFAULT_TO_NULL  A pointer to user defined data that will be passed to the callback function (if there is one) once this request is finished
DEFAULT_TO_NONE  Flags for the work requests (see WORK_REQUEST_FLAGS_xxx defines)
callbackFunc  A callback function to use specifically for this work request
DEFAULT_TO_NULL  A handle to a Work Request Group that this Work Request will be added to
DEFAULT_TO_ALLSET  The logical SPE that this work request should be executed on

int isFinished ( WRHandle  wrHandle  ) 

Used to check if the specified work request has finished executing (including out-bound data being DMAed back into main memory).

If no callback function was specified when InitOffloadAPI() was called, this function must be called to clean up the WRHandle if the work request has finished (NOTE: waitForWRHandle() will also clean up the WRHandle.) If a callback function was passed to InitOffloadAPI() then this function has no effect (as the callback function will be called and the WRHandle will be cleaned up automatically.) This function is non-blocking.

Returns:
Non-zero if the specified WRHandle has finished, zero otherwise
Parameters:
wrHandle  A work request handle returned by sendWorkRequest

Referenced by PipelineStrategy::storing(), and PipeBroadcastConverse::storing().

void waitForWRHandle ( WRHandle  wrHandle  ) 

Used to wait for the specified WRHandle to finish.

This call is blocking. Like isFinished(), this function will clean-up the WRHandle before returning.

Parameters:
wrHandle  A work request handle returned by sendWorkRequest

WRGroupHandle createWRGroup ( void *userData  DEFAULT_TO_NULL,
void(*)(void *) DEFAULT_TO_NULL  callbackFunc 
)

Used to create a Work Request Group to which Work Requests may be added.

Parameters:
DEFAULT_TO_NULL  User data pointer
callbackFunc  Callback function pointer

void completeWRGroup ( WRGroupHandle  wrGroupHandle  ) 

Used to inidicate that all the Work Requests that will be added to the specified Work Request Group have been added.

int isWRGroupFinished ( WRGroupHandle  wrGroupHandle  ) 

Used to check whether or not a Work Request Group has finished.

void waitForWRGroupHandle ( WRGroupHandle  wrGroupHandle  ) 

Used to wait for a Work Reqeuest Group to finish.

void OffloadAPIProgress (  ) 

Used to allow the Offload API to make progress.

Checks for finished work requests, etc.

Referenced by CmiInitCell(), and KillOnAllSigs().

void OffloadAPIDisplayConfig ( FILE *  fout  ) 

Use to display the configuration of the Offload API in the specified file.

int getWorkRequestID ( WRHandle  wrHandle  ) 

void enableTrace (  ) 

void disableTrace (  ) 

void displayLastWRTimes (  ) 


Variable Documentation

spe_program_handle_t spert_main

The symbol name of the SPE executable that should be linked with the main code.

That is, when the SPE code is embedded into a PPE object file, the symbol name "spert_main" should be used for the SPE executable.


Generated on Sun Jun 29 13:29:40 2008 for Charm++ by  doxygen 1.5.1