ok, my use case is to translate Torchscript IR to TVM 1 compiler’s IR. I have a repo https://github.com/masahi/torchscript-to-tvm 9 which demonstrates translating torch models to TVM, compile and run it under TVM and get the identical output as torch.
Right now I take the output of torch.jit.trace(...) which has shape information attached, and for each torch operator node I translate it to corresponding one in TVM. Since TVM is mostly a static compiler, shape information is required.
TVM has its own set of optimization passes, so it is no problem to take the unoptimized input torch IR. Currently I’m applying the Torchscript inlining pass to remove prim::CallMethod wrapping,  but it seems rather ad hoc to me and I rather want to apply other optimization passes in torch as well.
I know I can apply each optimization passes manually (and I do for the inline pass), but the API prefix torch._C._jit_pass* suggests they are not “officially” supported, so I’m not sure if I want to use them directly. Since I discovered that I can access the optimized graph via graph_for(...) method, I’m looking to see if this is something I can use.
I disabled the profiling executor because it adds prim::Bailout and prim::BailoutTemplate nodes for which I have no idea how to translate to TVM. Since input shape is static in TVM, I think they are not relevant to my use case, so I don’t want to see them in the input IR.