Uh oh!
There was an error while loading. Please reload this page.
[PyTorch]Add PyTorchTVM: compile torchscript to tvm and export as pytorch_op - #8777
Conversation
comaniac
commented
Aug 18, 2021
It would be good for this scope of new feature to start with an RFC. |
junrushao
commented
Aug 18, 2021
Yeah it is super exciting feature for TVM, so would get more visibility in the community if we have like a RFC |
Meteorix
commented
Aug 19, 2021
Thanks, I will write an RFC this week. |
Meteorix
commented
Aug 25, 2021
jcf94
commented
Aug 25, 2021
Looks great! cc @minminsun |
c8461f4 to
e38511cComparejroesch
commented
Sep 22, 2021
@Meteorix any updates on when this will be ready for review? happy to help shepherd these changes and work with you to get them merged. |
junrushao
commented
Sep 22, 2021
Meteorix
commented
Sep 22, 2021
Yes, it's ready for review! |
| cmake_minimum_required(VERSION 3.2) | ||
| project(tf_tvmdsoop C CXX) | ||
| set(TFTVM_COMPILE_FLAGS -std=c++14) |
| python3 -c "import tvm; print(tvm.runtime.enabled('gpu'))" | grep -e 1 | ||
| if [ "$?" -eq 0 ]; then | ||
| echo "Build PT_TVMCLASS with gpu support and execute tests" | ||
| CMAKE_OPTIONS="-DUSE_CUDA=/data00/liuxin.ai/cuda_111 -DPython3_EXECUTABLE=python3 -DTVM_ROOT=${TVM_ROOT}" |
| model = resnet50().half().cuda() | ||
| x = torch.rand([1, 3, 244, 244]).half().cuda() |
kongroo
commented
Oct 8, 2021
I've fixed some namespace and style issues. Could you please help review this PR? @junrushao1994@jcf94@msakai@jroesch And I have some questions to discuss:
|
masahi
commented
Oct 22, 2021
Sorry I forgot about this PR, will take another look soon. cc @junrushao1994@jroesch |
There was a problem hiding this comment.
Code mostly looks good. I have a couple of questions around target/device.
To answer @kongroo's question:
- For multi-threaded applications, users should create multiple instances of TVM / PT module per thread from the same dll.
- Not sure if that is a TVM's problem or an OS issue (related? https://stackoverflow.com/questions/16525016/how-to-dynamic-load-the-library-with-same-name-but-in-different-directory-in-lin), but always enforcing an absolute path sounds good to me (either in
dso_library.ccor at the application level). - Currently, our performance on dynamic input is terrible. Moreover, we need to deal with the same problem in other contexts too, such as in CUTLASS BYOC #9261 or AutoTIR. So I suggest deferring this problem for now.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
masahi
commented
Nov 2, 2021
@kongroo Please make sure to pass the CI. @jroesch@junrushao1994@tqchen@comaniac Please take a look if you want to review. Otherwise I'm going to merge this week, I think we can bring this to the v0.8 release. |
masahi
commented
Nov 2, 2021
@kongroo Looks like you've hit an unfortunate flaky test error, please kick another job. |
kongroo
commented
Nov 4, 2021
Finally CI passed... |
masahi
commented
Nov 5, 2021
…orch_op (apache#8777) * add pt_op * add compile api * perf: support set_output_zero_copy * fix: cpu device_id mismatch * fix: pt_class test script * refactor: unify namespace to tvm.contrib.torch * add ASF header * build: set pt tvmdsoop default off * build: remove unset_log_macros.h * refactor: change header order * refactor: fix python code format * style: resolve pylint issues * style: add blank line * style: fix pylint invalid_name * trigger CI * test: add more test scripts * style: add empty lines * test: update test for trace tvm module * style: fix linting issues * style: remove single quote * style: disable pylint invalid-name * trigger CI * trigger CI Co-authored-by: kongroo <imjcqt@gmail.com>
…orch_op (apache#8777) * add pt_op * add compile api * perf: support set_output_zero_copy * fix: cpu device_id mismatch * fix: pt_class test script * refactor: unify namespace to tvm.contrib.torch * add ASF header * build: set pt tvmdsoop default off * build: remove unset_log_macros.h * refactor: change header order * refactor: fix python code format * style: resolve pylint issues * style: add blank line * style: fix pylint invalid_name * trigger CI * test: add more test scripts * style: add empty lines * test: update test for trace tvm module * style: fix linting issues * style: remove single quote * style: disable pylint invalid-name * trigger CI * trigger CI Co-authored-by: kongroo <imjcqt@gmail.com>
…orch_op (apache#8777) * add pt_op * add compile api * perf: support set_output_zero_copy * fix: cpu device_id mismatch * fix: pt_class test script * refactor: unify namespace to tvm.contrib.torch * add ASF header * build: set pt tvmdsoop default off * build: remove unset_log_macros.h * refactor: change header order * refactor: fix python code format * style: resolve pylint issues * style: add blank line * style: fix pylint invalid_name * trigger CI * test: add more test scripts * style: add empty lines * test: update test for trace tvm module * style: fix linting issues * style: remove single quote * style: disable pylint invalid-name * trigger CI * trigger CI Co-authored-by: kongroo <imjcqt@gmail.com>
…orch_op (apache#8777) * add pt_op * add compile api * perf: support set_output_zero_copy * fix: cpu device_id mismatch * fix: pt_class test script * refactor: unify namespace to tvm.contrib.torch * add ASF header * build: set pt tvmdsoop default off * build: remove unset_log_macros.h * refactor: change header order * refactor: fix python code format * style: resolve pylint issues * style: add blank line * style: fix pylint invalid_name * trigger CI * test: add more test scripts * style: add empty lines * test: update test for trace tvm module * style: fix linting issues * style: remove single quote * style: disable pylint invalid-name * trigger CI * trigger CI Co-authored-by: kongroo <imjcqt@gmail.com>
To increase the TVM accessibility for PyTorch users, we add PyTorchTVM module to support the following workflow:
The example usage is here: apps/pt_class/tests/test_pt_script.py. We hope to further discuss the user api with the community. Please help review @Laurawly@junrushao1994@tqchen, thanks!
Credit: the original author is @kongroo .