Print out schedule for debugging

Does anyone know how to dump out the schedule graph? I’d imagine it would be quite useful. If none exists today, what’s your experience/tricks/tips of debugging the schedule?

Perhaps try printing the IR using

print(tvm.lower(s, inputs, simple_mode=True))

like in the tutorial, but you’ll have to modify the code to simple print the IR of each graph operator in Relay/NNVM, I think.

Hi Nick, thanks for your suggestion.

tvm.lower() is useful and I am using it. In many cases I find the output of the first pass is more helpful than the final result (see Show unflattened tensor in tvm.lower()).

I still would like to see the schedule itself rather than the scheduled program. Does anyone else have the same need? I could try to create such a dumping function. But it seems the community has done well without such a tool. I am curious whether I am missing something in my debugging process.

What exactly do you mean by “the schedule”?

  1. A graphical representation of the operator nodes and tensor shapes?
    I have thought about needing this especially to see the fused operators. Printing the IR in this case is doable but sometimes I feel a simple graph diagram (Networkx python package?) would be more straightforward.

  2. The HW independent schedule?
    So this is what I would call “vanilla” c code and is mostly equivalent to printing the IR after phase 0 (or even better just after. I think to some extent this could be implemented by a different level of the simple_modeparameter of the tvm.lower() function

  1. The scheduling operations defined in the scheduling rules?
    I think this would also be interesting to enable people to not have to read the source code, but I have no idea how this would be nicely represented.
1 Like

I meant 3. I’d also like to see a combined view with 3 on the left and 1 on the right :slight_smile:

(page 79 of https://people.csail.mit.edu/jrk/jrkthesis.pdf)

1 Like

This would be brilliant.

Is it possible now to get the above “schedule” representation?

There exists something like TEDD But it is not as finegrained as in @YuanLin 's answer.

You can always use tvm.lower(schedule,[input_placeholders], simple_mode=True), to get the “for loop view” though

@JosseVanDelm Thanks. I was reading about it, and it might be helpful. I will update here if I find something more detailed.