I am trying to understand what is the output of -dumpGraph option and what is it's relation to -dump-ir option. Unfortunately, I couldn't find a lot explanation in documentation regarding that.
Doing some basic testing I see that for the same model (in my case resnet50) running using image-classifier I see different number nodes and different nodes all together (for both -dumpGraph and -dump-ir).
Looking at source I can see -dumpGraph is called after ExecutionEngine compile is triggered, thus after lowering is done. And that would be more or less correct, because in CPU's dumpGraph I can see CPU specific nodes - CPUMaxSplat.
Can you please clarify a bit more how results of those two options should be understood and how they relate to each other.
Thanks!
Hi @sebap123, you are correct -- both -dumpGraph and -dump-ir operate after lowering, and also optimizations, are finished.
The difference is that -dumpGraph option simply dumps each layer of the graph at the Node level, including the type (element type and shape) of its inputs and outputs, its name (not necessarily matching the name of the nodes in the input graph as many were likely optimized/replaced), and its number of users.
Meanwhile, -dump-ir dumps the network after being IRGen'd into Instructions instead of Nodes and further optimized. This means it includes memory instructions (e.g. allocactivation) and related optimizations. It also shows how the instructions write to/read from each other, which -dumpGraph does not.
You may also be interested in the -dumpGraphDAG option, which dumps the graph at the Node level to a file, similar to -dumpGraph. However it does so in dot format, meaning you can visualize the graph using dot. This allows you to see the connections between Nodes in the graph, and can be very useful.
Would you be interested in adding a PR to improve our docs with this info/more?
@jfix71 thanks for clarification.
Yes, it would be helpful to have explanation in doc/help expanded by this. I'll do some PR shortly, that's a good suggestion.
Closing this for now, if someone wants to reopen and work on it feel free.
Most helpful comment
@jfix71 thanks for clarification.
Yes, it would be helpful to have explanation in doc/help expanded by this. I'll do some PR shortly, that's a good suggestion.