AI Engine Intrinsics User Guide  (AIE) v(2024.1)
 All Data Structures Namespaces Functions Variables Typedefs Groups Pages
Cyclic Addressing

Overview

Cyclic addressing intrinsics allow indexing into circular buffers.

Cyclic Increment or Decrement within a buffer (NOT FOR UNALIGNED LOADS/STORES)

void * cyclic_add (void *a, int offs, void *restrict start, int len)
 Cyclic increment or decrement of a pointer within a buffer.
 

Cyclic increment/decrement for Unaligned Loads/Stores

v32int8 cyclic_add_unaligned_load (v32int8 *a, int offs, v32int8 *start, int len)
 Load a vector from a pointer and perform a cyclic increment or decrement within a buffer.
 
v32uint8 cyclic_add_unaligned_load (v32uint8 *a, int offs, v32uint8 *start, int len)
 Load a vector from a pointer and perform a cyclic increment or decrement within a buffer.
 
v16int16 cyclic_add_unaligned_load (v16int16 *a, int offs, v16int16 *start, int len)
 Load a vector from a pointer and perform a cyclic increment or decrement within a buffer.
 
v8cint16 cyclic_add_unaligned_load (v8cint16 *a, int offs, v8cint16 *start, int len)
 Load a vector from a pointer and perform a cyclic increment or decrement within a buffer.
 
v8int32 cyclic_add_unaligned_load (v8int32 *a, int offs, v8int32 *start, int len)
 Load a vector from a pointer and perform a cyclic increment or decrement within a buffer.
 
v4cint32 cyclic_add_unaligned_load (v4cint32 *a, int offs, v4cint32 *start, int len)
 Load a vector from a pointer and perform a cyclic increment or decrement within a buffer.
 
v8float cyclic_add_unaligned_load (v8float *a, int offs, v8float *start, int len)
 Load a vector from a pointer and perform a cyclic increment or decrement within a buffer.
 
v4cfloat cyclic_add_unaligned_load (v4cfloat *a, int offs, v4cfloat *start, int len)
 Load a vector from a pointer and perform a cyclic increment or decrement within a buffer.
 
void cyclic_add_unaligned_store (v32int8 *a, int offs, v32int8 *start, int len, v32int8 d)
 Load a vector from a pointer and perform a cyclic increment or decrement within a buffer.
 
void cyclic_add_unaligned_store (v32uint8 *a, int offs, v32uint8 *start, int len, v32uint8 d)
 Load a vector from a pointer and perform a cyclic increment or decrement within a buffer.
 
void cyclic_add_unaligned_store (v16int16 *a, int offs, v16int16 *start, int len, v16int16 d)
 Load a vector from a pointer and perform a cyclic increment or decrement within a buffer.
 
void cyclic_add_unaligned_store (v8cint16 *a, int offs, v8cint16 *start, int len, v8cint16 d)
 Load a vector from a pointer and perform a cyclic increment or decrement within a buffer.
 
void cyclic_add_unaligned_store (v8int32 *a, int offs, v8int32 *start, int len, v8int32 d)
 Load a vector from a pointer and perform a cyclic increment or decrement within a buffer.
 
void cyclic_add_unaligned_store (v4cint32 *a, int offs, v4cint32 *start, int len, v4cint32 d)
 Load a vector from a pointer and perform a cyclic increment or decrement within a buffer.
 
void cyclic_add_unaligned_store (v8float *a, int offs, v8float *start, int len, v8float d)
 Load a vector from a pointer and perform a cyclic increment or decrement within a buffer.
 
void cyclic_add_unaligned_store (v4cfloat *a, int offs, v4cfloat *start, int len, v4cfloat d)
 Load a vector from a pointer and perform a cyclic increment or decrement within a buffer.
 

Function Documentation

void* cyclic_add ( void *  a,
int  offs,
void *restrict  start,
int  len 
)

Cyclic increment or decrement of a pointer within a buffer.

Parameters
a]Current circular buffer pointer position
offs]Number of elements to increment the pointer by (each step is the size of the input type)
start]Pointer to the start of the circular buffer (must be aligned to the vector size)
len]Size of the circular buffer (number of elements of the datatype of the pointer)
Note
The AIE hardware has a load+cyclic_add instruction which loads from a pointer and post-modifies it in the same cycle. In case the vector size is 256-bit and the pointer is only 128-bit aligned and it points right before the end of the buffer, this instruction will load the first 128-bit from the end of the buffer and the second 128-bit from the beginning of the buffer.
If the load and the cyclic_add are executed in separate instructions, the above behavior is not achieved. Hence, in typical source code, the user writes the load and the cyclic_add on the pointer as separate intrinsics and relies on the compiler to combine the two if possible. That means the unaligned behavior is not guaranteed in this case. In x86 compilation, the two intrinsics will always be executed sequentially and the unaligned load across buffer boundaries will never work.
Therefore, if you want to load unaligned across cyclic buffer boundaries, please use the cyclic_add_unaligned_load() intrinsic.
v32int8 cyclic_add_unaligned_load ( v32int8 *  a,
int  offs,
v32int8 *  start,
int  len 
)

