Skip to content

Commit c46e397

Browse files
committed
ci: add ARM64 Kleidiai build and test support
1 parent 4e0388a commit c46e397

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed

.github/workflows/build.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1497,3 +1497,29 @@ jobs:
14971497
run: |
14981498
vulkaninfo --summary
14991499
GG_BUILD_VULKAN=1 bash ./ci/run.sh ~/results/llama.cpp ~/mnt/llama.cpp
1500+
1501+
ggml-ci-arm64-cpu-kleidiai:
1502+
runs-on: ubuntu-22.04-arm
1503+
1504+
steps:
1505+
- name: Clone
1506+
id: checkout
1507+
uses: actions/checkout@v4
1508+
1509+
- name: ccache
1510+
uses: ggml-org/[email protected]
1511+
with:
1512+
key: ggml-ci-arm64-cpu-kleidiai
1513+
evict-old-files: 1d
1514+
1515+
- name: Dependencies
1516+
id: depends
1517+
run: |
1518+
sudo apt-get update
1519+
sudo apt-get install -y build-essential libcurl4-openssl-dev
1520+
1521+
- name: Test
1522+
id: ggml-ci
1523+
run: |
1524+
GG_BUILD_KLEIDIAI=1 GG_BUILD_EXTRA_TESTS_0=1 bash ./ci/run.sh ./tmp/results ./tmp/mnt
1525+

ci/run.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
# # with MUSA support
2323
# GG_BUILD_MUSA=1 bash ./ci/run.sh ./tmp/results ./tmp/mnt
2424
#
25+
# # with KLEIDIAI support
26+
# GG_BUILD_KLEIDIAI=1 bash ./ci/run.sh ./tmp/results ./tmp/mnt
27+
#
2528

2629
if [ -z "$2" ]; then
2730
echo "usage: $0 <output-dir> <mnt-dir>"
@@ -115,6 +118,34 @@ if [ ! -z ${GG_BUILD_NO_SVE} ]; then
115118
CMAKE_EXTRA="${CMAKE_EXTRA} -DGGML_NATIVE=OFF -DGGML_CPU_ARM_ARCH=armv8.5-a+fp16+i8mm"
116119
fi
117120

121+
if [ -n "${GG_BUILD_KLEIDIAI}" ]; then
122+
echo ">>===== Enabling KleidiAI support"
123+
124+
CANDIDATES=("armv9-a+dotprod+i8mm" "armv8.6-a+dotprod+i8mm" "armv8.2-a+dotprod")
125+
CPU=""
126+
127+
for cpu in "${CANDIDATES[@]}"; do
128+
if echo 'int main(){}' | ${CXX:-c++} -march="$cpu" -x c++ - -c -o /dev/null >/dev/null 2>&1; then
129+
CPU="$cpu"
130+
break
131+
fi
132+
done
133+
134+
if [ -z "$CPU" ]; then
135+
echo "ERROR: None of the required ARM baselines (armv9/armv8.6/armv8.2 + dotprod) are supported by this compiler."
136+
exit 1
137+
fi
138+
139+
echo ">>===== Using ARM baseline: ${CPU}"
140+
141+
CMAKE_EXTRA="${CMAKE_EXTRA:+$CMAKE_EXTRA } \
142+
-DGGML_NATIVE=OFF \
143+
-DGGML_CPU_KLEIDIAI=ON \
144+
-DGGML_CPU_AARCH64=ON \
145+
-DGGML_CPU_ARM_ARCH=${CPU} \
146+
-DBUILD_SHARED_LIBS=OFF"
147+
fi
148+
118149
## helpers
119150

120151
# download a file if it does not exist or if it is outdated

0 commit comments

Comments
 (0)