-
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
[TVM PyTorch Integration] libstdc++ CXX11 ABI Compatibility & boolean tensor support #12232
Merged
Conversation
This file contains 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
juda
commented
Jul 29, 2022
yelite
reviewed
Jul 29, 2022
src/contrib/torch/tvm_module_wrapper/RuntimeModuleWrapperTVM.cc
Outdated
Show resolved
Hide resolved
src/contrib/torch/tvm_module_wrapper/RuntimeModuleWrapperTVM.cc
Outdated
Show resolved
Hide resolved
juda
changed the title
libstdc++ CXX11 ABI Compatibility & boolean tensor support
[TVM PyTorch Integration] libstdc++ CXX11 ABI Compatibility & boolean tensor support
Aug 8, 2022
yelite
reviewed
Aug 12, 2022
src/contrib/torch/tvm_module_wrapper/RuntimeModuleWrapperTVM.cc
Outdated
Show resolved
Hide resolved
src/contrib/torch/tvm_module_wrapper/RuntimeModuleWrapperTVM.cc
Outdated
Show resolved
Hide resolved
src/contrib/torch/tvm_module_wrapper/RuntimeModuleWrapperTVM.cc
Outdated
Show resolved
Hide resolved
src/contrib/torch/tvm_module_wrapper/RuntimeModuleWrapperTVM.cc
Outdated
Show resolved
Hide resolved
src/contrib/torch/tvm_module_wrapper/RuntimeModuleWrapperTVM.cc
Outdated
Show resolved
Hide resolved
src/contrib/torch/tvm_module_wrapper/RuntimeModuleWrapperTVM.cc
Outdated
Show resolved
Hide resolved
yelite
reviewed
Aug 16, 2022
src/contrib/torch/tvm_module_wrapper/RuntimeModuleWrapperTVM.cc
Outdated
Show resolved
Hide resolved
src/contrib/torch/tvm_module_wrapper/RuntimeModuleWrapperTVM.cc
Outdated
Show resolved
Hide resolved
src/contrib/torch/tvm_module_wrapper/RuntimeModuleWrapperTVM.cc
Outdated
Show resolved
Hide resolved
masahi
approved these changes
Aug 17, 2022
xinetzone
pushed a commit
to daobook/tvm
that referenced
this pull request
Nov 25, 2022
… tensor support (apache#12232) * first commit * rename * cmake * deprecated * newline * config * config * typo * skip tvm_class * rename * delete ptr * delete ptr * save progress * boolean support * cmake file * polish code * compile config * improving the codes * format * doc&errormsg * zero-cost copy * one step * to ndarray * extra output * delete extra codes * update test * boolean support * strong test * decrease memory copy * polish * reformat * polish * remove redundant import Co-authored-by: juda <yzhou@octoml.ai>
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.
This PR solves two issues:
The compatibility of libstdc++ CXX11 ABI.
Currently, the official PyTorch distribution uses old symbols from libstdc++, which conflicts with the symbols used by TVM. The issue was discussed here before.
We address this issue by compiling the code snippets involving TVM and Torch separately, with their right libstdc++ CXX ABI. The TVM-related codes (RuntimeModuleWrapperTVM.cc) are built under the new CXX11 ABI, while the Torch-related codes (RuntimeModuleWrapperTorch.cc) are built under the same CXX11 ABI as the installed PyTorch, and linked together by a pure C header (runtime_bridge.h).
The lack of the support of boolean tensor.
Currently, If we tried to use
optimze_torch
with an input of boolean tensor, it will fail because it’s not supported by DLPack ([DISCUSS] Support kDLBool type dmlc/dlpack#75). We might want to work around it since some models use boolean tensor.We address this issue by extending the DLTensor with an extra
is_bool
field, guiding us to convert NDArray and DLTensor with the correct type. If the DLTensor is not boolean, the behavior of data transformation is the same as the previous codes.@yelite @masahi @junrushao1994