This is an automated email from the ASF dual-hosted git repository.
junrushao pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm-ffi.git
The following commit(s) were added to refs/heads/main by this push:
new f9179ec [MEMORY] Explicitly set padding to 0 (#77)
f9179ec is described below
commit f9179ec21ed277c8964c7f2282f8bcc013ac286e
Author: Tianqi Chen <[email protected]>
AuthorDate: Tue Sep 30 20:37:31 2025 -0400
[MEMORY] Explicitly set padding to 0 (#77)
This PR updates the memory module to explicitly set padding to 0.
Although this part is unused, it is good to have determininstic memory.
---
include/tvm/ffi/memory.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/include/tvm/ffi/memory.h b/include/tvm/ffi/memory.h
index 6d1a766..425dbf7 100644
--- a/include/tvm/ffi/memory.h
+++ b/include/tvm/ffi/memory.h
@@ -115,6 +115,7 @@ class ObjAllocatorBase {
TVMFFIObject* ffi_ptr = details::ObjectUnsafe::GetHeader(ptr);
ffi_ptr->combined_ref_count = kCombinedRefCountBothOne;
ffi_ptr->type_index = T::RuntimeTypeIndex();
+ ffi_ptr->__padding = 0;
ffi_ptr->deleter = Handler::Deleter();
return details::ObjectUnsafe::ObjectPtrFromOwned<T>(ptr);
}
@@ -136,6 +137,7 @@ class ObjAllocatorBase {
TVMFFIObject* ffi_ptr = details::ObjectUnsafe::GetHeader(ptr);
ffi_ptr->combined_ref_count = kCombinedRefCountBothOne;
ffi_ptr->type_index = ArrayType::RuntimeTypeIndex();
+ ffi_ptr->__padding = 0;
ffi_ptr->deleter = Handler::Deleter();
return details::ObjectUnsafe::ObjectPtrFromOwned<ArrayType>(ptr);
}