]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
ggml : Check the right iface method before using the fallback 2d get (#23514)
authordskwe <redacted>
Sat, 23 May 2026 10:49:24 +0000 (18:49 +0800)
committerGitHub <redacted>
Sat, 23 May 2026 10:49:24 +0000 (12:49 +0200)
ggml/src/ggml-backend.cpp

index 5c0e5b1b9e2a59115bcbf8b996218814efd82eaf..87615921c09be5ef8c4996faa70fb3f49c385031 100644 (file)
@@ -306,7 +306,7 @@ void ggml_backend_tensor_get_2d_async(ggml_backend_t backend, const struct ggml_
     GGML_ASSERT(tensor);
     GGML_ASSERT(tensor->data != NULL && "tensor not allocated");
 
-    if (n_copies <= 1 || backend->iface.set_tensor_2d_async == NULL) {
+    if (n_copies <= 1 || backend->iface.get_tensor_2d_async == NULL) {
         for (size_t i = 0; i < n_copies; i++) {
             ggml_backend_tensor_get_async(backend, tensor, (char *) data + i*stride_data, offset + i*stride_tensor, size);
         }
@@ -317,7 +317,7 @@ void ggml_backend_tensor_get_2d_async(ggml_backend_t backend, const struct ggml_
     }
 
     GGML_ASSERT(tensor->data != NULL && "tensor not allocated");
-    GGML_ASSERT(offset + (n_copies-1)*stride_tensor + size <= ggml_nbytes(tensor) && "tensor write out of bounds");
+    GGML_ASSERT(offset + (n_copies-1)*stride_tensor + size <= ggml_nbytes(tensor) && "tensor read out of bounds");
     backend->iface.get_tensor_2d_async(backend, tensor, data, offset, size, n_copies, stride_tensor, stride_data);
 }