[RFC] Visualizing Relay program as graph

+1. I take that back. +1000. Inspectability of the compilation process, including visualization of the IRs, is super important and this is a great step in that direction.

Graphviz is great because it is widely available, many people know it and it produces an image file that it is trivial to open on any machine from a link, though also Graphviz is not so great at very large graphs. One way to handle that is to have an option to display a radius around a node (as in slides below) or to have the option to use a different library as well in case of large graphs, e.g. TensorBoard. I don’t know if Netron is good for large graphs, maybe it is? No need for us to address any of that initially, having this is a great advance, though it would be good if the API is written in a way so that it is natural to add more things later.

(There are some style details that can be worked out later/over time, e.g. it would be nice if every op would say what shape/type it produces, rectangular nodes are more economical of space, multiple operands implies a need to distinguish incoming edges and color coding of ops can be useful for larger examples. Slide 13-15 might offer some inspiration: https://drive.google.com/file/d/1AfNoznbCIejQLErblXF7CV_Wk4cJypuC/view Though this is great as-is!)

4 Likes