Snitch Runtime
|
Defines functions to dynamically allocate the cluster's L1 memory. More...
Go to the source code of this file.
Functions | |
snrt_allocator_t * | snrt_l1_allocator_v2 () |
Get a pointer to the L1 allocator. | |
void * | snrt_l1_next_v2 () |
Get the next pointer of the L1 allocator. | |
void | snrt_l1_update_next_v2 (void *next) |
Override the L1 allocator next pointer. | |
void | snrt_l1_alloc_check_bounds () |
Check if the allocation exceeds the allocator bounds and raise an exception if it does. | |
void * | snrt_l1_alloc_cluster_local (size_t size, const size_t alignment) |
Allocate space for a variable in the cluster's L1 memory. | |
void * | snrt_l1_alloc_compute_core_local (size_t size, const size_t alignment) |
Allocate space for N variables in the cluster's L1 memory. | |
void * | snrt_compute_core_local_ptr (void *ptr, uint32_t core_idx, size_t size) |
Get a pointer to the same variable allocated by another core. | |
void * | snrt_remote_l1_ptr (void *ptr, uint32_t src_cluster_idx, uint32_t dst_cluster_idx) |
Get a pointer to the same offset in another cluster's L1 memory. | |
void | snrt_alloc_init_v2 () |
Initialize the L1 allocator. | |
Variables | |
__thread snrt_allocator_t | l1_allocator_v2 |
Defines functions to dynamically allocate the cluster's L1 memory.
This file provides functions to dynamically allocate the cluster's L1 memory. It includes functions for allocating memory for cluster-local variables, compute core-local variables, and for manipulating pointers to variables allocated by different cores or clusters.
|
inline |
Initialize the L1 allocator.
This function initializes the L1 allocator by calculating the end address of the heap and setting the base, end, and next pointers of the allocator.
|
inline |
Get a pointer to the same variable allocated by another core.
This function takes a pointer to a variable allocated using snrt_l1_alloc_compute_core_local
and returns a pointer to the same variable allocated by another core, as specified by core_idx
. The size
argument should be the same used during allocation.
ptr | Pointer to the variable allocated by the current core. |
core_idx | Index of the core that allocated the variable. |
size | The size of the variable. |
|
inline |
Allocate space for a variable in the cluster's L1 memory.
This function dynamically allocates space for a variable of size size
in the cluster's L1 memory. The allocation is aligned to the specified alignment
.
size | The size of the variable to allocate. |
alignment | The alignment of the allocation. |
|
inline |
Allocate space for N variables in the cluster's L1 memory.
This function dynamically allocates space for N variables of size size
in the cluster's L1 memory, where N is the number of compute cores in the cluster. The variables are allocated in a contiguous block of memory. The whole block is aligned to the specified alignment
.
size | The size of each variable to allocate. |
alignment | The alignment of the allocation. |
|
inline |
Get a pointer to the L1 allocator.
|
inline |
Get the next pointer of the L1 allocator.
|
inline |
Override the L1 allocator next pointer.
next | The new value for the next pointer. |
|
inline |
Get a pointer to the same offset in another cluster's L1 memory.
This function takes a pointer to a variable in the calling (source) cluster's L1 memory and returns a pointer to the same offset in the target (destination) cluster's L1 memory.
ptr | Pointer to the variable in the source cluster's L1 memory. |
src_cluster_idx | Index of the source cluster. |
dst_cluster_idx | Index of the destination cluster. |