Load a vector from a pointer and perform a cyclic increment or decrement within a buffer.

Please use this intrinsic if your pointer is unaligned with respect to the vector size.

Parameters
a]Current circular buffer pointer position
offs]Number of (half) elements to increment the pointer by (each step is half the size of the input type)
start]Pointer to the start of the circular buffer (must be aligned to the vector size)
len]Size of the circular buffer (double the number of elements of the datatype of the pointer)
d]input vector to be stored for unaligned stores only.
v32uint8 cyclic_add_unaligned_load ( v32uint8 *  a,
int  offs,
v32uint8 *  start,
int  len 
)

Load a vector from a pointer and perform a cyclic increment or decrement within a buffer.

Please use this intrinsic if your pointer is unaligned with respect to the vector size.

Parameters
a]Current circular buffer pointer position
offs]Number of (half) elements to increment the pointer by (each step is half the size of the input type)
start]Pointer to the start of the circular buffer (must be aligned to the vector size)
len]Size of the circular buffer (double the number of elements of the datatype of the pointer)
d]input vector to be stored for unaligned stores only.
v16int16 cyclic_add_unaligned_load ( v16int16 *  a,
int  offs,
v16int16 *  start,
int  len 
)

Load a vector from a pointer and perform a cyclic increment or decrement within a buffer.

Please use this intrinsic if your pointer is unaligned with respect to the vector size.

Parameters
a]Current circular buffer pointer position
offs]Number of (half) elements to increment the pointer by (each step is half the size of the input type)
start]Pointer to the start of the circular buffer (must be aligned to the vector size)
len]Size of the circular buffer (double the number of elements of the datatype of the pointer)
d]input vector to be stored for unaligned stores only.
v8cint16 cyclic_add_unaligned_load ( v8cint16 *  a,
int  offs,
v8cint16 *  start,
int  len 
)

Load a vector from a pointer and perform a cyclic increment or decrement within a buffer.

Please use this intrinsic if your pointer is unaligned with respect to the vector size.

Parameters
a]Current circular buffer pointer position
offs]Number of (half) elements to increment the pointer by (each step is half the size of the input type)
start]Pointer to the start of the circular buffer (must be aligned to the vector size)
len]Size of the circular buffer (double the number of elements of the datatype of the pointer)
d]input vector to be stored for unaligned stores only.
v8int32 cyclic_add_unaligned_load ( v8int32 *  a,
int  offs,
v8int32 *  start,
int  len 
)

Load a vector from a pointer and perform a cyclic increment or decrement within a buffer.

Please use this intrinsic if your pointer is unaligned with respect to the vector size.

Parameters
a]Current circular buffer pointer position
offs]Number of (half) elements to increment the pointer by (each step is half the size of the input type)
start]Pointer to the start of the circular buffer (must be aligned to the vector size)
len]Size of the circular buffer (double the number of elements of the datatype of the pointer)
d]input vector to be stored for unaligned stores only.
v4cint32 cyclic_add_unaligned_load ( v4cint32 *  a,
int  offs,
v4cint32 *  start,
int  len 
)

Load a vector from a pointer and perform a cyclic increment or decrement within a buffer.

Please use this intrinsic if your pointer is unaligned with respect to the vector size.

Parameters
a]Current circular buffer pointer position
offs]Number of (half) elements to increment the pointer by (each step is half the size of the input type)
start]Pointer to the start of the circular buffer (must be aligned to the vector size)
len]Size of the circular buffer (double the number of elements of the datatype of the pointer)
d]input vector to be stored for unaligned stores only.
v8float cyclic_add_unaligned_load ( v8float *  a,
int  offs,
v8float *  start,
int  len 
)

Load a vector from a pointer and perform a cyclic increment or decrement within a buffer.

Please use this intrinsic if your pointer is unaligned with respect to the vector size.

Parameters
a]Current circular buffer pointer position
offs]Number of (half) elements to increment the pointer by (each step is half the size of the input type)
start]Pointer to the start of the circular buffer (must be aligned to the vector size)
len]Size of the circular buffer (double the number of elements of the datatype of the pointer)
d]input vector to be stored for unaligned stores only.
v4cfloat cyclic_add_unaligned_load ( v4cfloat *  a,
int  offs,
v4cfloat *  start,
int  len 
)

Load a vector from a pointer and perform a cyclic increment or decrement within a buffer.

Please use this intrinsic if your pointer is unaligned with respect to the vector size.

Parameters
a]Current circular buffer pointer position
offs]Number of (half) elements to increment the pointer by (each step is half the size of the input type)
start]Pointer to the start of the circular buffer (must be aligned to the vector size)
len]Size of the circular buffer (double the number of elements of the datatype of the pointer)
d]input vector to be stored for unaligned stores only.
void cyclic_add_unaligned_store ( v32int8 *  a,
int  offs,
v32int8 *  start,
int  len,
v32int8  d 
)

