Saving FusionGroup as part of ScriptModule


I am able to see the FusionGroup in the graph dump as part of optimization passes. But, I am not seeing that in the saved ScriptModule. How can I be able to save the last executed optimized graph (last_executed_optimized_graph, which includes FusionGroup) in the ScriptModule?

Thank you

The code for a ScriptModule is saved in its un-optimized form for a number of stability and performance related reasons. When it’s loaded, it gets re-compiled and re-optimized, so you don’t have to worry about the FusionGroup getting saved.

Thank you for the response @driazati . While I agree that re-compilation and re-optimization could be done during load time, not all optimizations are quick enough to do for every load. If there is an opportunity to save the optimized model (on the target hardware), we wont be incurring the optimization cost. Do you recommend or suggest ways in which we can achieve this?

Bumping this question up. Is it possible to save an optimized graph along with its fusiongroups/subgraphs in a scriptmodule?

This is not possible today but may be enabled in the future as we build out support for different backends (e.g. this PR to enable lowered graphs for consumption by backend passes)

@driazati: Awesome . Thanks a ton for this pointer. I will go through this PR. :slight_smile: