-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Conversation
Hey @samskalicky , Thanks for submitting the PR
CI supported jobs: [windows-cpu, clang, unix-cpu, sanity, edge, website, centos-cpu, unix-gpu, centos-gpu, miscellaneous, windows-gpu] Note: |
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.
@samskalicky Thank you!
I have two suggestions : )
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.
LGTM!
Thank you for the contribution!
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.
LGTM
Description
This is a follow-on PR after the initial investigation in #18904 to support loading libraries containing MXNet backend components (particularly operators). Since #19241, the version script was removed and now Linux builds of
libmxnet.so
expose all MXNet symbols. This opens the door for dynamically loading libraries that depend onlibmxnet.so
.This PR adds a build option
BUILD_EXTENSION
to the CMakeLists.txt file to give a path to the extension directory to build. This enables the existing MXNet build infrastructure to provide all includes directories automatically which simplifies building extensions.An example is also added in
examples/extensions/lib_external_ops
that builds an operator that is equivalent to a built-in/backend operator into a shared object and uses the existingmx.library.load
API to load that library at runtime.Caveots
Windows is not supported since by default all symbols are hidden in
mxnet.dll
so dynamically loading libraries will not work. Similarly with Mac, the version script does not expose the necessary symbols at this time. These other platforms can be considered in the future based on user request & community motivation.