mehrdadh commented on a change in pull request #8487:
URL: https://github.com/apache/tvm/pull/8487#discussion_r673658807



##########
File path: src/runtime/crt/memory/stack_allocator.c
##########
@@ -79,8 +79,14 @@ tvm_crt_error_t StackMemoryManager_Free(tvm_workspace_t* 
tvm_runtime_workspace,
 
 tvm_crt_error_t StackMemoryManager_Init(tvm_workspace_t* tvm_runtime_workspace,
                                         uint8_t* g_aot_memory, size_t 
workspace_size) {
+  // We need to round up g_aot_memory in case it is not aligned to
+  // TVM_RUNTIME_ALLOC_ALIGNMENT_BYTES.
+  uintptr_t unaligned_mask = TVM_RUNTIME_ALLOC_ALIGNMENT_BYTES - 1;
+  uint32_t offset = TVM_RUNTIME_ALLOC_ALIGNMENT_BYTES - 
((uintptr_t)g_aot_memory & unaligned_mask);

Review comment:
       I agree, I changed it to that.




-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to