Skip to content

Commit b90dc56

Browse files
authored
Allow number of nodes in CUDA graph to change (#7738)
Previously the code would have failed to cope in the case that the number of nodes changes in an existing CUDA graph. This fixes the issue by removing an unnecessary conditional.
1 parent 1442677 commit b90dc56

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

ggml-cuda.cu

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2702,10 +2702,8 @@ GGML_CALL static enum ggml_status ggml_backend_cuda_graph_compute(ggml_backend_t
27022702

27032703
if (cuda_graph_update_required) {
27042704
// Extract nodes from graph
2705-
if (cuda_ctx->cuda_graph->num_nodes == 0) {
2706-
// First call with null argument gets number of nodes in graph
2707-
CUDA_CHECK(cudaGraphGetNodes(cuda_ctx->cuda_graph->graph, nullptr, &cuda_ctx->cuda_graph->num_nodes));
2708-
}
2705+
// First call with null argument gets number of nodes in graph
2706+
CUDA_CHECK(cudaGraphGetNodes(cuda_ctx->cuda_graph->graph, nullptr, &cuda_ctx->cuda_graph->num_nodes));
27092707
// Subsequent call with non-null argument gets nodes
27102708
cuda_ctx->cuda_graph->nodes.resize(cuda_ctx->cuda_graph->num_nodes);
27112709
cuda_ctx->cuda_graph->params.resize(cuda_ctx->cuda_graph->num_nodes);

0 commit comments

Comments
 (0)