[ABI] Add begin_index to TypeAttrColumn#471
Conversation
Summary of ChangesHello @tqchen, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a begin_index to TypeAttrColumn to optimize for space and locality by allowing type attributes to cover a narrow range of type indices. The changes are propagated through C++, Python, and Rust FFI layers, and a new test case is added to verify the functionality.
While the changes are generally well-implemented, I've identified a critical ABI compatibility issue with the modification of the TVMFFITypeAttrColumn struct. I've also suggested a performance and readability improvement for the vector manipulation logic in src/ffi/object.cc. Please see my detailed comments.
ac9cf9f to
777318e
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a begin_index field to the TVMFFITypeAttrColumn structure, enabling sparse storage of type attributes by specifying a range of type indices. The changes include updates to the C API, C++ accessors, and language bindings for Python and Rust. While the logic for indexing and bounds checking is sound, the claim of ABI compatibility is limited to 64-bit little-endian systems and does not hold for 32-bit or big-endian platforms. Additionally, there is some redundancy in the internal TypeAttrColumnData structure that should be addressed for better maintainability.
777318e to
f7ee338
Compare
This PR adds a begin_index field to TypeAttrColumn. The begin_index enables the type attributes to store narrowly a range of type indices which can be useful when type attribute is narrowed to specific subscope where objects are allocated continuously so we can optimize for space and locality.
As of now the accessor of the TypeAttrColumn is limited to extra/cc so impact is limited. To be careful, we begin_index is set to 0 for next few versions and will migrate to nonzero size in 1.0 (so i64 platform size is compatible)