Skip to content

Commit dc04685

Browse files
authored
Merge branch 'ggml-org:master' into move-page-cache-to-local
2 parents 4573178 + 91a8ee6 commit dc04685

File tree

260 files changed

+20402
-10606
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

260 files changed

+20402
-10606
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,6 @@ charset = unset
4949
trim_trailing_whitespace = unset
5050
insert_final_newline = unset
5151

52-
[tools/mtmd/miniaudio.h]
52+
[vendor/miniaudio/miniaudio.h]
5353
trim_trailing_whitespace = unset
5454
insert_final_newline = unset

.github/labeler.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,10 @@ nix:
8686
embedding:
8787
- changed-files:
8888
- any-glob-to-any-file: examples/embedding/
89+
90+
Ascend NPU:
91+
- changed-files:
92+
- any-glob-to-any-file:
93+
- ggml/include/ggml-cann.h
94+
- ggml/src/ggml-cann/**
95+
- docs/backend/CANN.md

.github/workflows/build-linux-cross.yml

Lines changed: 128 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ jobs:
2626
sudo apt-get install -y --no-install-recommends \
2727
build-essential \
2828
gcc-14-riscv64-linux-gnu \
29-
g++-14-riscv64-linux-gnu \
30-
libcurl4-openssl-dev:riscv64
29+
g++-14-riscv64-linux-gnu
3130
3231
- name: Build
3332
run: |
34-
cmake -B build -DCMAKE_BUILD_TYPE=Release \
33+
cmake -B build -DLLAMA_CURL=OFF \
34+
-DCMAKE_BUILD_TYPE=Release \
3535
-DGGML_OPENMP=OFF \
3636
-DLLAMA_BUILD_EXAMPLES=ON \
3737
-DLLAMA_BUILD_TOOLS=ON \
@@ -72,12 +72,12 @@ jobs:
7272
glslc \
7373
gcc-14-riscv64-linux-gnu \
7474
g++-14-riscv64-linux-gnu \
75-
libvulkan-dev:riscv64 \
76-
libcurl4-openssl-dev:riscv64
75+
libvulkan-dev:riscv64
7776
7877
- name: Build
7978
run: |
80-
cmake -B build -DCMAKE_BUILD_TYPE=Release \
79+
cmake -B build -DLLAMA_CURL=OFF \
80+
-DCMAKE_BUILD_TYPE=Release \
8181
-DGGML_VULKAN=ON \
8282
-DGGML_OPENMP=OFF \
8383
-DLLAMA_BUILD_EXAMPLES=ON \
@@ -118,12 +118,12 @@ jobs:
118118
build-essential \
119119
glslc \
120120
crossbuild-essential-arm64 \
121-
libvulkan-dev:arm64 \
122-
libcurl4-openssl-dev:arm64
121+
libvulkan-dev:arm64
123122
124123
- name: Build
125124
run: |
126-
cmake -B build -DCMAKE_BUILD_TYPE=Release \
125+
cmake -B build -DLLAMA_CURL=OFF \
126+
-DCMAKE_BUILD_TYPE=Release \
127127
-DGGML_VULKAN=ON \
128128
-DGGML_OPENMP=OFF \
129129
-DLLAMA_BUILD_EXAMPLES=ON \
@@ -163,12 +163,12 @@ jobs:
163163
sudo apt-get install -y --no-install-recommends \
164164
build-essential \
165165
gcc-14-powerpc64le-linux-gnu \
166-
g++-14-powerpc64le-linux-gnu \
167-
libcurl4-openssl-dev:ppc64el
166+
g++-14-powerpc64le-linux-gnu
168167
169168
- name: Build
170169
run: |
171-
cmake -B build -DCMAKE_BUILD_TYPE=Release \
170+
cmake -B build -DLLAMA_CURL=OFF \
171+
-DCMAKE_BUILD_TYPE=Release \
172172
-DGGML_OPENMP=OFF \
173173
-DLLAMA_BUILD_EXAMPLES=ON \
174174
-DLLAMA_BUILD_TOOLS=ON \
@@ -209,12 +209,12 @@ jobs:
209209
glslc \
210210
gcc-14-powerpc64le-linux-gnu \
211211
g++-14-powerpc64le-linux-gnu \
212-
libvulkan-dev:ppc64el \
213-
libcurl4-openssl-dev:ppc64el
212+
libvulkan-dev:ppc64el
214213
215214
- name: Build
216215
run: |
217-
cmake -B build -DCMAKE_BUILD_TYPE=Release \
216+
cmake -B build -DLLAMA_CURL=OFF \
217+
-DCMAKE_BUILD_TYPE=Release \
218218
-DGGML_VULKAN=ON \
219219
-DGGML_OPENMP=OFF \
220220
-DLLAMA_BUILD_EXAMPLES=ON \
@@ -231,3 +231,116 @@ jobs:
231231
-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=BOTH
232232
233233
cmake --build build --config Release -j $(nproc)
234+
235+
debian-13-loongarch64-cpu-cross:
236+
runs-on: ubuntu-24.04
237+
container: debian@sha256:653dfb9f86c3782e8369d5f7d29bb8faba1f4bff9025db46e807fa4c22903671
238+
239+
steps:
240+
- uses: actions/checkout@v4
241+
- name: Setup LoongArch
242+
run: |
243+
rm -f /etc/apt/sources.list.d/*
244+
cat << EOF | tee /etc/apt/sources.list.d/debian-ports.list
245+
deb http://snapshot.debian.org/archive/debian/20250515T202920Z/ trixie main
246+
EOF
247+
( echo 'quiet "true";'; \
248+
echo 'APT::Get::Assume-Yes "true";'; \
249+
echo 'APT::Install-Recommends "false";'; \
250+
echo 'Acquire::Check-Valid-Until "false";'; \
251+
echo 'Acquire::Retries "5";'; \
252+
) > /etc/apt/apt.conf.d/99snapshot-repos
253+
254+
apt-get update
255+
apt-get install -y ca-certificates debian-ports-archive-keyring cmake git zip
256+
dpkg --add-architecture loong64
257+
258+
# Add arch-specific repositories for non-amd64 architectures
259+
cat << EOF | tee /etc/apt/sources.list.d/loong64-ports.list
260+
deb [arch=loong64] http://snapshot.debian.org/archive/debian-ports/20250515T194251Z/ sid main
261+
EOF
262+
263+
apt-get update || true ;# Prevent failure due to missing URLs.
264+
265+
apt-get install -y --no-install-recommends \
266+
build-essential \
267+
gcc-14-loongarch64-linux-gnu \
268+
g++-14-loongarch64-linux-gnu
269+
270+
- name: Build
271+
run: |
272+
cmake -B build -DLLAMA_CURL=OFF \
273+
-DCMAKE_BUILD_TYPE=Release \
274+
-DGGML_OPENMP=OFF \
275+
-DLLAMA_BUILD_EXAMPLES=ON \
276+
-DLLAMA_BUILD_TOOLS=ON \
277+
-DLLAMA_BUILD_TESTS=OFF \
278+
-DCMAKE_SYSTEM_NAME=Linux \
279+
-DCMAKE_SYSTEM_PROCESSOR=loongarch64 \
280+
-DCMAKE_C_COMPILER=loongarch64-linux-gnu-gcc-14 \
281+
-DCMAKE_CXX_COMPILER=loongarch64-linux-gnu-g++-14 \
282+
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
283+
-DCMAKE_FIND_ROOT_PATH=/usr/lib/loongarch64-linux-gnu \
284+
-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER \
285+
-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \
286+
-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=BOTH
287+
288+
cmake --build build --config Release -j $(nproc)
289+
290+
debian-13-loongarch64-vulkan-cross:
291+
runs-on: ubuntu-24.04
292+
container: debian@sha256:653dfb9f86c3782e8369d5f7d29bb8faba1f4bff9025db46e807fa4c22903671
293+
294+
steps:
295+
- uses: actions/checkout@v4
296+
- name: Setup LoongArch
297+
run: |
298+
rm -f /etc/apt/sources.list.d/*
299+
cat << EOF | tee /etc/apt/sources.list.d/debian-ports.list
300+
deb http://snapshot.debian.org/archive/debian/20250515T202920Z/ trixie main
301+
EOF
302+
( echo 'quiet "true";'; \
303+
echo 'APT::Get::Assume-Yes "true";'; \
304+
echo 'APT::Install-Recommends "false";'; \
305+
echo 'Acquire::Check-Valid-Until "false";'; \
306+
echo 'Acquire::Retries "5";'; \
307+
) > /etc/apt/apt.conf.d/99snapshot-repos
308+
309+
apt-get update
310+
apt-get install -y ca-certificates debian-ports-archive-keyring cmake git zip
311+
dpkg --add-architecture loong64
312+
313+
# Add arch-specific repositories for non-amd64 architectures
314+
cat << EOF | tee /etc/apt/sources.list.d/loong64-ports.list
315+
deb [arch=loong64] http://snapshot.debian.org/archive/debian-ports/20250515T194251Z/ sid main
316+
EOF
317+
318+
apt-get update || true ;# Prevent failure due to missing URLs.
319+
320+
apt-get install -y --no-install-recommends \
321+
build-essential \
322+
glslc \
323+
gcc-14-loongarch64-linux-gnu \
324+
g++-14-loongarch64-linux-gnu \
325+
libvulkan-dev:loong64
326+
327+
- name: Build
328+
run: |
329+
cmake -B build -DLLAMA_CURL=OFF \
330+
-DCMAKE_BUILD_TYPE=Release \
331+
-DGGML_VULKAN=ON \
332+
-DGGML_OPENMP=OFF \
333+
-DLLAMA_BUILD_EXAMPLES=ON \
334+
-DLLAMA_BUILD_TOOLS=ON \
335+
-DLLAMA_BUILD_TESTS=OFF \
336+
-DCMAKE_SYSTEM_NAME=Linux \
337+
-DCMAKE_SYSTEM_PROCESSOR=loongarch64 \
338+
-DCMAKE_C_COMPILER=loongarch64-linux-gnu-gcc-14 \
339+
-DCMAKE_CXX_COMPILER=loongarch64-linux-gnu-g++-14 \
340+
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
341+
-DCMAKE_FIND_ROOT_PATH=/usr/lib/loongarch64-linux-gnu \
342+
-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER \
343+
-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \
344+
-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=BOTH
345+
346+
cmake --build build --config Release -j $(nproc)

.github/workflows/build.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -839,12 +839,12 @@ jobs:
839839
-DGGML_CUDA=ON
840840
cmake --build build
841841
842-
windows-2019-cmake-cuda:
843-
runs-on: windows-2019
842+
windows-2022-cmake-cuda:
843+
runs-on: windows-2022
844844

845845
strategy:
846846
matrix:
847-
cuda: ['12.4', '11.7']
847+
cuda: ['12.4']
848848

849849
steps:
850850
- name: Clone
@@ -878,7 +878,7 @@ jobs:
878878
env:
879879
CURL_PATH: ${{ steps.get_libcurl.outputs.curl_path }}
880880
run: |
881-
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
881+
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
882882
cmake -S . -B build -G "Ninja Multi-Config" ^
883883
-DLLAMA_BUILD_SERVER=ON ^
884884
-DGGML_NATIVE=OFF ^

.github/workflows/release.yml

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,9 @@ jobs:
131131
include:
132132
- build: 'x64'
133133
os: ubuntu-22.04
134-
- build: 'arm64'
135-
os: ubuntu-22.04-arm
134+
# GGML_BACKEND_DL and GGML_CPU_ALL_VARIANTS are not currently supported on arm
135+
# - build: 'arm64'
136+
# os: ubuntu-22.04-arm
136137

137138
runs-on: ${{ matrix.os }}
138139

@@ -159,6 +160,9 @@ jobs:
159160
id: cmake_build
160161
run: |
161162
cmake -B build \
163+
-DGGML_BACKEND_DL=ON \
164+
-DGGML_NATIVE=OFF \
165+
-DGGML_CPU_ALL_VARIANTS=ON \
162166
-DLLAMA_FATAL_WARNINGS=ON \
163167
${{ env.CMAKE_ARGS }}
164168
cmake --build build --config Release -j $(nproc)
@@ -207,6 +211,9 @@ jobs:
207211
id: cmake_build
208212
run: |
209213
cmake -B build \
214+
-DGGML_BACKEND_DL=ON \
215+
-DGGML_NATIVE=OFF \
216+
-DGGML_CPU_ALL_VARIANTS=ON \
210217
-DGGML_VULKAN=ON \
211218
${{ env.CMAKE_ARGS }}
212219
cmake --build build --config Release -j $(nproc)
@@ -260,16 +267,18 @@ jobs:
260267
architecture: ${{ matrix.arch == 'x64' && 'win64' || 'win64a' }}
261268

262269
- name: Build
270+
shell: cmd
263271
env:
264272
CURL_PATH: ${{ steps.get_libcurl.outputs.curl_path }}
265273
run: |
266-
cmake -S . -B build -G "Ninja Multi-Config" `
267-
-D CMAKE_TOOLCHAIN_FILE=cmake/${{ matrix.arch }}-windows-llvm.cmake `
268-
-DGGML_NATIVE=OFF `
269-
-DGGML_BACKEND_DL=ON `
270-
-DGGML_CPU_ALL_VARIANTS=ON `
271-
-DGGML_OPENMP=OFF `
272-
-DCURL_LIBRARY="$env:CURL_PATH/lib/libcurl.dll.a" -DCURL_INCLUDE_DIR="$env:CURL_PATH/include" `
274+
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.arch }}
275+
cmake -S . -B build -G "Ninja Multi-Config" ^
276+
-D CMAKE_TOOLCHAIN_FILE=cmake/${{ matrix.arch }}-windows-llvm.cmake ^
277+
-DGGML_NATIVE=OFF ^
278+
-DGGML_BACKEND_DL=ON ^
279+
-DGGML_CPU_ALL_VARIANTS=${{ matrix.arch == 'x64' && 'ON' || 'OFF' }} ^
280+
-DGGML_OPENMP=ON ^
281+
-DCURL_LIBRARY="%CURL_PATH%/lib/libcurl.dll.a" -DCURL_INCLUDE_DIR="%CURL_PATH%/include" ^
273282
${{ env.CMAKE_ARGS }}
274283
cmake --build build --config Release
275284
@@ -279,6 +288,7 @@ jobs:
279288
CURL_PATH: ${{ steps.get_libcurl.outputs.curl_path }}
280289
run: |
281290
Copy-Item $env:CURL_PATH\bin\libcurl-${{ matrix.arch }}.dll .\build\bin\Release\
291+
Copy-Item "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Redist\MSVC\14.42.34433\debug_nonredist\${{ matrix.arch }}\Microsoft.VC143.OpenMP.LLVM\libomp140.${{ matrix.arch == 'x64' && 'x86_64' || 'aarch64' }}.dll" .\build\bin\Release\
282292
7z a llama-bin-win-cpu-${{ matrix.arch }}.zip .\build\bin\Release\*
283293
284294
- name: Upload artifacts
@@ -370,11 +380,11 @@ jobs:
370380
name: llama-bin-win-${{ matrix.backend }}-${{ matrix.arch }}.zip
371381

372382
windows-cuda:
373-
runs-on: windows-2019
383+
runs-on: windows-2022
374384

375385
strategy:
376386
matrix:
377-
cuda: ['12.4', '11.7']
387+
cuda: ['12.4']
378388

379389
steps:
380390
- name: Clone
@@ -402,7 +412,7 @@ jobs:
402412
id: cmake_build
403413
shell: cmd
404414
run: |
405-
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
415+
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
406416
cmake -S . -B build -G "Ninja Multi-Config" ^
407417
-DGGML_BACKEND_DL=ON ^
408418
-DGGML_NATIVE=OFF ^

.github/workflows/server.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ jobs:
180180
181181
182182
server-windows:
183-
runs-on: windows-2019
183+
runs-on: windows-2022
184184

185185
steps:
186186
- name: Clone

.github/workflows/winget.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Update Winget Package
2+
3+
on:
4+
workflow_dispatch: # allows manual triggering
5+
schedule:
6+
- cron: '28 5 * * *' # Update every day at 5:28 UTC
7+
8+
jobs:
9+
update:
10+
name: Update Winget Package
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Install cargo binstall
15+
uses: cargo-bins/cargo-binstall@268643a6b5ea099f5718ee5cd3ff7dc89a5eb49b
16+
17+
- name: Install komac
18+
run: |
19+
cargo binstall komac@2.11.2 -y
20+
21+
- name: Find latest release
22+
id: find_latest_release
23+
uses: actions/github-script@v6
24+
with:
25+
script: |
26+
const { data: releases } = await github.rest.repos.listReleases({
27+
owner: context.repo.owner,
28+
repo: context.repo.repo,
29+
});
30+
console.log("Latest release:", releases[0].tag_name);
31+
return releases[0].tag_name;
32+
33+
- name: Update manifest
34+
env:
35+
VERSION: ${{ steps.find_latest_release.outputs.result }}
36+
run: |
37+
echo "Updating manifest..."
38+
komac update --version ${{ env.VERSION }} \
39+
--urls "https://github.com/ggml-org/llama.cpp/releases/download/${{ env.VERSION }}/llama-${{ env.VERSION }}-bin-win-vulkan-x64.zip" \
40+
--token ${{ secrets.WINGET_GITHUB_TOKEN }} \
41+
--submit \
42+
ggml.llamacpp

CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,11 @@ if (NOT TARGET ggml AND NOT LLAMA_USE_SYSTEM_GGML)
160160
# ... otherwise assume ggml is added by a parent CMakeLists.txt
161161
endif()
162162

163+
if (MINGW)
164+
# Target Windows 8 for PrefetchVirtualMemory
165+
add_compile_definitions(_WIN32_WINNT=${GGML_WIN_VER})
166+
endif()
167+
163168
#
164169
# build the library
165170
#

0 commit comments

Comments
 (0)