[Relay] Sub-functions printed in reverse order

This issue is introduced by https://github.com/dmlc/tvm/pull/2605

It is useful to print relay ir after passes for debug. Adding print(ir_pass.pass_debug_print(func, show_meta_data=False)) after ir_pass.fuse_ops in relay.build_module, sub-functions are printted in reverse order which are diffucult to read.
Also, the place that subfunctions are shown seems strange. Previously subfunctions are printed before the first time they are called. The current way is to print several subfunctions and then call each of them, is this intended?

Here are the result of inception_v3: https://pastebin.com/L5fugT2x

@joshpoll

you should most likely still want to use astext as opposed to the debug print… the function order seems to be an issue

Thanks for bringing this up @vinx13. I’ll look into it today.

Could you provide a minimal working example so I can repro?

See https://github.com/dmlc/tvm/pull/2882.