areusch commented on a change in pull request #8019:
URL: https://github.com/apache/tvm/pull/8019#discussion_r631956556
##########
File path: include/tvm/runtime/crt/stack_allocator.h
##########
@@ -45,14 +45,61 @@ typedef struct {
size_t workspace_size; // Total number of bytes in the workspace
} tvm_workspace_t;
+/*!
+ * \brief Initialize the stack-based memory manager
+ *
+ * \param tvm_runtime_workspace The tvm_workspace_t struct containing state
+ * \param g_aot_memory The memory buffer used to allocate within
+ * \param workspace_size The total size of the workspace buffer workspace
+ */
tvm_crt_error_t StackMemoryManager_Init(tvm_workspace_t* tvm_runtime_workspace,
uint8_t* g_aot_memory, size_t
workspace_size);
+/*!
+ * \brief The intended user-facing function to allocate within the buffer. It
wraps
+ * StackMemoryManager_Allocate_Body enable and disable the FIFO check that is
useful for debugging
+ * the AoT codegen.
+ *
+ * \param tvm_runtime_workspace The tvm_workspace_t struct containing state
+ * \param nbytes The number of bytes required for the allocation
+ * \param current_alloc The pointer-to-pointer to be populated with the
allocated address
+ */
tvm_crt_error_t StackMemoryManager_Allocate(tvm_workspace_t*
tvm_runtime_workspace, int32_t nbytes,
- void**);
+ void** current_alloc);
+
+/*!
+ * \brief The internal function that accepts allocate inputs and an extra byte
to say to enable the
+ * FIFO check that is useful in debugging for debugging the AoT codegen.
+ *
+ * \param tvm_runtime_workspace The tvm_workspace_t struct containing state
+ * \param nbytes The number of bytes required for the allocation
+ * \param current_alloc The pointer-to-pointer to be populated with the
allocated address
+ * \param do_fifo_check THis indicates to perform a check FIFO pattern
Allocs/Frees
Review comment:
just saying to be explicit about which boolean value means what. Usually
I write stuff like this as "true when this function should explicitly check for
a FILO pattern of Alloc/Frees"
(also I realized yesterday that I've been using FIFO but it's wrong word
here :) )
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]