You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2023/01/12 04:32:39 UTC

[GitHub] [tvm] slyubomirsky opened a new pull request, #13769: [testing][py_converter] Enhance py_converter to better support entire modules

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

   This PR makes a few improvements to `py_converter` to make it more useful for fuzz testing, especially when running larger modules.
   
   In particular, these changes are to support returning the definition of a global var directly (e.g., if you do `run_as_python(main_var, mod=mod)`, the result will be a function corresponding to mod["main"]) and to correct two bugs in the previous implementation:
   * Previously, it was not possible to insert a function into a runtime container object like an ADT. This was because the converter was simply compiling Relay functions into Python functions. This change solves this problem by registering the functions into `PackedFunc`s. However, another fix was also needed: Even though `PackedFunc` is an `ObjectRef` in C++, the Python bindings do not recognize `PackedFunc`s as `Object`s, so a debug wrapper function was registered to enable this case. Hopefully that will not be destructive.
   * The implementation relied on `IRModule.from_expr` to wrap passed in expressions in a module. However, `from_expr` will not overwrite the `main` function if one is passed in via the `functions` argument. Thus, if the user passed in a module that already had a `main` function defined, the wrapping would be done incorrectly and result in the `main` being copied many times. This PR corrects this error by not assuming that the name `main` will be available and instead constructing a new module with a reserved name for the target.
   
   None of the cases above had been tested before (there are now tests included)


-- 
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


[GitHub] [tvm] slyubomirsky commented on pull request #13769: [testing][py_converter] Enhance py_converter to better support entire modules

Posted by GitBox <gi...@apache.org>.
slyubomirsky commented on PR #13769:
URL: https://github.com/apache/tvm/pull/13769#issuecomment-1385829767

   @tvm-bot rerun


-- 
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


[GitHub] [tvm] junrushao commented on pull request #13769: [testing][py_converter] Enhance py_converter to better support entire modules

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

   CC @Hzfengsy would you like to review this PR? 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


[GitHub] [tvm] slyubomirsky commented on pull request #13769: [testing][py_converter] Enhance py_converter to better support entire modules

Posted by GitBox <gi...@apache.org>.
slyubomirsky commented on PR #13769:
URL: https://github.com/apache/tvm/pull/13769#issuecomment-1387449378

   I think there's been another spurious failure.


-- 
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


[GitHub] [tvm] slyubomirsky commented on pull request #13769: [testing][py_converter] Enhance py_converter to better support entire modules

Posted by GitBox <gi...@apache.org>.
slyubomirsky commented on PR #13769:
URL: https://github.com/apache/tvm/pull/13769#issuecomment-1381037256

   @tqchen helpfully advised that the issue stems from passing a list containing a PackedFunc to the constructor. Calling the `ADT` constructor via the FFI API directly (while a little strange) gets around this issue. That seems like a good fix that does not require disrupting other sections of the codebase, so I will implement it


-- 
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


[GitHub] [tvm] Hzfengsy merged pull request #13769: [testing][py_converter] Enhance py_converter to better support entire modules

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


-- 
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


[GitHub] [tvm] slyubomirsky commented on pull request #13769: [testing][py_converter] Enhance py_converter to better support entire modules

Posted by GitBox <gi...@apache.org>.
slyubomirsky commented on PR #13769:
URL: https://github.com/apache/tvm/pull/13769#issuecomment-1380866581

   Hm, this test worked in my fork. Wonder why it fails in mainline


-- 
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


[GitHub] [tvm] slyubomirsky commented on pull request #13769: [testing][py_converter] Enhance py_converter to better support entire modules

Posted by GitBox <gi...@apache.org>.
slyubomirsky commented on PR #13769:
URL: https://github.com/apache/tvm/pull/13769#issuecomment-1380902667

   The problem seems to be that this cast on mainline will not convince Python that the result is an opaque Object rather than a PackedFunc. Not sure how to change it:
   ```python
   TVM_REGISTER_GLOBAL("runtime.CastPackedFuncToObject").set_body_typed([](const PackedFunc& pf) {
     return Downcast<ObjectRef>(pf);
   });
   ```
   Any advice?


-- 
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


[GitHub] [tvm] slyubomirsky commented on pull request #13769: [testing][py_converter] Enhance py_converter to better support entire modules

Posted by GitBox <gi...@apache.org>.
slyubomirsky commented on PR #13769:
URL: https://github.com/apache/tvm/pull/13769#issuecomment-1397687275

   @tvm-bot rerun


-- 
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


[GitHub] [tvm] slyubomirsky commented on pull request #13769: [testing][py_converter] Enhance py_converter to better support entire modules

Posted by GitBox <gi...@apache.org>.
slyubomirsky commented on PR #13769:
URL: https://github.com/apache/tvm/pull/13769#issuecomment-1379802327

   Please review @junrushao (or tag other reviewers)


-- 
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


[GitHub] [tvm] slyubomirsky commented on pull request #13769: [testing][py_converter] Enhance py_converter to better support entire modules

Posted by GitBox <gi...@apache.org>.
slyubomirsky commented on PR #13769:
URL: https://github.com/apache/tvm/pull/13769#issuecomment-1385777133

   The CI error appears to be spurious.


-- 
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


[GitHub] [tvm] tvm-bot commented on pull request #13769: [testing][py_converter] Enhance py_converter to better support entire modules

Posted by GitBox <gi...@apache.org>.
tvm-bot commented on PR #13769:
URL: https://github.com/apache/tvm/pull/13769#issuecomment-1379801686

   <!---bot-comment-->
   
   Thanks for contributing to TVM! Please refer to the contributing guidelines https://tvm.apache.org/docs/contribute/ for useful information and tips. Please request code reviews from [Reviewers](https://github.com/apache/incubator-tvm/blob/master/CONTRIBUTORS.md#reviewers) by @-ing them in a comment.
   
   <!--bot-comment-ccs-start-->
    * No users to tag found in teams: `testing`, `py_converter` <sub>See [#10317](https://github.com/apache/tvm/issues/10317) for details</sub><!--bot-comment-ccs-end-->
   
   <sub>Generated by [tvm-bot](https://github.com/apache/tvm/blob/main/ci/README.md#github-actions)</sub>


-- 
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