This is an automated email from the ASF dual-hosted git repository.

tqchen pushed a commit to branch refactor-s1
in repository https://gitbox.apache.org/repos/asf/tvm.git

commit e4186e7e85e23b8a2513edaa437cf7afdd191e5a
Author: tqchen <[email protected]>
AuthorDate: Sun Apr 13 16:12:21 2025 -0400

    [FFI] Move ByteArray to be consistent on 32bit for now
---
 ffi/include/tvm/ffi/c_api.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/ffi/include/tvm/ffi/c_api.h b/ffi/include/tvm/ffi/c_api.h
index 7a3683ba16..3b4a33509c 100644
--- a/ffi/include/tvm/ffi/c_api.h
+++ b/ffi/include/tvm/ffi/c_api.h
@@ -154,10 +154,16 @@ typedef struct TVMFFIAny {
  *
  *  String and bytes follows the layout of C-style string,
  *  with a null-terminated character array and a size field.
+ *
+ * \note This byte array data structure layout differs in 32/64 bit platforms.
+ *       as size_t equals to the size of the pointer, use this convetion to
+ *       be consistent with std::string and also avoid need to calculate 
padding
+ *       for the size field on 32-bit platforms.
+ *       The FFI binding should be careful when treating this ABI.
  */
 typedef struct {
   const char* data;
-  int64_t size;
+  size_t size;
 } TVMFFIByteArray;
 
 /*!

Reply via email to