Skip to content

[TVM PyTorch Integration] libstdc++ CXX11 ABI Compatibility & boolean tensor support - #12232

Merged
masahi merged 35 commits into
apache:mainfrom
juda:cxx11abi
Aug 17, 2022
Merged

[TVM PyTorch Integration] libstdc++ CXX11 ABI Compatibility & boolean tensor support#12232
masahi merged 35 commits into
apache:mainfrom
juda:cxx11abi

Conversation

@juda

@judajuda commented Jul 29, 2022

Copy link
Copy Markdown
Contributor

This PR solves two issues:

  1. 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).

  2. 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

Comment threadcmake/modules/contrib/PT_TVMDSOOP.cmake Outdated
Comment threadpython/tvm/contrib/torch/pytorch_tvm.py Outdated
Comment threadsrc/contrib/torch/tvm_module_wrapper/runtime_bridge.h Outdated
Comment threadsrc/contrib/torch/tvm_module_wrapper/runtime_bridge.h
Comment threadsrc/contrib/torch/tvm_module_wrapper/runtime_bridge.h Outdated
Comment threadsrc/contrib/torch/tvm_module_wrapper/runtime_bridge.h Outdated
Comment threadsrc/contrib/torch/tvm_module_wrapper/RuntimeModuleWrapperTVM.cc Outdated
Comment threadsrc/contrib/torch/tvm_module_wrapper/RuntimeModuleWrapperTVM.cc Outdated
@judajuda changed the title libstdc++ CXX11 ABI Compatibility & boolean tensor support[TVM PyTorch Integration] libstdc++ CXX11 ABI Compatibility & boolean tensor supportAug 8, 2022
Comment threadsrc/contrib/torch/tvm_module_wrapper/runtime_bridge.h Outdated
Comment threadsrc/contrib/torch/tvm_module_wrapper/runtime_bridge.h Outdated
Comment threadsrc/contrib/torch/tvm_module_wrapper/runtime_bridge.h Outdated
Comment threadsrc/contrib/torch/tvm_module_wrapper/RuntimeModuleWrapperTVM.cc Outdated
Comment threadsrc/contrib/torch/tvm_module_wrapper/RuntimeModuleWrapperTVM.cc Outdated
Comment threadsrc/contrib/torch/tvm_module_wrapper/RuntimeModuleWrapperTVM.cc Outdated
Comment threadsrc/contrib/torch/tvm_module_wrapper/RuntimeModuleWrapperTVM.cc Outdated
Comment threadsrc/contrib/torch/tvm_module_wrapper/RuntimeModuleWrapperTVM.cc Outdated
Comment threadsrc/contrib/torch/tvm_module_wrapper/RuntimeModuleWrapperTVM.cc Outdated
Comment threadsrc/contrib/torch/tvm_module_wrapper/RuntimeModuleWrapperTVM.cc Outdated
Comment threadsrc/contrib/torch/tvm_module_wrapper/RuntimeModuleWrapperTVM.cc Outdated
Comment threadsrc/contrib/torch/tvm_module_wrapper/RuntimeModuleWrapperTVM.cc Outdated
@masahi
masahi merged commit 073304d into apache:mainAug 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 freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@juda@masahi@yelite