Skip to content

Commit 3b1a8e5

Browse files
committed
Update CUDAGraph.cpp
1 parent 4eab1a6 commit 3b1a8e5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

aten/src/ATen/cuda/CUDAGraph.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ void CUDAGraph::capture_end() {
188188
AT_CUDA_CHECK(cudaGraphDestroy(graph_));
189189
has_graph_ = false;
190190
} else {
191-
TORCH_WARN("DEBUG: TORCH_CUDAGRAPHS_DEBUG_PATH detected. graph_ will not be freed");
191+
TORCH_WARN("DEBUG: TORCH_CUDAGRAPHS_DEBUG_PATH detected. graph_ will not be freed until debug_dump is called.");
192192
}
193193
#else
194194
TORCH_CHECK(false, "CUDA graphs may only be used in Pytorch built with CUDA >= 11.0 and is not yet supported on ROCM");
@@ -246,6 +246,7 @@ void CUDAGraph::debug_dump(const std::string& debug_path) {
246246
if (has_graph_) {
247247
TORCH_WARN("DEBUG: calling cudaGraphDebugDotPrint() with ", debug_path);
248248
C10_CUDA_CHECK_WARN(cudaGraphDebugDotPrint(graph_, debug_path.c_str(), 1<<10)); // most verbose output
249+
AT_CUDA_CHECK(cudaGraphDestroy(graph_));
249250
}
250251
} else {
251252
TORCH_WARN("CUDA Graphs debug not enabled, set with torch._C._cuda_enable_graphs_debug_mode");

0 commit comments

Comments
 (0)