Skip to content

Commit

Permalink
fix : cuda order of synchronization when setting a buffer (#679)
Browse files Browse the repository at this point in the history
* fix : cuda order of synchronization when setting a buffer

* also sync before memcpy

---------

Co-authored-by: slaren <[email protected]>
  • Loading branch information
Green-Sky and slaren authored Jan 5, 2024
1 parent f967111 commit 3eace58
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/ggml-cuda.cu
Original file line number Diff line number Diff line change
Expand Up @@ -9689,8 +9689,8 @@ static void ggml_backend_cuda_buffer_set_tensor(ggml_backend_buffer_t buffer, gg

ggml_cuda_set_device(ctx->device);
CUDA_CHECK(cudaDeviceSynchronize());

CUDA_CHECK(cudaMemcpy((char *)tensor->data + offset, data, size, cudaMemcpyHostToDevice));
CUDA_CHECK(cudaDeviceSynchronize());
}

static void ggml_backend_cuda_buffer_get_tensor(ggml_backend_buffer_t buffer, const ggml_tensor * tensor, void * data, size_t offset, size_t size) {
Expand Down

0 comments on commit 3eace58

Please sign in to comment.