Load a vector from a pointer and perform a cyclic increment or decrement within a buffer.

Please use this intrinsic if your pointer is unaligned with respect to the vector size.

Parameters
a]Current circular buffer pointer position
offs]Number of (half) elements to increment the pointer by (each step is half the size of the input type)
start]Pointer to the start of the circular buffer (must be aligned to the vector size)
len]Size of the circular buffer (double the number of elements of the datatype of the pointer)
d]input vector to be stored for unaligned stores only.
void cyclic_add_unaligned_store ( v32uint8 *  a,
int  offs,
v32uint8 *  start,
int  len,
v32uint8  d 
)

Load a vector from a pointer and perform a cyclic increment or decrement within a buffer.

Please use this intrinsic if your pointer is unaligned with respect to the vector size.

Parameters
a]Current circular buffer pointer position
offs]Number of (half) elements to increment the pointer by (each step is half the size of the input type)
start]Pointer to the start of the circular buffer (must be aligned to the vector size)
len]Size of the circular buffer (double the number of elements of the datatype of the pointer)
d]input vector to be stored for unaligned stores only.
void cyclic_add_unaligned_store ( v16int16 *  a,
int  offs,
v16int16 *  start,
int  len,
v16int16  d 
)

Load a vector from a pointer and perform a cyclic increment or decrement within a buffer.

Please use this intrinsic if your pointer is unaligned with respect to the vector size.

Parameters
a]Current circular buffer pointer position
offs]Number of (half) elements to increment the pointer by (each step is half the size of the input type)
start]Pointer to the start of the circular buffer (must be aligned to the vector size)
len]Size of the circular buffer (double the number of elements of the datatype of the pointer)
d]input vector to be stored for unaligned stores only.
void cyclic_add_unaligned_store ( v8cint16 *  a,
int  offs,
v8cint16 *  start,
int  len,
v8cint16  d 
)

Load a vector from a pointer and perform a cyclic increment or decrement within a buffer.

Please use this intrinsic if your pointer is unaligned with respect to the vector size.

Parameters
a]Current circular buffer pointer position
offs]Number of (half) elements to increment the pointer by (each step is half the size of the input type)
start]Pointer to the start of the circular buffer (must be aligned to the vector size)
len]Size of the circular buffer (double the number of elements of the datatype of the pointer)
d]input vector to be stored for unaligned stores only.
void cyclic_add_unaligned_store ( v8int32 *  a,
int  offs,
v8int32 *  start,
int  len,
v8int32  d 
)

Load a vector from a pointer and perform a cyclic increment or decrement within a buffer.

Please use this intrinsic if your pointer is unaligned with respect to the vector size.

Parameters
a]Current circular buffer pointer position
offs]Number of (half) elements to increment the pointer by (each step is half the size of the input type)
start]Pointer to the start of the circular buffer (must be aligned to the vector size)
len]Size of the circular buffer (double the number of elements of the datatype of the pointer)
d]input vector to be stored for unaligned stores only.
void cyclic_add_unaligned_store ( v4cint32 *  a,
int  offs,
v4cint32 *  start,
int  len,
v4cint32  d 
)

Load a vector from a pointer and perform a cyclic increment or decrement within a buffer.

Please use this intrinsic if your pointer is unaligned with respect to the vector size.

Parameters
a]Current circular buffer pointer position
offs]Number of (half) elements to increment the pointer by (each step is half the size of the input type)
start]Pointer to the start of the circular buffer (must be aligned to the vector size)
len]Size of the circular buffer (double the number of elements of the datatype of the pointer)
d]input vector to be stored for unaligned stores only.
void cyclic_add_unaligned_store ( v8float *  a,
int  offs,
v8float *  start,
int  len,
v8float  d 
)

Load a vector from a pointer and perform a cyclic increment or decrement within a buffer.

Please use this intrinsic if your pointer is unaligned with respect to the vector size.

Parameters
a]Current circular buffer pointer position
offs]Number of (half) elements to increment the pointer by (each step is half the size of the input type)
start]Pointer to the start of the circular buffer (must be aligned to the vector size)
len]Size of the circular buffer (double the number of elements of the datatype of the pointer)
d]input vector to be stored for unaligned stores only.
void cyclic_add_unaligned_store ( v4cfloat *  a,
int  offs,
v4cfloat *  start,
int  len,
v4cfloat  d 
)

Load a vector from a pointer and perform a cyclic increment or decrement within a buffer.

Please use this intrinsic if your pointer is unaligned with respect to the vector size.

Parameters
a]Current circular buffer pointer position
offs]Number of (half) elements to increment the pointer by (each step is half the size of the input type)
start]Pointer to the start of the circular buffer (must be aligned to the vector size)
len]Size of the circular buffer (double the number of elements of the datatype of the pointer)
d]input vector to be stored for unaligned stores only.