From b18f658a7d3d8cecd2c3cdb2a14a805a3177481f Mon Sep 17 00:00:00 2001 From: Kawrakow Date: Fri, 5 Dec 2025 15:40:48 +0000 Subject: [PATCH] CUDA: set current device in compute_forward --- ggml/src/ggml-cuda.cu | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ggml/src/ggml-cuda.cu b/ggml/src/ggml-cuda.cu index bab1d226..b2dd62fc 100644 --- a/ggml/src/ggml-cuda.cu +++ b/ggml/src/ggml-cuda.cu @@ -2950,6 +2950,13 @@ static bool ggml_cuda_compute_forward(ggml_backend_cuda_context & ctx, struct gg int64_t tim1 = ggml_time_us(); #endif + if (ggml_is_noop(dst)) { + return true; + } + + // In case we forget to do that in some kernel. + ggml_cuda_set_device(ctx.device); + auto next = i < cgraph->n_nodes - 1 ? cgraph->nodes[i+1] : nullptr; auto fusion = ctx.fusion;