File tree Expand file tree Collapse file tree 1 file changed +2
-1
lines changed
Expand file tree Collapse file tree 1 file changed +2
-1
lines changed Original file line number Diff line number Diff 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" );
You can’t perform that action at this time.
0 commit comments