vllm.compilation.passes.utility.fix_functionalization
¶
Classes:
-
FixFunctionalizationPass–This pass defunctionalizes certain nodes to avoid redundant tensor copies.
FixFunctionalizationPass
¶
Bases: VllmInductorPass
This pass defunctionalizes certain nodes to avoid redundant tensor copies. After this pass, DCE (dead-code elimination) should never be run, as de-functionalized nodes may appear as dead code.
To add new nodes to defunctionalize, add to the if-elif chain in call.
Methods:
-
defunctionalize–De-functionalize a node by replacing it with a call to the original.
-
getitem_users–Returns the operator.getitem users of the auto-functionalized node,
-
insert_defunctionalized–Insert a new defunctionalized node into the graph before node.
-
replace_users_with_mutated_args–Replace mutated getitem users of the auto-functionalized node with the
_remove(node_or_nodes)
¶
Stage a node (or nodes) for removal at the end of the pass.
defunctionalize(graph, node, mutated_args, args=None)
¶
De-functionalize a node by replacing it with a call to the original. It also replaces the getitem users with the mutated arguments. See replace_users_with_mutated_args and insert_defunctionalized.
getitem_users(node)
¶
Returns the operator.getitem users of the auto-functionalized node, indexed by the index they are getting.
insert_defunctionalized(graph, node, args=None)
¶
Insert a new defunctionalized node into the graph before node. If one of the kwargs is 'out', provide args directly, as node.kwargs cannot be used. See https://github.com/pytorch/pytorch/blob/a00faf440888ffb724bad413f329a49e2b6388e7/torch/_inductor/lowering.py#L351
Parameters: