You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2020/06/14 04:57:26 UTC

[GitHub] [incubator-tvm] chaozju opened a new issue #5804: Dump module to llvm ir

chaozju opened a new issue #5804:
URL: https://github.com/apache/incubator-tvm/issues/5804


   Is there a way to dump the Module to llvm ir into a `.s` file which can be later built to standalone executable by `clang` ?
   
   where I am:
   
   - dump an output from python following toturial
   ```python
   model_name = 'resnet18'
   model = getattr(torchvision.models, model_name)(pretrained=True)
   model = model.eval()
   
   scripted_model = torch.jit.trace(model, input_data).eval()
   mod, params = relay.frontend.from_pytorch(scripted_model,shape_list)
   
   with relay.build_config(opt_level=3):
       graph, lib, params = relay.build(mod,target='llvm',target_host='llvm',params=params)
   
   with open('/home/chao/tvm-playground/tvm-project/a.s','w') as f:
       f.write(lib.get_source())
   ```
   
   - assembling and linking with llvm backend
   ```bash
   llvm-as -o a.bc a.s
   llc -o a.o a.bc
   as a.o -o a.as
   cp ~/tvm/build/libtvm*.so ./
   export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD
   ld -L "./libtvm.so" "./libtvm_runtime.so" "./libtvm_topi.so" -o a.out a.as
   ```
   - result
   ```bash
   chao@DESKTOP-B79IRTG:~/tvm-playground/tvm-project$ ld -L "./libtvm.so" "./libtvm_runtime.so" "./libtvm_topi.so" -o a.out a.as
   ld: a.as: undefined reference to symbol 'memset@@GLIBC_2.2.5'
   //lib/x86_64-linux-gnu/libc.so.6: error adding symbols: DSO missing from command line
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-tvm] tqchen closed issue #5804: Dump module to llvm ir

Posted by GitBox <gi...@apache.org>.
tqchen closed issue #5804:
URL: https://github.com/apache/incubator-tvm/issues/5804


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-tvm] tqchen commented on issue #5804: Dump module to llvm ir

Posted by GitBox <gi...@apache.org>.
tqchen commented on issue #5804:
URL: https://github.com/apache/incubator-tvm/issues/5804#issuecomment-643825044


   Move discussion to https://discuss.tvm.ai/t/dump-module-to-llvm-ir/6966/8


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org