Skip to content

vllm.compilation.post_cleanup

PostCleanupPass

Bases: VllmInductorPass

This pass performs cleanup after custom passes. It topologically sorts the graph and removes unused nodes. This is needed because the pattern matcher does not guarantee producing a topologically sorted graph, and there may be unused nodes left around.

Source code in vllm/compilation/post_cleanup.py
class PostCleanupPass(VllmInductorPass):
    """
    This pass performs cleanup after custom passes.
    It topologically sorts the graph and removes unused nodes.
    This is needed because the pattern matcher does not guarantee producing
    a topologically sorted graph, and there may be unused nodes left around.
    """

    @VllmInductorPass.time_and_log
    def __call__(self, graph: fx.Graph) -> None:
        from torch._inductor.pattern_matcher import stable_topological_sort
        stable_topological_sort(graph)
        graph.eliminate_dead_code()

__call__

__call__(graph: Graph) -> None
Source code in vllm/compilation/post_cleanup.py
@VllmInductorPass.time_and_log
def __call__(self, graph: fx.Graph) -> None:
    from torch._inductor.pattern_matcher import stable_topological_sort
    stable_topological_sort(graph)
    graph.eliminate_dead_code()