-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Fixing issue #17840 #18526
base: master
Are you sure you want to change the base?
Fixing issue #17840 #18526
Conversation
Hey @jinboci , Thanks for submitting the PR
CI supported jobs: [website, windows-cpu, unix-cpu, centos-gpu, sanity, edge, unix-gpu, windows-gpu, centos-cpu, clang, miscellaneous] Note: |
@mxnet-bot run ci [unix-cpu] |
Jenkins CI successfully triggered : [unix-cpu] |
contrib/tvmop/compile.py
Outdated
imported_modules | ||
except NameError: | ||
imported_modules = [] | ||
if len(imported_modules): |
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.
why checking imported_modules
while actually accessing func_binary.imported_modules
?
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.
Sorry, I fixed it.
src/c_api/c_api.cc
Outdated
libpath_module->Load(libpath); | ||
#if MXNET_USE_CUDA | ||
tvm::runtime::TVMOpModule cubin_module; | ||
cubin_module.Load("libtvmop.cubin"); |
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.
it should combine with the libpath
, otherwise it is loading from ./libtvmop.cubin
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.
Fixed. Thanks!
@mxnet-bot run ci [all] |
Jenkins CI successfully triggered : [unix-cpu, edge, centos-cpu, website, windows-cpu, clang, sanity, centos-gpu, windows-gpu, unix-gpu, miscellaneous] |
@mxnet-bot run ci [all] |
Jenkins CI successfully triggered : [clang, edge, sanity, unix-cpu, windows-cpu, centos-cpu, miscellaneous, website, windows-gpu, centos-gpu, unix-gpu] |
libpath_module->Load(libpath); | ||
#if MXNET_USE_CUDA | ||
std::string libpathstr(libpath); | ||
std::string cubinpath = libpathstr.substr(0, libpathstr.size() - 11) + "libtvmop.cubin"; |
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.
would be better to pass libpath
as dir, and do libpath + "libtvmop.so" as well to keep consistency.
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.
I rewrite it in a more elegant way :)
Yes, but
MXLoadTVMOp
is called at:
https://github.com/apache/incubator-mxnet/blob/1bf881f381f91b157a26d9beddcaa8f4960cc038/python/mxnet/tvmop.py#L31-L32
where_LIB_TVM_OP
is returned from the
https://github.com/apache/incubator-mxnet/blob/1bf881f381f91b157a26d9beddcaa8f4960cc038/python/mxnet/libinfo.py#L25
, and_LIB_TVM_OP[0]
is the path oflibtvmop.so
.
We may need to modifyfind_lib_path
or write a new function to get the directory thatlibtvmop.so
locates.
contrib/tvmop/compile.py
Outdated
try: | ||
func_binary.imported_modules | ||
except NameError: | ||
func_binary.imported_modules = [] |
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.
from https://github.com/apache/incubator-tvm/blob/master/python/tvm/runtime/module.py#L136 we can see func_binary.imported_modules
should always exist.
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.
Thank you for your review. I have deleted these lines.
Co-authored-by: Yizhi Liu <[email protected]>
Description
(Brief description on what this PR is about)
Fixing issue #17840. Referring to the tutorial, the problems causing the issue #17840 include:
This pull request fixes the issue by saving the compiled GPU module to
libtvmop.cubin
and loading it whenimport mxnet
.Checklist
Essentials
Please feel free to remove inapplicable items for your PR.
Changes
Comments