]> git.djapps.eu Git - pkg/ggml/sources/ggml/commitdiff
scripts : sync tests / headers
authorGeorgi Gerganov <redacted>
Sat, 23 Dec 2023 16:05:29 +0000 (18:05 +0200)
committerGeorgi Gerganov <redacted>
Sat, 23 Dec 2023 16:18:07 +0000 (18:18 +0200)
scripts/sync-llama-am.sh

index 8e41f857004cae25f3de773d4409b6c6ba21ecb9..3d8b08f81c030503cf666b5e0c3998b5316ae17d 100755 (executable)
@@ -27,25 +27,58 @@ echo "Syncing llama.cpp changes since commit $lc"
 cd $SRC_LLAMA
 
 git log --oneline $lc..HEAD
-git format-patch $lc --stdout -- ggml* > $SRC_GGML/llama-am.patch
+
+git format-patch $lc --stdout -- \
+    ggml*.c \
+    ggml*.cpp \
+    ggml*.m \
+    ggml*.metal \
+    ggml*.cu \
+    tests/tests-opt.cpp \
+    tests/tests-grad0.cpp \
+    tests/tests-backend-ops.cpp \
+    > $SRC_GGML/llama-src.patch
+
+git format-patch $lc --stdout -- \
+    ggml*.h \
+    > $SRC_GGML/llama-inc.patch
+
+# delete files if empty
+if [ ! -s $SRC_GGML/llama-src.patch ]; then
+    rm -v $SRC_GGML/llama-src.patch
+fi
+
+if [ ! -s $SRC_GGML/llama-inc.patch ]; then
+    rm -v $SRC_GGML/llama-inc.patch
+fi
 
 cd $SRC_GGML
 
-# replace PR numbers
-# Subject: some text (#1234)
-# Subject: some text (llama/1234)
-cat llama-am.patch | sed -e 's/^Subject: \(.*\) (#\([0-9]*\))/Subject: \1 (llama\/\2)/' > llama-am.patch.tmp
-mv llama-am.patch.tmp llama-am.patch
+if [ -f $SRC_GGML/llama-src.patch ]; then
+    # replace PR numbers
+    # Subject: some text (#1234)
+    # Subject: some text (llama/1234)
+    cat llama-src.patch | sed -e 's/^Subject: \(.*\) (#\([0-9]*\))/Subject: \1 (llama\/\2)/' > llama-src.patch.tmp
+    mv llama-src.patch.tmp llama-src.patch
+
+    git am -p1 --directory src llama-src.patch
 
-git am -p1 --directory src llama-am.patch
+    rm -v $SRC_GGML/llama-src.patch
+fi
+
+if [ -f $SRC_GGML/llama-inc.patch ]; then
+    cat llama-inc.patch | sed -e 's/^Subject: \(.*\) (#\([0-9]*\))/Subject: \1 (llama\/\2)/' > llama-inc.patch.tmp
+    mv llama-inc.patch.tmp llama-inc.patch
+
+    git am -p1 --directory include/ggml llama-inc.patch
+
+    rm -v $SRC_GGML/llama-inc.patch
+fi
 
 # update last commit
-cd ../llama.cpp
+cd $SRC_LLAMA
 git log -1 --format=%H > $SRC_GGML/scripts/sync-llama.last
 
-# clean up
-rm -v $SRC_GGML/llama-am.patch
-
 echo "Done"
 
 exit 0