Skip to content

vllm.compilation.passes.ir.clone_elimination

Classes:

Functions:

UnsafeCloneEliminationPass

Bases: VllmInductorPass

This pass removes clone nodes that are no longer needed after vLLM IR lowering. It uses donated_input_ids to eliminate clones of donated graph inputs, preserving contents of non-donated graph inputs.

It is "unsafe" because it only handles aliasing of graph outputs. Solving aliasing is an open problem, so this pass intends to support known vLLM cases and not guarantee soundness on general graphs. In the future, this pass will likely support basic forms of aliasing to handle simple views (e.g. qkv -> q,k,v).

would_alias_graph_io(clone, original)

Whether replacing clone with original makes a graph output share storage with a graph input or another output, which callers may mutate in place. Unknown storage is treated as aliasing.