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

2021-08-16 Thread Junru Shao via Apache TVM Discuss
IIRC we made some immutability assumptions here that the passes won't modify the original `IRModule`. We did find some bugs in the codebase previously the module is incorrectly modified though :-( --- [Visit Topic](https://discuss.tvm.apache.org/t/how-to-efficiently-copy-an-ir/10798/5) t

[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 Junru Shao via Apache TVM Discuss
In terms of deep copy, the most efficient way is SaveJSON and LoadJSON >_< --- [Visit Topic](https://discuss.tvm.apache.org/t/how-to-efficiently-copy-an-ir/10798/2) to respond. You are receiving this because you enabled mailing list mode. To unsubscribe from these emails, [click here](h

[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)