Skip to content

Commit a3737f4

Browse files
ikawrakowIwan Kawrakow
andauthored
CUDA: set current device in compute_forward (#1039)
Co-authored-by: Iwan Kawrakow <iwan.kawrakow@gmail.com>
1 parent e741ec8 commit a3737f4

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

ggml/src/ggml-cuda.cu

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2950,6 +2950,13 @@ static bool ggml_cuda_compute_forward(ggml_backend_cuda_context & ctx, struct gg
29502950
int64_t tim1 = ggml_time_us();
29512951
#endif
29522952

2953+
if (ggml_is_noop(dst)) {
2954+
return true;
2955+
}
2956+
2957+
// In case we forget to do that in some kernel.
2958+
ggml_cuda_set_device(ctx.device);
2959+
29532960
auto next = i < cgraph->n_nodes - 1 ? cgraph->nodes[i+1] : nullptr;
29542961

29552962
auto fusion = ctx.fusion;

0 commit comments

Comments
 (0)