MulticoreBSP for C  Version 2.0.4
Functions
bsp-active-hooks.h File Reference
#include "mcbsp.h"
Include dependency graph for bsp-active-hooks.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

static void mcbsp_accelerator_implied_init (struct mcbsp_init_data *const init, const bsp_pid_t P)
 Accelerator-specific initialisation. More...
 
static void mcbsp_accelerator_full_init (struct mcbsp_init_data *const init, const int argc, char *const *const argv)
 Accelerator-specific initialisation. More...
 
static bsp_pid_t mcbsp_accelerator_offline_nprocs (void)
 Returns the maximum number of processes supported by the accelerator. More...
 
static size_t mcbsp_nocc_cache_line_size (void)
 Returns the cache line size in bytes, as active on the accelerator. More...
 
static void mcbsp_nocc_purge_all (void)
 Purges the local cache. More...
 
static void mcbsp_nocc_flush_cacheline (const void *const address)
 Flushes a specific cache line. More...
 
static void mcbsp_nocc_invalidate (const void *const address, const size_t length)
 Invalidate a specific cache line. More...
 
static void mcbsp_nocc_wait_for_flush (void)
 Waits for any outstanding flushes to complete. More...
 
static void mcbsp_nocc_invalidate_cacheline (const void *const address)
 As mcbsp_nocc_invalidate, but invalidates a single cache line only. More...
 

Function Documentation

static void mcbsp_accelerator_full_init ( struct mcbsp_init_data *const  init,
const int  argc,
char *const *const  argv 
)
inlinestatic

Accelerator-specific initialisation.

This version is compatible with bsp_init.

This function should be called on initialisation of the MulticoreBSP run- time and thus is only relevant when running BSP code on the accelerator.

The default behaviour is to do nothing. If accelerators need to be initialised for MulticoreBSP to work, then a specific implementation of this function for that accelerator must be provided.

Parameters
initWhere to store initialisation data.
argcThe number of input arguments passed to the executable.
argvThe input arguments passed to the executable.
static void mcbsp_accelerator_implied_init ( struct mcbsp_init_data *const  init,
const bsp_pid_t  P 
)
inlinestatic

Accelerator-specific initialisation.

This version is to be called by bsp_begin.

This function should be called on initialisation of the MulticoreBSP run- time and thus is only relevant when running BSP code on the accelerator.

The default behaviour is to do nothing. If accelerators need to be initialised for MulticoreBSP to work, then a specific implementation of this function for that accelerator must be provided.

Parameters
initWhere to store initialisation data.
PHow many BSP processes to spawn.
static bsp_pid_t mcbsp_accelerator_offline_nprocs ( void  )
inlinestatic

Returns the maximum number of processes supported by the accelerator.

The default behaviour is to return the maximum number of processes. This is likely invalid behaviour. Users adding support for a specific accelerator should provide a more sensible implementation of this function.

Returns
The maximum number of processes to spawn on the accelerator.
static size_t mcbsp_nocc_cache_line_size ( void  )
inlinestatic

Returns the cache line size in bytes, as active on the accelerator.

The default behaviour is to return zero. This is likely invalid. Users adding support for a specific accelerator should provide a more sensible implementation of this function.

Returns
The cache line size (in bytes).
static void mcbsp_nocc_flush_cacheline ( const void *const  address)
inlinestatic

Flushes a specific cache line.

The cache line is indicated by address. The address is rounded down to the nearest multiple of the cache line size, and the memory chunk of size L starting at that address, is flushed (where L is the cache line size as returned by mcbsp_nocc_cache_line_size).

Flushing a cache line will check if it is dirty. If so, it will write that data to main memory. This function may exit before any write back has completed. To wait for the write-back to complete, use mcbsp_nocc_wait_for_flush.

The default behaviour is to do nothing. If accelerators are not cache-coherent, then a specific implementation of this function for that accelerator must be provided.

static void mcbsp_nocc_invalidate ( const void *const  address,
const size_t  length 
)
inlinestatic

Invalidate a specific cache line.

The first cache line is indicated by address. The address is rounded down to the nearest multiple of the cache line size, and the memory chunk of size L starting at that address, is flushed (where L is the cache line size as returned by mcbsp_nocc_cache_line_size). The last cache line to be invalidated is similarly determined by processing the address address + length.

Invalidation makes it so that any next referral to any memory address corresponding to any of the cache lines that were invalidated, will retrieve up-to-date information from main memory, regardless of whether any lines were in local cache. This function does not guarantee dirty cache lines would be written back. To write back dirty memory to RAM, use flush. To both flush and invalidate, use purge.

The default behaviour is to do nothing. If accelerators are not cache-coherent, then a specific implementation of this function for that accelerator must be provided.

static void mcbsp_nocc_invalidate_cacheline ( const void *const  address)
inlinestatic

As mcbsp_nocc_invalidate, but invalidates a single cache line only.

Parameters
addressThe cache line to be invalidated contains this address.
static void mcbsp_nocc_purge_all ( void  )
inlinestatic

Purges the local cache.

A flushes all dirty cache lines in local cache into main memory. It will not necessarily update copies of any corresponding cache lines in remote memory. Additionally, it will invalidate all cache lines in local cache. On completion, the cache will be as though it were empty.

The default behaviour is to do nothing. If accelerators are not cache-coherent, then a specific implementation of this function for that accelerator must be provided.

static void mcbsp_nocc_wait_for_flush ( void  )
inlinestatic

Waits for any outstanding flushes to complete.

This is a blocking function. It is used to make sure any outstanding calls to

The default behaviour is to do nothing. If accelerators are not cache-coherent, then a specific implementation of this function for that accelerator must be provided.