Support runtime defined function wrapping of library module packed functions#9342
Merged
Conversation
wrapping by providing a PackedFunctionWrapper object at construction.
tqchen
reviewed
Oct 21, 2021
tqchen
requested changes
Oct 22, 2021
Member
tqchen
left a comment
There was a problem hiding this comment.
Thanks @csullivan some followup comments and I think it is good to go. The main rationale behind is to minimize the API surface getting exposed. and some readability(internal documentation of wrapper semantics)
| */ | ||
|
|
||
| /*! | ||
| * \file dso_module.h |
Member
There was a problem hiding this comment.
depending on whether or not we need to expose this interface, we might want to put it back to the cc file to reduce the amount of internal interface. surface.
Contributor
Author
There was a problem hiding this comment.
As Library is an abstraction that is already exposed, I decided to reduce the interface to a helper that returns one instead.
This was referenced Oct 22, 2021
tqchen
approved these changes
Oct 26, 2021
ylc
pushed a commit
to ylc/tvm
that referenced
this pull request
Jan 7, 2022
…nctions (apache#9342) * Expose DSOLibrary and add documentation. * Allow runtimes to specialize library module function wrapping by providing a PackedFunctionWrapper object at construction. * Apply clang formatting. * Use std::function. * Minimize DSOLibrary interface. * Add param and return documentation to PackedFuncWrapper type alias.
ylc
pushed a commit
to ylc/tvm
that referenced
this pull request
Jan 13, 2022
…nctions (apache#9342) * Expose DSOLibrary and add documentation. * Allow runtimes to specialize library module function wrapping by providing a PackedFunctionWrapper object at construction. * Apply clang formatting. * Use std::function. * Minimize DSOLibrary interface. * Add param and return documentation to PackedFuncWrapper type alias.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Targets which compile directly to SO during codegen utilize
runtime.module.loadfile_soat runtime to dynamically open these compiled binaries. This flow currently does not have any point of extension in which a runtime can customize the behavior of the underlying LibraryModuleNode. This PR exposes DSOLibrary and extends LibraryModuleNode to utilize a runtime defined PackedFunctionWrapper in order to specialize the calling convention of dynamically loaded function symbols.This allows a device runtime to then specify a custom DSOLibrary based loadfile implementation: