Skip to content

Commit 2c0d875

Browse files
authored
ci: add ARM64 Kleidiai build and test support (#16462)
1 parent aa4711d commit 2c0d875

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
@@ -1515,3 +1515,29 @@ jobs:
15151515
run: |
15161516
vulkaninfo --summary
15171517
GG_BUILD_VULKAN=1 bash ./ci/run.sh ~/results/llama.cpp ~/mnt/llama.cpp
1518+
1519+
ggml-ci-arm64-cpu-kleidiai:
1520+
runs-on: ubuntu-22.04-arm
1521+
1522+
steps:
1523+
- name: Clone
1524+
id: checkout
1525+
uses: actions/checkout@v4
1526+
1527+
- name: ccache
1528+
uses: ggml-org/[email protected]
1529+
with:
1530+
key: ggml-ci-arm64-cpu-kleidiai
1531+
evict-old-files: 1d
1532+
1533+
- name: Dependencies
1534+
id: depends
1535+
run: |
1536+
sudo apt-get update
1537+
sudo apt-get install -y build-essential libcurl4-openssl-dev
1538+
1539+
- name: Test
1540+
id: ggml-ci
1541+
run: |
1542+
GG_BUILD_KLEIDIAI=1 GG_BUILD_EXTRA_TESTS_0=1 bash ./ci/run.sh ./tmp/results ./tmp/mnt
1543+

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)