#include <stddef.h>
#include <stdint.h>
#include "crt_config.h"
#include "error_codes.h"
Go to the source code of this file.
|
tvm_crt_error_t | StackMemoryManager_Init (tvm_workspace_t *tvm_runtime_workspace, uint8_t *g_aot_memory, size_t workspace_size) |
| Initialize the stack-based memory manager. More...
|
|
tvm_crt_error_t | StackMemoryManager_Allocate (tvm_workspace_t *tvm_runtime_workspace, int32_t nbytes, void **current_alloc) |
| The intended user-facing function to allocate within the buffer. It wraps StackMemoryManager_Allocate_Body enable and disable the LIFO check that is useful for debugging the AoT codegen. More...
|
|
tvm_crt_error_t | StackMemoryManager_Allocate_Body (tvm_workspace_t *tvm_runtime_workspace, int32_t nbytes, void **current_alloc, uint8_t do_lifo_check) |
| The internal function that accepts allocate inputs and an extra byte to say to enable the LIFO check that is useful in debugging for debugging the AoT codegen. More...
|
|
tvm_crt_error_t | StackMemoryManager_Free (tvm_workspace_t *tvm_runtime_workspace, void *ptr) |
| The intended user-facing function to free the tensor within the buffer. It wraps StackMemoryManager_Free_Body enable and disable the stack allocator. More...
|
|
tvm_crt_error_t | StackMemoryManager_Free_Body (tvm_workspace_t *tvm_runtime_workspace, void *ptr, uint8_t do_lifo_check) |
| The internal function that accepts free inputs and an extra byte to say to enable the LIFO check that is useful in debugging for debugging the AoT codegen. More...
|
|
◆ STACK_ALLOCATOR_TAG
#define STACK_ALLOCATOR_TAG 0xabcd1234 |
◆ STACK_ALLOCATOR_TAG_SIZE_BYTES
#define STACK_ALLOCATOR_TAG_SIZE_BYTES 4 |
◆ TVM_RUNTIME_ALLOC_ALIGNMENT_BYTES
#define TVM_RUNTIME_ALLOC_ALIGNMENT_BYTES 16 |
Memory alignment for allocator
◆ StackMemoryManager_Allocate()
The intended user-facing function to allocate within the buffer. It wraps StackMemoryManager_Allocate_Body enable and disable the LIFO check that is useful for debugging the AoT codegen.
- Parameters
-
tvm_runtime_workspace | The tvm_workspace_t struct containing state |
nbytes | The number of bytes required for the allocation |
current_alloc | The pointer-to-pointer to be populated with the allocated address |
◆ StackMemoryManager_Allocate_Body()
tvm_crt_error_t StackMemoryManager_Allocate_Body |
( |
tvm_workspace_t * |
tvm_runtime_workspace, |
|
|
int32_t |
nbytes, |
|
|
void ** |
current_alloc, |
|
|
uint8_t |
do_lifo_check |
|
) |
| |
The internal function that accepts allocate inputs and an extra byte to say to enable the LIFO check that is useful in debugging for debugging the AoT codegen.
- Parameters
-
tvm_runtime_workspace | The tvm_workspace_t struct containing state |
nbytes | The number of bytes required for the allocation |
current_alloc | The pointer-to-pointer to be populated with the allocated address |
do_lifo_check | This being non-zero indicates to perform a check LIFO pattern Allocs/Frees |
◆ StackMemoryManager_Free()
The intended user-facing function to free the tensor within the buffer. It wraps StackMemoryManager_Free_Body enable and disable the stack allocator.
- Parameters
-
tvm_runtime_workspace | The tvm_workspace_t struct containing state |
ptr | The base pointer of the tensor to be free'd |
◆ StackMemoryManager_Free_Body()
The internal function that accepts free inputs and an extra byte to say to enable the LIFO check that is useful in debugging for debugging the AoT codegen.
- Parameters
-
tvm_runtime_workspace | The tvm_workspace_t struct containing state |
ptr | The base pointer of tensor to be free'd within the workspace buffer |
do_lifo_check | This being non-zero indicates to perform a check LIFO pattern Allocs/Frees |
◆ StackMemoryManager_Init()
Initialize the stack-based memory manager.
- Parameters
-
tvm_runtime_workspace | The tvm_workspace_t struct containing state |
g_aot_memory | The memory buffer used to allocate within |
workspace_size | The total size of the workspace buffer workspace |