[REFACTOR][RUNTIME] Transition metadata into ffi#18784
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 undertakes a significant refactoring effort to modernize how metadata is stored and managed within TVM's runtime and codegen components. By migrating to FFI-native data structures like 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 PR is a large refactoring to migrate metadata storage to use FFI data structures like ffi::Map, ffi::Array, and ffi::Any. This modernizes the storage and conversion of these data structures. The changes are widespread across the codebase, touching runtime modules for various backends (CUDA, ROCm, OpenCL, Metal, Vulkan, etc.) and JSON serialization logic. The core change is the refactoring of FunctionInfo from a plain struct to a TVM ObjectRef, and using ffi::Map instead of std::unordered_map for function info maps. Most of the changes are correct and improve code clarity and consistency. I've found one critical bug that will break compilation and one opportunity for optimization.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request is a large-scale refactoring that migrates metadata storage to use FFI data structures, such as ffi::String, ffi::Array, and ffi::Map. This is a significant and positive change that modernizes data handling and serialization throughout the codebase. The core of the refactoring involves changing FunctionInfo to an FFI-compatible object and updating its usage across various runtime and backend components. While the refactoring is generally well-executed, I've identified several compilation errors in contrib runtimes (nnapi, arm_compute_lib, clml, tensorrt) where ffi::Array<ffi::String> is now used in places that still expect std::vector<std::string>. These issues need to be addressed to ensure the code compiles successfully.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request is a large-scale refactoring that transitions metadata storage to use FFI data structures like ffi::Map, ffi::Array, and ffi::Any. This is a significant and positive change that modernizes the codebase, improving interoperability and consistency. The changes are applied systematically across many files. I've identified a bug in the array type detection logic in codegen_json.h that could lead to a crash, and a minor inefficiency in clml_runtime.cc. With these issues addressed, this PR will be a solid improvement.
762392f to
2868edd
Compare
This PR migrates the metadata storage to use ffi data structures. This allows us to modernize the storage and conversions of these data structures and benefit from the core ffi infra. We also updates the json storage convention to store int/double as normal int double instead of converting to string as now the ffi infra can reliably handle those cases.
This PR migrates the metadata storage to use ffi data structures.
This allows us to modernize the storage and conversions of these
data structures and benefit from the core ffi infra.
We also updates the json storage convention to store int/double
as normal int double instead of converting to string as now
the ffi infra can reliably handle those cases.