From c79c66bdf39d4fd79a7f0a729d19d54bbdb59aad Mon Sep 17 00:00:00 2001 From: Cebtenzzre Date: Thu, 3 Aug 2023 15:04:24 -0400 Subject: [PATCH] CUDA: check if event is NULL before cudaStreamWaitEvent Fixes #2503 --- ggml-cuda.cu | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ggml-cuda.cu b/ggml-cuda.cu index e0192bc6e..4321e4674 100644 --- a/ggml-cuda.cu +++ b/ggml-cuda.cu @@ -5203,7 +5203,7 @@ static void ggml_cuda_op(const ggml_tensor * src0, const ggml_tensor * src1, ggm if (split && g_device_count > 1) { CUDA_CHECK(cudaSetDevice(g_main_device)); for (int id = 0; id < g_device_count; ++id) { - if (id != g_main_device) { + if (id != g_main_device && src0_extra->events[id]) { CUDA_CHECK(cudaStreamWaitEvent(g_cudaStreams_main[g_main_device], src0_extra->events[id])); } }