From: Georgi Gerganov Date: Sat, 23 Dec 2023 16:05:29 +0000 (+0200) Subject: scripts : sync tests / headers X-Git-Tag: upstream/0.0.1642~1166 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=9944e595b14047f4bc0b67966e4405eb12e19880;p=pkg%2Fggml%2Fsources%2Fggml scripts : sync tests / headers --- diff --git a/scripts/sync-llama-am.sh b/scripts/sync-llama-am.sh index 8e41f857..3d8b08f8 100755 --- a/scripts/sync-llama-am.sh +++ b/scripts/sync-llama-am.sh @@ -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