From 0695d67f4d65dbf743ce351fcfded87d2530e5cc Mon Sep 17 00:00:00 2001 From: tqchen Date: Tue, 26 Aug 2025 07:44:57 -0400 Subject: [PATCH] [FFI][BUGFIX] Fix type_traits on DataType after SmallStr update 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 7236a9e3a2e0..230f73747fad 100644 --- a/include/tvm/runtime/data_type.h +++ b/include/tvm/runtime/data_type.h @@ -467,6 +467,7 @@ struct TypeTraits : 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 : 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; }