Skip to content

Commit 8729fce

Browse files
committed
ggml-cuda: fix bug w.r.t first stream launch
1 parent 788a6a2 commit 8729fce

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ggml/src/ggml-cuda/ggml-cuda.cu

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3153,6 +3153,7 @@ static void evaluate_and_capture_cuda_graph(ggml_backend_cuda_context * cuda_ctx
31533153
[[maybe_unused]] int prev_i = 0;
31543154

31553155
ggml_cuda_stream_context & stream_ctx = cuda_ctx->stream_context();
3156+
31563157
if (stream_ctx.concurrent_events.size() > 0) {
31573158
cgraph->nodes = const_cast<ggml_tensor **>(stream_ctx.original_graph.data());
31583159
}
@@ -3186,7 +3187,7 @@ static void evaluate_and_capture_cuda_graph(ggml_backend_cuda_context * cuda_ctx
31863187
if (stream_ctx.concurrent_events.find(prev_node) != stream_ctx.concurrent_events.end()) {
31873188
concurrent_event = &stream_ctx.concurrent_events[prev_node];
31883189

3189-
GGML_LOG_DEBUG("Launching %d streams at %s\n", concurrent_event->n_streams, node->name);
3190+
GGML_LOG_DEBUG("Launching %d streams at %s\n", concurrent_event->n_streams, prev_node->name);
31903191

31913192
cudaStream_t main_stream = cuda_ctx->stream(); // this should be stream 0
31923193
GGML_ASSERT(cuda_ctx->curr_stream_no == 0);
@@ -3198,6 +3199,8 @@ static void evaluate_and_capture_cuda_graph(ggml_backend_cuda_context * cuda_ctx
31983199
}
31993200

32003201
is_concurrent_event_active = true;
3202+
cuda_ctx->curr_stream_no = concurrent_event->stream_mapping[node];
3203+
GGML_LOG_DEBUG("Setting stream no to %d for node %s\n", cuda_ctx->curr_stream_no, node->name);
32013204
}
32023205
}
32033206
prev_i = i;

0 commit comments

Comments
 (0)