[fix][torch.compile] Fix cold-start compilation time increase by adding kv cache update to splitting ops (#33441)

Signed-off-by: Luka Govedič <lgovedic@redhat.com>
Co-authored-by: Richard Zou <zou3519@gmail.com>
This commit is contained in:
Luka Govedič
2026-01-31 06:48:34 -08:00
committed by GitHub
co-authored by Richard Zou
parent 793af538a3
commit 15f40b20aa
4 changed files with 127 additions and 1 deletions
+8 -1
View File
@@ -359,7 +359,14 @@ def split_graph(
subgraph_id += 1
node_to_subgraph_id[node] = subgraph_id
split_op_graphs.append(subgraph_id)
subgraph_id += 1
# keep consecutive splitting ops together
# (we know node.next exists because node isn't the last (output) node)
if should_split(node.next, splitting_ops):
# this will get incremented by the next node
subgraph_id -= 1
else:
subgraph_id += 1
else:
node_to_subgraph_id[node] = subgraph_id
+9
View File
@@ -943,6 +943,15 @@ class CompilationConfig:
# for details. Make a copy to avoid mutating the class-level
# list via reference.
self.splitting_ops = list(self._attention_ops)
# unified_kv_cache_update has a string param that prevents Inductor
# from reusing piecewise graphs. Remove it from the compiled graph.
# This has the side-effect of excluding cache from cudagraphs but
# that doesn't seem to affect performance.
# https://github.com/vllm-project/vllm/issues/33267
if not self.use_inductor_graph_partition:
self.splitting_ops.append("vllm::unified_kv_cache_update")
elif len(self.splitting_ops) == 0:
if (
self.cudagraph_mode == CUDAGraphMode.PIECEWISE