Skip to content

[CORE] Add type subsumption and object-ref containment relations#647

Open
tqchen wants to merge 1 commit into
apache:mainfrom
tqchen:task-tvm-ffi-explore-api-for-type-contain
Open

[CORE] Add type subsumption and object-ref containment relations#647
tqchen wants to merge 1 commit into
apache:mainfrom
tqchen:task-tvm-ffi-explore-api-for-type-contain

Conversation

@tqchen

@tqchen tqchen commented Jun 27, 2026

Copy link
Copy Markdown
Member

This change:

  • exposes type_subsumes_v<TargetType, SourceType> as the public target-first relation used for direct container storage reuse;
  • adds object_ref_contains_v<RefType, ObjectType> for proving that raw object pointers can be wrapped without a runtime type check;
  • updates GetRef, recursive container specializations, and focused compile-time and runtime coverage.

The separate names distinguish storage subsumption from object-ref containment while allowing direct variable-template specialization for typed refs.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors type trait checks in the TVM FFI library by replacing details::type_contains_v with type_subsumes_v and introducing object_ref_contains_v for safer object reference containment checks. The feedback highlights two critical template metaprogramming issues that could lead to hard compilation errors: first, the Tuple specialization of type_subsumes_v needs to safely handle mismatched pack sizes; second, object_ref_contains_v should be made SFINAE-safe to prevent compilation failures when instantiated with primitive or non-container reference types.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread include/tvm/ffi/container/tuple.h Outdated
Comment thread include/tvm/ffi/type_traits.h Outdated
@tqchen tqchen force-pushed the task-tvm-ffi-explore-api-for-type-contain branch 2 times, most recently from 32d8c49 to 2c522a6 Compare June 27, 2026 15:05
@tqchen tqchen force-pushed the task-tvm-ffi-explore-api-for-type-contain branch from 2c522a6 to 9c6677c Compare June 27, 2026 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant