Skip to content

Commit

Permalink
fix : cuda order of synchronization when setting a buffer (ggml/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 <slarengh@gmail.com>
  • Loading branch information
2 people authored and ggerganov committed Jan 5, 2024
1 parent 0e26a6c commit 11b1b63
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion extra/sync-ggml.last
@@ -1 +1 @@
f96711108d55bdbbd277e6be07204dce6a94fb93
3eace58911ea8d2cf35defdc59848d99b91a57f5
2 changes: 1 addition & 1 deletion ggml-cuda.cu
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 11b1b63

Please sign in to comment.