]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
sycl: remove redundant memcopy in function ggml_backend_sycl_buffer_set_tensor (...
authorzhouwg <redacted>
Mon, 7 Apr 2025 15:22:57 +0000 (23:22 +0800)
committerGitHub <redacted>
Mon, 7 Apr 2025 15:22:57 +0000 (17:22 +0200)
ggml/src/ggml-sycl/ggml-sycl.cpp

index dff9f8d4c4ac27c28c2a4b94dc8f2c02e38fd70e..f6f288d99063915abb79e5b0c431e09da0b63cb8 100644 (file)
@@ -372,12 +372,9 @@ static void ggml_backend_sycl_buffer_set_tensor(ggml_backend_buffer_t buffer,
     auto stream = &(dpct::dev_mgr::instance().get_device(ctx->device).default_queue());
     SYCL_CHECK(
         CHECK_TRY_ERROR(dpct::dev_mgr::instance().get_device(ctx->device).queues_wait_and_throw()));
-    char* host_buf = (char*)malloc(size);
-    memcpy(host_buf, data, size);
     SYCL_CHECK(
-        CHECK_TRY_ERROR((*stream).memcpy((char *)tensor->data + offset, host_buf, size)
+        CHECK_TRY_ERROR((*stream).memcpy((char *)tensor->data + offset, data, size)
                              .wait()));
-    free(host_buf);
 }
 catch (sycl::exception const &exc) {
   std::cerr << exc.what() << "Exception caught at file:" << __FILE__