Skip to content

[API] Add type index query mode#640

Merged
tqchen merged 2 commits into
apache:mainfrom
tqchen:tvm-ffi-add-existing-type-index-query-mode
Jun 21, 2026
Merged

[API] Add type index query mode#640
tqchen merged 2 commits into
apache:mainfrom
tqchen:tvm-ffi-add-existing-type-index-query-mode

Conversation

@tqchen

@tqchen tqchen commented Jun 21, 2026

Copy link
Copy Markdown
Member

Summary

  • Add query-only behavior to TVMFFITypeGetOrAllocIndex when parent_type_index == -2.
  • Return the existing registered type index on hit, or -2 on miss without allocating/registering or mutating parent metadata.
  • Document the concrete -2 C API behavior and add focused C++ coverage for hit and miss/no-registration behavior.

This query mode is reserved for a future release update that may optionally query type indices at startup.

@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 introduces a query-only mode to TVMFFITypeGetOrAllocIndex by using a parent_type_index of -2. When this value is passed, the function queries the existing type index for the given type key without allocating a new one, returning -2 if the key is not registered. The changes include updates to the C API documentation, the implementation of QueryTypeIndex in TypeTable, and corresponding unit tests to verify the new behavior. No review comments were provided, so there is no feedback to address.

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.

@tqchen tqchen changed the title Add type index query mode [API] Add type index query mode Jun 21, 2026
Reserve parent_type_index == -2 as a query-only TVMFFITypeGetOrAllocIndex mode that returns an existing registered index or -2 on miss without allocation.

This is reserved for a future release update that may optionally query type indices at startup.
@tqchen tqchen force-pushed the tvm-ffi-add-existing-type-index-query-mode branch from 7643c21 to 9168b7c Compare June 21, 2026 01:14
@tqchen tqchen force-pushed the tvm-ffi-add-existing-type-index-query-mode branch from 8c16e95 to cadff03 Compare June 21, 2026 02:03
@tqchen tqchen merged commit 78c4e43 into apache:main Jun 21, 2026
9 checks passed
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.

2 participants