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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
