[Apache TVM Discuss] [Development/pre-RFC] Export TIR to json

2022-03-25 Thread Sebastian Boblest Etas via Apache TVM Discuss
1. You are right, we actually tried to save the runtime.Module. We actually also added the TIR export to the runtime.Module because the generated source code is also put to it. We will try the different options you proposed as soon as we can find the time. 2. In the meantime we have written an

[Apache TVM Discuss] [Development/pre-RFC] Export TIR to json

2022-03-17 Thread Andrew Reusch via Apache TVM Discuss
@SebastianBoblestETAS I think this could be helpful for folks consuming TIR outside of TVM itself. A couple of thoughts: 1. Right now a related problem is that there isn't currently a way for `tvm.relay.build` to return the `IRModule`s which contain TIR itself. You can see that in the [BuildO

[Apache TVM Discuss] [Development/pre-RFC] Export TIR to json

2022-03-16 Thread tqchen via Apache TVM Discuss
runtime.Module itself is a runtime object, which does not yet support full serialization(due to the nature of some module not being able to serialize(e.g. DSO)). There was a discussion about [Artifact class](https://discuss.tvm.apache.org/t/introduce-artifact-a-container-for-generated-code/11

[Apache TVM Discuss] [Development/pre-RFC] Export TIR to json

2022-03-16 Thread Sebastian Boblest Etas via Apache TVM Discuss
Hi, thanks for the reference to this function. I was not aware of it. However I tried it on a Module(c) and got this: `{ "root": 1, "nodes": [ { "type_key": "" }, { "type_key": "runtime.Module" } ], "b64ndarrays": [], "attrs": {"tvm_version": "0.9.dev0"

[Apache TVM Discuss] [Development/pre-RFC] Export TIR to json

2022-03-16 Thread tqchen via Apache TVM Discuss
Thanks @SebastianBoblestETAS . TVM already have a reflection based mechanism to serialize IR nodes (includin TIR and other functions) as [json format](https://tvm.apache.org/docs/reference/api/python/ir.html?highlight=save_json#tvm.ir.save_json). So it would be great to see if that functional

[Apache TVM Discuss] [Development/pre-RFC] Export TIR to json

2022-03-16 Thread Siyuan Feng via Apache TVM Discuss
Thanks, @SebastianBoblestETAS. I agree that json is a great format for serializing, but I have a few questions: 1. What are the pros and cons of json format compared with TVMScript (if we have python env) 2. How to design a json format to store all TIR information for all possible nodes? Do

[Apache TVM Discuss] [Development/pre-RFC] Export TIR to json

2022-03-16 Thread Sebastian Boblest Etas via Apache TVM Discuss
We propose to implement an API to TVM that allows users to export the TIR representation of the generated kernels as json. **Motivation** Json is a standard file format and can easily be processed in python, for example. A json interface allows to analyze the generated kernels target agnos