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

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

commit f9230e42dfbdc54a139d0c6192cbe34f2d3d4ed7
Author: tqchen <[email protected]>
AuthorDate: Tue Apr 29 19:17:54 2025 -0400

    [FFI] Fix the range based child slot checking
---
 ffi/include/tvm/ffi/object.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/ffi/include/tvm/ffi/object.h b/ffi/include/tvm/ffi/object.h
index 303dd66e69..107143e145 100644
--- a/ffi/include/tvm/ffi/object.h
+++ b/ffi/include/tvm/ffi/object.h
@@ -672,7 +672,8 @@ TVM_FFI_INLINE bool IsObjectInstance(int32_t 
object_type_index) {
   int32_t begin = target_type_index;
   // The condition will be optimized by constant-folding.
   if constexpr (TargetType::_type_child_slots != 0) {
-    int32_t end = begin + TargetType::_type_child_slots;
+    // total_slots = child_slots + 1 (including self)
+    int32_t end = begin + TargetType::_type_child_slots + 1;
     if (object_type_index >= begin && object_type_index < end) return true;
   } else {
     if (object_type_index == begin) return true;

Reply via email to