]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
ggml : pad result of ggml_nbytes()
authorGeorgi Gerganov <redacted>
Mon, 7 Aug 2023 11:24:42 +0000 (14:24 +0300)
committerGeorgi Gerganov <redacted>
Mon, 7 Aug 2023 11:24:42 +0000 (14:24 +0300)
ggml.c

diff --git a/ggml.c b/ggml.c
index 9c4b49db86be9856945261f9c4965fb47fce7ac0..c97c2b63f346b409b0b8a5f4455bff78d7a92028 100644 (file)
--- a/ggml.c
+++ b/ggml.c
@@ -4110,7 +4110,7 @@ size_t ggml_nbytes(const struct ggml_tensor * tensor) {
     //
     // is enough, but just in case, adding the second part
 
-    return MAX(tensor->ne[3]*tensor->nb[3], (ggml_nelements(tensor)*GGML_TYPE_SIZE[tensor->type])/GGML_BLCK_SIZE[tensor->type]);
+    return GGML_PAD(MAX(tensor->ne[3]*tensor->nb[3], (ggml_nelements(tensor)*GGML_TYPE_SIZE[tensor->type])/GGML_BLCK_SIZE[tensor->type]), GGML_MEM_ALIGN);
 }
 
 size_t ggml_nbytes_split(const struct ggml_tensor * tensor, int nrows_split) {