-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Support runtime defined function wrapping of library module packed functions #9342
Conversation
wrapping by providing a PackedFunctionWrapper object at construction.
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.
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)
src/runtime/dso_library.h
Outdated
*/ | ||
|
||
/*! | ||
* \file dso_module.h |
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.
dso_library.h
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.
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.
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.
As Library is an abstraction that is already exposed, I decided to reduce the interface to a helper that returns one instead.
…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.
…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.
Targets which compile directly to SO during codegen utilize
runtime.module.loadfile_so
at 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: