Skip to content

Conversation

@junrushao
Copy link
Member

@junrushao junrushao commented Sep 19, 2025

Previously, TypeInfo stays strictly in C and is glued to Python via Cython. This PR makes it Cython side registry to store Python objects, i.e. TypeInfo, which makes it possible to lookup type info in pure Python.

This PR is split from #8.

@junrushao junrushao requested a review from tqchen September 19, 2025 06:28
@junrushao junrushao marked this pull request as ready for review September 19, 2025 06:28
@junrushao junrushao requested a review from Copilot September 19, 2025 06:31
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces Python-side TypeInfo metadata to enable type information lookup in pure Python. Previously, TypeInfo was strictly maintained in C and accessed via Cython, but this change creates a Cython-side registry to store Python objects.

Key changes:

  • Replaced C-only type registration with Python-accessible TypeInfo objects
  • Moved class attribute reflection logic from Cython to Python for better maintainability
  • Created new TypeInfo, TypeField, and TypeMethod data classes for structured metadata

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
python/tvm_ffi/_core_base.py Introduces new TypeInfo, TypeField, and TypeMethod data classes for storing type metadata
python/tvm_ffi/registry.py Moves class attribute addition logic from Cython and updates object registration to use TypeInfo
python/tvm_ffi/cython/object.pxi Replaces simple class list with TypeInfo registry and creates TypeInfo objects from C metadata
python/tvm_ffi/cython/function.pxi Removes old reflection-based class attribute addition logic
python/tvm_ffi/core.pyi Updates type annotations to reflect new TypeInfo-based registration

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@junrushao junrushao force-pushed the 2025-09-18/type-info branch 2 times, most recently from 1413e12 to ad00212 Compare September 19, 2025 07:03
@junrushao junrushao force-pushed the 2025-09-18/type-info branch 2 times, most recently from ec3f145 to b07e0a0 Compare September 19, 2025 18:05
@junrushao junrushao requested a review from tqchen September 19, 2025 18:10
@junrushao junrushao merged commit 53b2e00 into apache:main Sep 19, 2025
6 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