You are viewing a plain text version of this content. The canonical link for it is here.
Posted to discuss-archive@tvm.apache.org by Giuseppe Rossini via Apache TVM Discuss <no...@discuss.tvm.ai> on 2020/10/08 23:03:37 UTC

[Apache TVM Discuss] [Questions] Can we use TVM as JIT compiler?


Hi all, 

I am interested in a possible C++ integration of TVM as a jit compiler. Can we write a compute/schedule from C++? Something on the line of:
```
int main()
{
    auto A= tvm::te::placeholder({m});
    auto B = tvm::te::compute({m}, [=](int i){ return X[i]+1;}
    auto s = tvm::create_schedule({compute.op});
    auto axis = B.axis();
    s[B].vectorize(axis[0]);
    auto func = tvm::lower(s, {A, B});
    module = tvm::build(func);
    // Set inputs, outputs
    module.run()
    // Get inputs
}
```
I "think" it should be possible, but did not find much documentation/tutorials around. Also, what about tuning? Can I write my schedule in C++, expose it in python and let the tuner tune it?

Thanks,

Giuseppe





---
[Visit Topic](https://discuss.tvm.apache.org/t/can-we-use-tvm-as-jit-compiler/8124/1) to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click here](https://discuss.tvm.apache.org/email/unsubscribe/1bc333ae135ee876f2da00390123de729cb407c44fb1087c444a70f31943f912).

[Apache TVM Discuss] [Questions] Can we use TVM as JIT compiler?

Posted by Junru Shao via Apache TVM Discuss <no...@discuss.tvm.ai>.

Definitely yes! There is no reason not to use TVM as a JIT compiler if we want to build a deep learning framework.





---
[Visit Topic](https://discuss.tvm.apache.org/t/can-we-use-tvm-as-jit-compiler/8124/2) to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click here](https://discuss.tvm.apache.org/email/unsubscribe/46972b1c8106e01d44140660909896614c65e5f7d7ee2710d6d61e7ba6ef349a).

[Apache TVM Discuss] [Questions] Can we use TVM as JIT compiler?

Posted by Junru Shao via Apache TVM Discuss <no...@discuss.tvm.ai>.

Sure! BTW, If you set USE_LLVM to ON, by default it should show up if LLVM is dynamically linked. A possible reason that it doesnt show up is that LLVM is statically linked maybe





---
[Visit Topic](https://discuss.tvm.apache.org/t/can-we-use-tvm-as-jit-compiler/8124/9) to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click here](https://discuss.tvm.apache.org/email/unsubscribe/758c493a99fe438f6341d4a2b5cfd3a40cf1ebaecb82f9a0575c7ff0cc2d492b).

[Apache TVM Discuss] [Questions] Can we use TVM as JIT compiler?

Posted by Giuseppe Rossini via Apache TVM Discuss <no...@discuss.tvm.ai>.

Yes, I don't know why it was not showing up when I was inspecting `libtvm.so` through `ldd`. 

Thanks for the help @junrushao1994!





---
[Visit Topic](https://discuss.tvm.apache.org/t/can-we-use-tvm-as-jit-compiler/8124/8) to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click here](https://discuss.tvm.apache.org/email/unsubscribe/3970ba983500152d36370a059595324473ebcb7a6f1c9cc94b6cb639ae376a46).

[Apache TVM Discuss] [Questions] Can we use TVM as JIT compiler?

Posted by Junru Shao via Apache TVM Discuss <no...@discuss.tvm.ai>.

You mean the name of LLVM shared library? It is something like libLLVM.so





---
[Visit Topic](https://discuss.tvm.apache.org/t/can-we-use-tvm-as-jit-compiler/8124/7) to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click here](https://discuss.tvm.apache.org/email/unsubscribe/dbb15bf8b869fb209302fc70c6035198dfc99e4207328f3bce602deeeac04505).

[Apache TVM Discuss] [Questions] Can we use TVM as JIT compiler?

Posted by Giuseppe Rossini via Apache TVM Discuss <no...@discuss.tvm.ai>.

Hi @junrushao1994, 

It might be that we already have the library available in our system. Could you  tell me exactly the name of the library? 

Thanks,

Giuseppe





---
[Visit Topic](https://discuss.tvm.apache.org/t/can-we-use-tvm-as-jit-compiler/8124/6) to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click here](https://discuss.tvm.apache.org/email/unsubscribe/2a1a924b33feb7671467ca05eb87152db33787e3ee53c70f5eda35d59846898b).

[Apache TVM Discuss] [Questions] Can we use TVM as JIT compiler?

Posted by Junru Shao via Apache TVM Discuss <no...@discuss.tvm.ai>.

I think we can somehow trim the TVM to remove graph runtime, vm, etc..However, if you want to use TVM as a JIT compiler, you have to ship with LLVM build, which is really large (>200MB IIRC)





---
[Visit Topic](https://discuss.tvm.apache.org/t/can-we-use-tvm-as-jit-compiler/8124/5) to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click here](https://discuss.tvm.apache.org/email/unsubscribe/4e852e0e9a6c6ec9c5f5425a884d64a2943f5f589381608a1030522b49495ee3).

[Apache TVM Discuss] [Questions] Can we use TVM as JIT compiler?

Posted by Giuseppe Rossini via Apache TVM Discuss <no...@discuss.tvm.ai>.

Hi @junrushao1994,

I was able to get something working at the end. It is actually very cool :) 

My next question is: since I am only using the tensor language (no graph runtime, no relay, no auto-tuner etc...) can we produce a libtvm.so that only includes TE/TIR? 

The problem is that libtvm.so is quite big (> 80MB) and I was wondering how much space we could save once we remove  things we don't use (for jitting at Tensor Language level). 

Of course I can always hack the `CMakeLists.txt`, but I was wondering if there was a canonical way of doing it. 

Thanks,

Giuseppe





---
[Visit Topic](https://discuss.tvm.apache.org/t/can-we-use-tvm-as-jit-compiler/8124/4) to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click here](https://discuss.tvm.apache.org/email/unsubscribe/c2d9590a5ef8d8bb4915b5c1cb3bdfb696ad57a70905c8b38b54b7119abdc615).

[Apache TVM Discuss] [Questions] Can we use TVM as JIT compiler?

Posted by Giuseppe Rossini via Apache TVM Discuss <no...@discuss.tvm.ai>.

Hi @junrushao1994,

Thanks for your reply! Can you point me to some examples? 

I am looking to integrate at operator level (and not at relay level). Is the snippet I wrote similar to a real implementation?

Thanks again





---
[Visit Topic](https://discuss.tvm.apache.org/t/can-we-use-tvm-as-jit-compiler/8124/3) to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click here](https://discuss.tvm.apache.org/email/unsubscribe/b0f98c01fd4b7614fcfe8991c4540d281c64f1edd73f446430fa0c0096eafa77).