vllm.compilation.passes.ir.clone_elimination
¶
Classes:
-
UnsafeCloneEliminationPass–This pass removes clone nodes that are no longer needed after vLLM IR lowering.
Functions:
-
would_alias_graph_io–Whether replacing clone with original makes a graph output share storage
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).
Source code in vllm/compilation/passes/ir/clone_elimination.py
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | |
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.