8000 [inductor][invoke_subgraph] Free the buffers before the subgraph call… · pytorch/pytorch@5236a85 · GitHub
[go: up one dir, main page]

Skip to content

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

torch/_inductor/codegen/wrapper.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2909,6 +2909,10 @@ def codegen_subgraph_call(self, subgraph, outer_inputs, outer_buffer_name):
29092909

29102910
self.writeline(f"{subgraph.graph.name}_args = [{outer_input_names}]")
29112911

2912+
# Since the buffers are already put into the args list, we can free the
2913+
# buffers here.
2914+
V.graph.scheduler.free_buffers()
2915+
29122916
# Call the subgraph launcher function
29132917
self.writeline(
29142918
f"{outer_buffer_name} = {subgraph.graph.name}({subgraph.graph.name}_args)"

0 commit comments

Comments
 (0)
0