You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by "tqchen (via GitHub)" <gi...@apache.org> on 2025/06/14 13:14:50 UTC

[PR] [FFI][REFACTOR] Enhance reflection [tvm]

tqchen opened a new pull request, #18059:
URL: https://github.com/apache/tvm/pull/18059

   This PR enhances and refactors the reflection module to support nanobind/pybind style reflection definition.
   
   This is one step to upgrade the overall reflection mechanism in the project.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FFI][REFACTOR] Enhance reflection [tvm]

Posted by "tqchen (via GitHub)" <gi...@apache.org>.
tqchen commented on PR #18059:
URL: https://github.com/apache/tvm/pull/18059#issuecomment-2972759875

   FYI @Ubospica @DarkSharpness


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FFI][REFACTOR] Enhance reflection [tvm]

Posted by "Johnson9009 (via GitHub)" <gi...@apache.org>.
Johnson9009 commented on PR #18059:
URL: https://github.com/apache/tvm/pull/18059#issuecomment-2974905484

   @tqchen Thanks for the explanation, for the cross language binding solution, In comparison with (ctypes, Cython more Python side), (pybind11, nanobind, boost, more C++ side), I love TVM's FFI more, we needn't write lots of glue code in C++ like pybind11, we just need decorate the Python side class to the Python part with the C++ part. If we need to do some process before the FFI call from Python to C++, we can write the process logic in Python directly, that so nice.
   
   What I want to know is the future of reflection usage, does the usage of example will only replace the current reflection visitor? or the method binding will use the method instead of current packed function way?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FFI][REFACTOR] Enhance reflection [tvm]

Posted by "tqchen (via GitHub)" <gi...@apache.org>.
tqchen commented on PR #18059:
URL: https://github.com/apache/tvm/pull/18059#issuecomment-2976288988

   great point, right now we plan to only replace reflection visitor. 
   
   The ffi::Function and other elements will be preserved and likely built on top with optional extra metadata.  
   
   Note that it is still ffi::Function under the hood, and python side decorator will be preserved, the method binding will allow us to expose private method funtions (x.__foo) for example, and write x.foo in python to call into x.__foo similar to the current way. We will also likely preserve the global function registration so if we want to choose to expose methods as global functions it will continue to work. I expect most code likely will be like this.
   
   It will indeed allow full method decoration on c++ side with meta-data, but also easily shifts some to c++ if needed.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FFI][REFACTOR] Enhance reflection [tvm]

Posted by "tqchen (via GitHub)" <gi...@apache.org>.
tqchen commented on PR #18059:
URL: https://github.com/apache/tvm/pull/18059#issuecomment-2972762472

   Example code https://github.com/apache/tvm/blob/140bc3b0ffdf445e5e38ed81b6bbe3342cdb548e/ffi/tests/cpp/test_reflection.cc


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FFI][REFACTOR] Enhance reflection [tvm]

Posted by "Johnson9009 (via GitHub)" <gi...@apache.org>.
Johnson9009 commented on PR #18059:
URL: https://github.com/apache/tvm/pull/18059#issuecomment-2973874626

   Curious, why we will refactor the reflection implementation, there isn't any disagree, just want to know the motivation. For the new FFI's refactor, I think it will be faster (only provide cython solution) and powerful (Array<Any>), so does the future implementation of reflection will be performance better or something else? Thanks. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FFI][REFACTOR] Enhance reflection [tvm]

Posted by "tqchen (via GitHub)" <gi...@apache.org>.
tqchen merged PR #18059:
URL: https://github.com/apache/tvm/pull/18059


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FFI][REFACTOR] Enhance reflection [tvm]

Posted by "tqchen (via GitHub)" <gi...@apache.org>.
tqchen commented on PR #18059:
URL: https://github.com/apache/tvm/pull/18059#issuecomment-2974540411

   thanks @Johnson9009 for asking! there are several reasons, mostly better design, broader coverage and faster speed
   
   - It will be able to be more unified with the Any/AnyView system, so we can for example have Any as a field in object
   - More generically handle things like type exposures to python, opening doors to getting stub information
   - Likely the new impl will be faster when accessing AST fields as we will directly jump to getter of the field instead of running through runtime visitor
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FFI][REFACTOR] Enhance reflection [tvm]

Posted by "Johnson9009 (via GitHub)" <gi...@apache.org>.
Johnson9009 commented on PR #18059:
URL: https://github.com/apache/tvm/pull/18059#issuecomment-2976495737

   Got it, thanks.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org