This is an automated email from the ASF dual-hosted git repository.
ruihangl pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git
The following commit(s) were added to refs/heads/main by this push:
new 4fd7ddcb80 [FFI][BUGFIX] Fix type_traits on DataType after SmallStr
update (#18237)
4fd7ddcb80 is described below
commit 4fd7ddcb807674725c0d64ffcc42596abde63563
Author: Tianqi Chen <[email protected]>
AuthorDate: Tue Aug 26 09:51:13 2025 -0400
[FFI][BUGFIX] Fix type_traits on DataType after SmallStr update (#18237)
This PR fixes the type_traits on DataType after SmallStr update.
We need to explicitly zero out the FFFIAny data structure to allow
fast comparison of FFIAny based on bytes values.
---
include/tvm/runtime/data_type.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/include/tvm/runtime/data_type.h b/include/tvm/runtime/data_type.h
index 7236a9e3a2..230f73747f 100644
--- a/include/tvm/runtime/data_type.h
+++ b/include/tvm/runtime/data_type.h
@@ -467,6 +467,7 @@ struct TypeTraits<runtime::DataType> : public
TypeTraitsBase {
TVM_FFI_INLINE static void CopyToAnyView(const runtime::DataType& src,
TVMFFIAny* result) {
// clear padding part to ensure the equality check can always check the
v_uint64 part
result->v_uint64 = 0;
+ result->zero_padding = 0;
result->type_index = TypeIndex::kTVMFFIDataType;
result->v_dtype = src;
}
@@ -474,6 +475,7 @@ struct TypeTraits<runtime::DataType> : public
TypeTraitsBase {
TVM_FFI_INLINE static void MoveToAny(runtime::DataType src, TVMFFIAny*
result) {
// clear padding part to ensure the equality check can always check the
v_uint64 part
result->v_uint64 = 0;
+ result->zero_padding = 0;
result->type_index = TypeIndex::kTVMFFIDataType;
result->v_dtype = src;
}