21 #ifndef TVM_RUNTIME_CRT_STACK_ALLOCATOR_H_
22 #define TVM_RUNTIME_CRT_STACK_ALLOCATOR_H_
26 #include "crt_config.h"
29 #define STACK_ALLOCATOR_TAG 0xabcd1234
30 #define STACK_ALLOCATOR_TAG_SIZE_BYTES 4
34 #ifndef TVM_RUNTIME_ALLOC_ALIGNMENT_BYTES
35 #define TVM_RUNTIME_ALLOC_ALIGNMENT_BYTES 16
56 uint8_t* g_aot_memory,
size_t workspace_size);
68 void** current_alloc);
80 int32_t nbytes,
void** current_alloc,
81 uint8_t do_lifo_check);
101 uint8_t do_lifo_check);
Defines integral error codes returned by the CRT.
tvm_crt_error_t
Definition: error_codes.h:50
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_F...
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.
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...
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 ...
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...
Definition: stack_allocator.h:42
uint8_t * workspace
Definition: stack_allocator.h:44
uint8_t * next_alloc
Definition: stack_allocator.h:43
size_t workspace_size
Definition: stack_allocator.h:45