Skip to content

Commit 1f98549

Browse files
committed
Build fix for Linux and trivial typo fixes
Change-Id: Ic38b9a65bcf77de65fc18728071e608287a6d1b6 Signed-off-by: Anitha Raj <[email protected]>
1 parent eb6e267 commit 1f98549

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

kleidiai-examples/llama_cpp/0001-Use-KleidiAI-Int4-Matmul-micro-kernels-in-llama.cpp.patch

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ From: Gian Marco Iodice <[email protected]>
33
Date: Fri, 14 Jun 2024 14:55:47 +0100
44
Subject: [PATCH] Use KleidiAI Int4 Matmul micro-kernels in llama.cpp
55

6-
- Update CMake file to fetch the Int4 micro-kernels from the KleidiAI
6+
* Update CMake file to fetch the Int4 micro-kernels from the KleidiAI
77
repository
8-
- Implement a KleidiAI backend for llama.cpp
8+
* Implement a KleidiAI backend for llama.cpp
99

1010
Signed-off-by: Gian Marco Iodice <[email protected]>
1111
---
@@ -20,7 +20,7 @@ Signed-off-by: Gian Marco Iodice <[email protected]>
2020
create mode 100644 ggml-kleidiai.h
2121

2222
diff --git a/CMakeLists.txt b/CMakeLists.txt
23-
index 08481334..5c0458e9 100644
23+
index 08481334..99382573 100644
2424
--- a/CMakeLists.txt
2525
+++ b/CMakeLists.txt
2626
@@ -548,6 +548,53 @@ if (LLAMA_VULKAN)
@@ -31,9 +31,9 @@ index 08481334..5c0458e9 100644
3131
+
3232
+ # Fetch KleidiAI sources:
3333
+ include(FetchContent)
34-
+ set(KLEIDIAI_COMMIT_SHA "b0911c80b35e41dc9c22075a63e83c217fd0a106")
34+
+ set(KLEIDIAI_COMMIT_SHA "d6c3b987e445e5e1daeda94e3c2888efaa07ca50")
3535
+ set(KLEIDIAI_DOWNLOAD_URL "https://gitlab.arm.com/kleidi/kleidiai/-/archive/${KLEIDIAI_COMMIT_SHA}/kleidiai-${KLEIDIAI_COMMIT_SHA}.tar.gz")
36-
+ set(KLEIDIAI_ARCHIVE_MD5 "8b54226586eb18957c374a6d1434f4f2")
36+
+ set(KLEIDIAI_ARCHIVE_MD5 "8e94e73bfa00ea038fd6e3d13f59080f")
3737
+
3838
+ if (POLICY CMP0135)
3939
+ cmake_policy(SET CMP0135 NEW)
@@ -86,7 +86,7 @@ index 08481334..5c0458e9 100644
8686

8787
target_include_directories(ggml PUBLIC . ${LLAMA_EXTRA_INCLUDES})
8888
diff --git a/ggml-alloc.c b/ggml-alloc.c
89-
index bd367c42..ac099392 100644
89+
index bd367c42..ed4ce0ae 100644
9090
--- a/ggml-alloc.c
9191
+++ b/ggml-alloc.c
9292
@@ -9,6 +9,10 @@
@@ -105,12 +105,12 @@ index bd367c42..ac099392 100644
105105
if (t->data == NULL && t->view_src == NULL) {
106106
this_size = GGML_PAD(ggml_backend_buft_get_alloc_size(buft, t), alignment);
107107
+#if defined(GGML_USE_KLEIDIAI)
108-
+ // Temporary solution to allocate more memore if needed for packing the weights.
108+
+ // Temporary solution to allocate more memory if needed for packing the weights.
109109
+ // This method is not sufficient as we assume that the weights are for matmul only.
110110
+ // However, weights could belong to other operations
111-
+ const int64_t iai_diff = (ggml_kai_get_const_workspace_size_matmul(t) - this_size);
112-
+ if (iai_diff > 0) {
113-
+ this_size += iai_diff;
111+
+ const int64_t kai_diff = (ggml_kai_get_const_workspace_size_matmul(t) - this_size);
112+
+ if (kai_diff > 0) {
113+
+ this_size += kai_diff;
114114
+ }
115115
+#endif
116116
}

0 commit comments

Comments
 (0)