-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[FFI][REFACTOR] Streamline Object Declare Macros #18289
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This PR streamlines the macros related to object and ref declaration. - TVM_FFI_DECLARE_BASE_OBJECT_INFO => TVM_FFI_DECLARE_OBJECT_INFO - TVM_FFI_DECLARE_FINAL_OBJECT_INFO => TVM_FFI_DECLARE_OBJECT_INFO_FINAL - Move mutable annotation as field in the object - Auto detect mutablity in object ref getter and operator ptr
Upgrade Guide
For macros that contains _MUTABLE, instead declare _type_mutable=true in the object static field |
This PR updates the object declaration macros, in order to follow the recent TVM refactor apache/tvm#18289.
This PR updates the object declaration macros, in order to follow the recent TVM refactor apache/tvm#18289.
|
It also looks great to me. Thanks! |
| static constexpr const char* _type_key = "example.MyIntPair"; | ||
| // This macro registers the class with the FFI system to set up the right type index | ||
| TVM_FFI_DECLARE_FINAL_OBJECT_INFO(MyIntPairObj, tvm::ffi::Object); | ||
| TVM_FFI_DECLARE_OBJECT_INFO_FINAL("example.MyIntPair", MyIntPairObj, tvm::ffi::Object); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need formatting here.
| // Required: declare type information | ||
| static constexpr const char* _type_key = "testing.TestIntPair"; | ||
| TVM_FFI_DECLARE_FINAL_OBJECT_INFO(TestIntPairObj, tvm::ffi::Object); | ||
| TVM_FFI_DECLARE_OBJECT_INFO_FINAL("testing.TestIntPair", TestIntPairObj, tvm::ffi::Object); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto. In markdown we don't have auto formatting.
This PR streamlines the macros related to object and ref declaration.