From 9ff0d7e90f0faaa7c16017e6dcf9cf91c50a100e Mon Sep 17 00:00:00 2001 From: Sreeram Date: Fri, 23 Oct 2026 11:47:20 -0700 Subject: [PATCH] CUDA: fix build after chunked CUDA graphs (#30804) (#31053) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * CUDA: fix build after chunked CUDA graphs (#30804) * Apply suggestion from @JohannesGaessler Co-authored-by: Johannes Gäßler * Fix newlines in common.cuh --------- Co-authored-by: Johannes Gäßler --- ggml/src/ggml-cuda/common.cuh | 2 +- ggml/src/ggml-cuda/ggml-cuda.cu | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ggml/src/ggml-cuda/common.cuh b/ggml/src/ggml-cuda/common.cuh index 37d0d104c..6b36ca90b 100644 --- a/ggml/src/ggml-cuda/common.cuh +++ b/ggml/src/ggml-cuda/common.cuh @@ -1268,7 +1268,7 @@ struct ggml_cuda_graph { CUDA_CHECK(cudaGraphExecDestroy(instance)); } } - // the ggml graph is captured as a series of CUDA graphs, so the GPU can run one chunk while the next is enqueued + // the ggml graph is captured as a series of CUDA graphs, so the GPU can run one chunk while the next is enqueued std::vector instances; size_t num_nodes = 0; std::vector nodes; diff --git a/ggml/src/ggml-cuda/ggml-cuda.cu b/ggml/src/ggml-cuda/ggml-cuda.cu index ff9e9a7ea..454d17d78 100644 --- a/ggml/src/ggml-cuda/ggml-cuda.cu +++ b/ggml/src/ggml-cuda/ggml-cuda.cu @@ -496,7 +496,7 @@ struct ggml_cuda_pool_leg : public ggml_cuda_pool { #ifdef USE_CUDA_GRAPH int n_captured = 0; for (const auto & [key, graph] : ctx.cuda_graphs) { - n_captured += graph->instance != nullptr; + n_captured += graph->instances.size(); } if (n_captured > 0) { GGML_LOG_DEBUG(GGML_CUDA_NAME " pool[%d]: memory freed, %d captured CUDA graphs must be captured again\n", device, n_captured);