Skip to content

Commit 70ffed6

Browse files
CUDA: fix scratch malloced on non-main device
1 parent b541b4f commit 70ffed6

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

ggml-cuda.cu

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6969,6 +6969,9 @@ void ggml_cuda_assign_scratch_offset(struct ggml_tensor * tensor, size_t offset)
69696969
if (g_scratch_size == 0) {
69706970
return;
69716971
}
6972+
6973+
ggml_cuda_set_device(g_main_device);
6974+
69726975
if (g_scratch_buffer == nullptr) {
69736976
CUDA_CHECK(cudaMalloc(&g_scratch_buffer, g_scratch_size));
69746977
}

0 commit comments

Comments
 (0)