Scratchpad Parallel Implementation API

group aml_scratch_par

Parallel Scratchpad implementation.

Scratchpad creates one thread to trigger synchronous dma movements.

Defines

AML_SCRATCH_PAR_DECL(name)

Static declaration of a parallel scratchpad. Needs to be initialized with aml_scratch_par_init()

See

aml_scratch_par_init()

AML_SCRATCH_PAR_ALLOCSIZE

Static declaration of a parallel scratchpad size.

Functions

int aml_scratch_par_create(struct aml_scratch **scratch, struct aml_area *scratch_area, struct aml_area *src_area, struct aml_dma *dma, struct aml_tiling *tiling, size_t nbtiles, size_t nbreqs)

Allocates and initializes a new parallel scratchpad.

Return

0 if successful; an error code otherwise.

Parameters
  • scratch: an address where the pointer to the newly allocated scratchpad structure will be stored.

  • scratch_area: the memory area where the scratchpad will be allocated.

  • source_area: the memory area containing the user data structure.

  • dma: the DMA that will be used for migrating data to and from the scratchpad.

  • tiling: the tiling to use on the user data structure and the scratch.

  • nbtiles: number of tiles to divide the scratchpad into.

  • nbreqs: the initial number of slots for asynchronous request that are in-flight (will be increased automatically if necessary).

int aml_scratch_par_init(struct aml_scratch *scratch, struct aml_area *scratch_area, struct aml_area *src_area, struct aml_dma *dma, struct aml_tiling *tiling, size_t nbtiles, size_t nbreqs)

Initializes a new parallel scratchpad. Similar to the create.

Return

0 if successful; an error code otherwise.

Parameters
  • scratch: a pointer to a scratch declared with AML_SCRATCH_PAR_DECL.

void aml_scratch_par_fini(struct aml_scratch *scratch)

Finalize a scratchpad.

Parameters
  • scratch: a pointer to a scratch initialized by aml_scratch_par_init

void aml_scratch_par_destroy(struct aml_scratch **scratch)

Tears down an initialized parallel scratchpad.

Parameters
  • scratch: an initialized scratchpad structure. NULL on return.

Variables

struct aml_scratch_ops aml_scratch_par_ops

Default table of scratchpad operations for linux parallel dma.

int type

The type of scratchpad request

See

<aml.h>

void *srcptr

The source pointer of the data movement

int srcid

The tile identifier in source pointer

void *dstptr

The destination pointer of the data movement

int dstid

The tile identifier in destination pointer

struct aml_scratch_par *scratch

The scratchpad handling this request

pthread_t thread

The thread in charge of scratch request progress

struct aml_area *src_area

The source area where data comes from

struct aml_area *sch_area

The destination area where data temporariliy goes to

struct aml_tiling *tiling

The data organisation. /todo why can’t source and destination tiling vary?

size_t scratch_size

struct aml_dma *dma

The dma engine in charge of the transfer

void *sch_ptr

Pointer to data in scratch destination

struct aml_vector tilemap

The tilings involved in ongoing scratch requests

struct aml_vector requests

The set of dma requests submitted to the dma to mode data

pthread_mutex_t lock

A lock to submit concurrent dma requests via the scratchpad

void *(*do_thread)(void *data)

Function to submit asynchronously scratchpad request.

Return

Unspecified value.

Parameters

struct aml_scratch_par_ops ops

Set of operations embeded in the scratchpad

struct aml_scratch_par_data data

Data embeded in the scratchpad

struct aml_scratch_request_par
#include <par.h>

Inside of a parallel scratch request with linux dma.

struct aml_scratch_par_data
#include <par.h>

Inner data of the parallel scratchpad implementation

struct aml_scratch_par_ops
#include <par.h>

The set of operation embeded in the parallel scratchpad

struct aml_scratch_par
#include <par.h>

Parallel implementation of a scratchpad