hetorch.passes.builtin.visualization
GraphVisualizationPass: Export graph to SVG for visualization
Classes
GraphVisualizationPass(output_dir: typing.Optional[str], name_prefix: <class 'str'>, auto_open: <class 'bool'>)
Export graph to SVG format for visualization
This pass uses torch.fx.passes.graph_drawer to create an SVG visualization of the computation graph. Useful for debugging and understanding graph transformations.
Attributes: output_dir: Directory to save SVG files (default: ./graph_exports) name_prefix: Prefix for generated SVG filenames auto_open: Whether to automatically open the SVG file (default: False)
Methods:
__init__(self, output_dir: Optional[str] = None, name_prefix: str = 'hetorch_graph', auto_open: bool = False)
Initialize GraphVisualizationPass
Args: output_dir: Directory to save SVG files (None = ./graph_exports) name_prefix: Prefix for generated SVG filenames auto_open: Whether to automatically open the SVG file
analyze_cost(self, graph_module: torch.fx.graph_module.GraphModule, context: hetorch.compiler.context.CompilationContext) -\> hetorch.backend.cost_model.CostAnalysis
Analyze cost impact of this pass
Args: graph_module: Graph module to analyze context: Compilation context
Returns: Cost analysis result
transform(self, graph_module: torch.fx.graph_module.GraphModule, context: hetorch.compiler.context.CompilationContext) -\> torch.fx.graph_module.GraphModule
Export graph to SVG and return unchanged
Args: graph_module: Input graph module context: Compilation context
Returns: Unchanged graph module
validate(self, graph_module: torch.fx.graph_module.GraphModule, context: hetorch.compiler.context.CompilationContext) -\> bool
Validate preconditions for this pass
Args: graph_module: Graph module to validate context: Compilation context
Returns: True if validation passes, False otherwise
Raises: PassValidationError: If validation fails with detailed message