[Apache TVM Discuss] [Questions] How params are converted and stored in lib.get_params()

2022-03-24 Thread Jiawei Liu via Apache TVM Discuss
@Lyken17 I think your code is passing the function (mod['main']) instead of the module (mod) to `relay.optimize`, though the arguments will still be binded if you use module (https://github.com/apache/tvm/blob/main/python/tvm/relay/build_module.py#L188). Using: ```python import tvm import tv

[Apache TVM Discuss] [Questions] Tvm.device and tvm.target, What are they effects?

2022-03-24 Thread Jiawei Liu via Apache TVM Discuss
I think generally **device** is **hardware (primitives)**. **(codegen) target** is **software** that drives the **deivice**. examples of dev v.s. target: - NVIDIA GPU ~ CUDA (=> NVPTX) - AMD GPU ~ ROCm - CPU ~ OPENCL/C/C++ (compiler) - PhD students ~ advisors But if you look at https://tvm.ap

[Apache TVM Discuss] [Questions] How params are converted and stored in lib.get_params()

2022-03-24 Thread Jiawei Liu via Apache TVM Discuss
This is because `relay.build` optimizes the constants through constant folding. That said, those constants you marked have been folded and simplified. Actually, it is simplified in the `bind_params_by_name` function in `relay.build`. And if you print the output module of that you see: ``` de

[Apache TVM Discuss] [Questions] How to efficiently copy an IR

2021-08-16 Thread Jiawei Liu via Apache TVM Discuss
This case seems to occur when we apply the basic block form pass. Other passes, e.g., `FuseOps` will not result in such results. So I am wondering if it is expected to modify the input argument (old module) by some passes. --- [Visit Topic](https://discuss.tvm.apache.org/t/how-to-efficien

[Apache TVM Discuss] [Questions] How to efficiently copy an IR

2021-08-16 Thread Jiawei Liu via Apache TVM Discuss
@junrushao1994 Thank you Junru! It did become faster! ![image|690x98](upload://47qAvirVT5ML7lD4zlOheGXxLA8.png) Another related question is: will passes alter the original module (i mean if `mod` will be modified after applying `new_mod = pass(mod)`). It seems this is the case and I have to

[Apache TVM Discuss] [Questions] How to efficiently copy an IR

2021-08-15 Thread Jiawei Liu via Apache TVM Discuss
Hi all, I wonder how to copy an IR in tvm: What I tried: 1. `deepcopy`: not working. will produce error for some IR. 2. `astext` + `fromtext`: will work but kinda slow (2s for big models). Thanks! --- [Visit Topic](https://discuss.tvm.apache.org/t/how-to-efficiently-copy-an-ir/10798/1)

[Apache TVM Discuss] [Questions] Questions about TVM executors and its APIs

2021-06-21 Thread Jiawei Liu via Apache TVM Discuss
Another thing is that I am still confused about the executors... There are "graph", "debug" (interpreter), "vm", "aot" ... Some executor cannot support dynamic shapes (i.e., graph). The default optimization passes of them are not the same. I think any instructions on which one should users p

[Apache TVM Discuss] [Questions] Questions about TVM executors and its APIs

2021-06-21 Thread Jiawei Liu via Apache TVM Discuss
Hi @yuchenj, thank you for your kind reply! I want to confirm some follow-up questions and report some issues. It seems in your mentioned line (`Optimize` function, `build_module.cc:303`), a set of (default I think) passes are given. Is that the case: in `BuildRelay` we will collect some **de