tqchen commented on code in PR #451:
URL: https://github.com/apache/tvm-ffi/pull/451#discussion_r2810011193
##########
include/tvm/ffi/any.h:
##########
@@ -623,13 +624,76 @@ struct AnyHash {
return details::StableHashCombine(src.data_.type_index,
details::StableHashBytes(src_str->data, src_str->size));
} else {
+ if (src.data_.type_index >= TypeIndex::kTVMFFIStaticObjectBegin) {
+ static const TVMFFITypeAttrColumn* custom_hash_column =
GetAnyHashTypeAttrColumn();
+ if (custom_hash_column != nullptr &&
+ static_cast<size_t>(src.data_.type_index) <
custom_hash_column->size) {
+ const TVMFFIAny& custom_any_hash =
custom_hash_column->data[src.data_.type_index];
+ if (custom_any_hash.type_index != TypeIndex::kTVMFFINone) {
+ return details::StableHashCombine(src.data_.type_index,
+
CallCustomAnyHash(custom_any_hash, src));
Review Comment:
std seems allow throw exception here
##########
include/tvm/ffi/any.h:
##########
@@ -657,6 +721,16 @@ struct AnyEqual {
details::AnyUnsafe::CopyFromAnyViewAfterCheck<const
details::BytesObjBase*>(rhs);
return Bytes::memequal(lhs_str->data, rhs_str->data, lhs_str->size,
rhs_str->size);
}
+ if (lhs.data_.type_index >= TypeIndex::kTVMFFIStaticObjectBegin) {
+ static const TVMFFITypeAttrColumn* custom_equal_column =
GetAnyEqualTypeAttrColumn();
+ if (custom_equal_column != nullptr &&
+ static_cast<size_t>(lhs.data_.type_index) <
custom_equal_column->size) {
+ const TVMFFIAny& custom_any_equal =
custom_equal_column->data[lhs.data_.type_index];
+ if (custom_any_equal.type_index != TypeIndex::kTVMFFINone) {
+ return CallCustomAnyEqual(custom_any_equal, lhs, rhs);
Review Comment:
std seems allow throw exception here
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]