Snitch Runtime
|
This file contains functions to conveniently program Snitch's SSRs. More...
Go to the source code of this file.
Enumerations | |
enum | snrt_ssr_dm { SNRT_SSR_DM0 = 0 , SNRT_SSR_DM1 = 1 , SNRT_SSR_DM2 = 2 , SNRT_SSR_DM_ALL = 31 } |
The different SSRs. More... | |
enum | snrt_ssr_dim { SNRT_SSR_1D = 0 , SNRT_SSR_2D = 1 , SNRT_SSR_3D = 2 , SNRT_SSR_4D = 3 } |
The different dimensions. More... | |
enum | snrt_ssr_reg { SNRT_SSR_REG_STATUS = 0 , SNRT_SSR_REG_REPEAT = 1 , SNRT_SSR_REG_BOUNDS = 2 , SNRT_SSR_REG_STRIDES = 6 , SNRT_SSR_REG_IDX_CFG = 10 , SNRT_SSR_REG_IDX_BASE = 11 , SNRT_SSR_REG_RPTR_INDIR = 16 , SNRT_SSR_REG_RPTR = 24 , SNRT_SSR_REG_WPTR = 28 } |
The SSR configuration registers. More... | |
enum | snrt_ssr_idxsize { SNRT_SSR_IDXSIZE_U8 = 0 , SNRT_SSR_IDXSIZE_U16 = 1 , SNRT_SSR_IDXSIZE_U32 = 2 , SNRT_SSR_IDXSIZE_U64 = 3 } |
The size of the SSSR indirection indices. More... | |
Functions | |
void | snrt_fpu_fence () |
Synchronize the integer and float pipelines. | |
void | snrt_ssr_enable () |
Enable all SSRs. | |
void | snrt_ssr_disable () |
Disable all SSRs. | |
void | snrt_sc_enable (uint32_t mask) |
Enable scalar chaining. | |
void | snrt_sc_disable (uint32_t mask) |
Disable scalar chaining. | |
uint32_t | read_ssr_cfg (enum snrt_ssr_reg reg, uint32_t dm) |
Read the value of an SSR configuration register. | |
void | write_ssr_cfg (enum snrt_ssr_reg reg, uint32_t dm, uint32_t value) |
Write a value to an SSR configuration register. | |
void | snrt_ssr_loop_1d (enum snrt_ssr_dm dm, size_t b0, size_t s0) |
Configure an SSR data mover for a 1D loop nest. | |
void | snrt_ssr_loop_2d (enum snrt_ssr_dm dm, size_t b0, size_t b1, size_t s0, size_t s1) |
Configure an SSR data mover for a 2D loop nest. | |
void | snrt_ssr_loop_3d (enum snrt_ssr_dm dm, size_t b0, size_t b1, size_t b2, size_t s0, size_t s1, size_t s2) |
Configure an SSR data mover for a 3D loop nest. | |
void | snrt_ssr_loop_4d (enum snrt_ssr_dm dm, size_t b0, size_t b1, size_t b2, size_t b3, size_t s0, size_t s1, size_t s2, size_t s3) |
Configure an SSR data mover for a 4D loop nest. | |
void | snrt_ssr_repeat (enum snrt_ssr_dm dm, size_t count) |
Configure the repetition count for a stream. | |
void | snrt_ssr_read (enum snrt_ssr_dm dm, enum snrt_ssr_dim dim, volatile void *ptr) |
Start a streaming read. | |
void | snrt_ssr_write (enum snrt_ssr_dm dm, enum snrt_ssr_dim dim, volatile void *ptr) |
Start a streaming write. | |
void | snrt_issr_set_idx_cfg (enum snrt_ssr_dm dm, enum snrt_ssr_idxsize idxsize) |
Start a streaming indirect read. | |
void | snrt_issr_set_bound (enum snrt_ssr_dm dm, size_t bound) |
void | snrt_issr_set_ptrs (enum snrt_ssr_dm dm, volatile void *base, volatile void *idcs) |
void | snrt_issr_read (enum snrt_ssr_dm dm, volatile void *base, volatile void *idcs, size_t bound, enum snrt_ssr_idxsize idxsize) |
This file contains functions to conveniently program Snitch's SSRs.
An SSR stream can be configured to replace a store (or load) sequence as could be generated by an N-dimensional affine loop nest, e.g. the following store sequence can be mapped to a 2D write SSR:
An ISSR (Indirect SSR) stream can be configured to replace a store (or load) sequence as could be generated by:
The convenience functions provided in this file can be used to set up such access patterns. The function argument names reflect the variable names presented in these sample code snippets.
Note: The exact number of elements configured in an (I)SSR stream must be consumed. Failure to comply with this requirement will result in undefined behaviour.
enum snrt_ssr_dim |
enum snrt_ssr_dm |
enum snrt_ssr_idxsize |
enum snrt_ssr_reg |
The SSR configuration registers.
|
inline |
Read the value of an SSR configuration register.
reg | The register index. |
dm | The SSR index. |
|
inline |
Start a streaming indirect read.
dm | The SSSR index. |
base | The base pointer to the data. |
ptr | The pointer to the indirection indices. |
bound | The bound of the first (and only) loop. |
idxsize | The size of the indices. |
|
inline |
Enable scalar chaining.
mask | A bitmask indicating which registers should be enabled for chaining. |
|
inline |
Configure an SSR data mover for a 1D loop nest.
dm | The SSR index. |
b0 | The bound of the loop. |
s0 | The stride of the loop. |
|
inline |
Configure an SSR data mover for a 2D loop nest.
dm | The SSR index. |
b0 | The bound of the first loop. |
b1 | The bound of the second loop. |
s0 | The stride of the first loop. |
s1 | The stride of the second loop. |
|
inline |
Configure an SSR data mover for a 3D loop nest.
dm | The SSR index. |
b0 | The bound of the first loop. |
b1 | The bound of the second loop. |
b2 | The bound of the third loop. |
s0 | The stride of the first loop. |
s1 | The stride of the second loop. |
s2 | The stride of the third loop. |
|
inline |
Configure an SSR data mover for a 4D loop nest.
dm | The SSR index. |
b0 | The bound of the first loop. |
b1 | The bound of the second loop. |
b2 | The bound of the third loop. |
b3 | The bound of the fourth loop. |
s0 | The stride of the first loop. |
s1 | The stride of the second loop. |
s2 | The stride of the third loop. |
s3 | The stride of the fourth loop. |
|
inline |
Start a streaming read.
dm | The SSR index. |
dim | The number of dimensions to use. |
ptr | The pointer to the data. |
|
inline |
Configure the repetition count for a stream.
dm | The SSR index. |
count | The repetition count. |
|
inline |
Start a streaming write.
dm | The SSR index. |
dim | The number of dimensions to use. |
ptr | The pointer to the data. |
|
inline |
Write a value to an SSR configuration register.
reg | The register index. |
dm | The SSR index. |
value | The value to write. |