Skip to content

Commit 949b851

Browse files
committed
Merge remote-tracking branch 'upstream/master' into webgpu
2 parents 2eb7626 + bee2842 commit 949b851

File tree

281 files changed

+16002
-12975
lines changed

Some content is hidden

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

281 files changed

+16002
-12975
lines changed

.devops/tools.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22
set -e
33

44
# Read the first argument into a variable

.github/ISSUE_TEMPLATE/010-bug-compilation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ body:
4040
attributes:
4141
label: GGML backends
4242
description: Which GGML backends do you know to be affected?
43-
options: [AMX, BLAS, CPU, CUDA, HIP, Kompute, Metal, Musa, RPC, SYCL, Vulkan]
43+
options: [AMX, BLAS, CPU, CUDA, HIP, Metal, Musa, RPC, SYCL, Vulkan, OpenCL]
4444
multiple: true
4545
validations:
4646
required: true

.github/ISSUE_TEMPLATE/011-bug-results.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ body:
4242
attributes:
4343
label: GGML backends
4444
description: Which GGML backends do you know to be affected?
45-
options: [AMX, BLAS, CPU, CUDA, HIP, Kompute, Metal, Musa, RPC, SYCL, Vulkan]
45+
options: [AMX, BLAS, CPU, CUDA, HIP, Metal, Musa, RPC, SYCL, Vulkan, OpenCL]
4646
multiple: true
4747
validations:
4848
required: true

.github/labeler.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
11
# https://github.com/actions/labeler
2-
Kompute:
3-
- changed-files:
4-
- any-glob-to-any-file:
5-
- ggml/include/ggml-kompute.h
6-
- ggml/src/ggml-kompute/**
7-
- README-kompute.md
82
Apple Metal:
93
- changed-files:
104
- any-glob-to-any-file:
@@ -93,3 +87,8 @@ Ascend NPU:
9387
- ggml/include/ggml-cann.h
9488
- ggml/src/ggml-cann/**
9589
- docs/backend/CANN.md
90+
OpenCL:
91+
- changed-files:
92+
- any-glob-to-any-file:
93+
- ggml/include/ggml-opencl.h
94+
- ggml/src/ggml-opencl/**

.github/workflows/build-cmake-pkg.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Build relocatable cmake package
2+
on:
3+
workflow_dispatch:
4+
workflow_call:
5+
6+
jobs:
7+
linux:
8+
runs-on: ubuntu-24.04
9+
steps:
10+
- uses: actions/checkout@v4
11+
with:
12+
fetch-depth: 0
13+
14+
- name: Install dependencies
15+
run: |
16+
sudo apt update
17+
sudo apt install -y build-essential tcl
18+
19+
- name: Build
20+
run: |
21+
PREFIX="$(pwd)"/inst
22+
cmake -S . -B build -DCMAKE_PREFIX_PATH="$PREFIX" \
23+
-DLLAMA_CURL=OFF -DLLAMA_BUILD_TESTS=OFF -DLLAMA_BUILD_TOOLS=OFF \
24+
-DLLAMA_BUILD_EXAMPLES=OFF -DCMAKE_BUILD_TYPE=Release
25+
cmake --build build --config Release
26+
cmake --install build --prefix "$PREFIX" --config Release
27+
28+
export LLAMA_CONFIG="$PREFIX"/lib/cmake/llama/llama-config.cmake
29+
tclsh <<'EOF'
30+
set build(commit) [string trim [exec git rev-parse --short HEAD]]
31+
set build(number) [string trim [exec git rev-list --count HEAD]]
32+
set build(version) "0.0.$build(number)"
33+
34+
set llamaconfig [read [open "$env(LLAMA_CONFIG)" r]]
35+
set checks [list "set\\(LLAMA_VERSION \\s+$build(version)\\)" \
36+
"set\\(LLAMA_BUILD_COMMIT\\s+$build(commit)\\)" \
37+
"set\\(LLAMA_BUILD_NUMBER\\s+$build(number)\\)"]
38+
39+
puts -nonewline "Checking llama-config.cmake version... "
40+
foreach check $checks {
41+
if {![regexp -expanded -- $check $llamaconfig]} {
42+
puts "\"$check\" failed!"
43+
exit 1
44+
}
45+
}
46+
puts "success."
47+
EOF
48+
49+
cd examples/simple-cmake-pkg
50+
cmake -S . -B build -DCMAKE_PREFIX_PATH="$PREFIX"/lib/cmake
51+
cmake --build build

.github/workflows/build.yml

Lines changed: 55 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,43 @@ on:
55
push:
66
branches:
77
- master
8-
paths: ['.github/workflows/build.yml', '.github/workflows/build-linux-cross.yml', '**/CMakeLists.txt', '**/.cmake', '**/*.h', '**/*.hpp', '**/*.c', '**/*.cpp', '**/*.cu', '**/*.cuh', '**/*.swift', '**/*.m', '**/*.metal', '**/*.comp']
8+
paths: [
9+
'.github/workflows/build.yml',
10+
'.github/workflows/build-linux-cross.yml',
11+
'.github/workflows/build-cmake-pkg.yml',
12+
'**/CMakeLists.txt',
13+
'**/.cmake',
14+
'**/*.h',
15+
'**/*.hpp',
16+
'**/*.c',
17+
'**/*.cpp',
18+
'**/*.cu',
19+
'**/*.cuh',
20+
'**/*.swift',
21+
'**/*.m',
22+
'**/*.metal',
23+
'**/*.comp'
24+
]
25+
926
pull_request:
1027
types: [opened, synchronize, reopened]
11-
paths: ['.github/workflows/build.yml', '.github/workflows/build-linux-cross.yml', '**/CMakeLists.txt', '**/.cmake', '**/*.h', '**/*.hpp', '**/*.c', '**/*.cpp', '**/*.cu', '**/*.cuh', '**/*.swift', '**/*.m', '**/*.metal', '**/*.comp']
28+
paths: [
29+
'.github/workflows/build.yml',
30+
'.github/workflows/build-linux-cross.yml',
31+
'.github/workflows/build-cmake-pkg.yml',
32+
'**/CMakeLists.txt',
33+
'**/.cmake',
34+
'**/*.h',
35+
'**/*.hpp',
36+
'**/*.c',
37+
'**/*.cpp',
38+
'**/*.cu',
39+
'**/*.cuh',
40+
'**/*.swift',
41+
'**/*.m',
42+
'**/*.metal',
43+
'**/*.comp'
44+
]
1245

1346
concurrency:
1447
group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }}
@@ -51,7 +84,8 @@ jobs:
5184
-DCMAKE_BUILD_RPATH="@loader_path" \
5285
-DLLAMA_FATAL_WARNINGS=ON \
5386
-DGGML_METAL_USE_BF16=ON \
54-
-DGGML_METAL_EMBED_LIBRARY=ON \
87+
-DGGML_METAL_EMBED_LIBRARY=OFF \
88+
-DGGML_METAL_SHADER_DEBUG=ON \
5589
-DGGML_RPC=ON
5690
cmake --build build --config Release -j $(sysctl -n hw.logicalcpu)
5791
@@ -478,6 +512,9 @@ jobs:
478512
build-linux-cross:
479513
uses: ./.github/workflows/build-linux-cross.yml
480514

515+
build-cmake-pkg:
516+
uses: ./.github/workflows/build-cmake-pkg.yml
517+
481518
macOS-latest-cmake-ios:
482519
runs-on: macos-latest
483520

@@ -628,7 +665,7 @@ jobs:
628665
./build-xcframework.sh
629666
630667
windows-msys2:
631-
runs-on: windows-latest
668+
runs-on: windows-2025
632669

633670
strategy:
634671
fail-fast: false
@@ -678,28 +715,31 @@ jobs:
678715
cmake --build build --config ${{ matrix.build }} -j $(nproc)
679716
680717
windows-latest-cmake:
681-
runs-on: windows-latest
718+
runs-on: windows-2025
682719

683720
env:
684721
OPENBLAS_VERSION: 0.3.23
685722
SDE_VERSION: 9.33.0-2024-01-07
686-
VULKAN_VERSION: 1.4.309.0
723+
VULKAN_VERSION: 1.4.313.2
687724

688725
strategy:
689726
matrix:
690727
include:
691728
- build: 'cpu-x64 (static)'
729+
arch: 'x64'
692730
defines: '-G "Ninja Multi-Config" -D CMAKE_TOOLCHAIN_FILE=cmake/x64-windows-llvm.cmake -DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DGGML_RPC=ON -DBUILD_SHARED_LIBS=OFF'
693731
- build: 'openblas-x64'
732+
arch: 'x64'
694733
defines: '-G "Ninja Multi-Config" -D CMAKE_TOOLCHAIN_FILE=cmake/x64-windows-llvm.cmake -DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DGGML_RPC=ON -DGGML_BACKEND_DL=ON -DGGML_CPU_ALL_VARIANTS=ON -DGGML_OPENMP=OFF -DGGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS -DBLAS_INCLUDE_DIRS="$env:RUNNER_TEMP/openblas/include" -DBLAS_LIBRARIES="$env:RUNNER_TEMP/openblas/lib/openblas.lib"'
695734
- build: 'vulkan-x64'
735+
arch: 'x64'
696736
defines: '-DCMAKE_BUILD_TYPE=Release -DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DGGML_RPC=ON -DGGML_BACKEND_DL=ON -DGGML_CPU_ALL_VARIANTS=ON -DGGML_VULKAN=ON'
697737
- build: 'llvm-arm64'
738+
arch: 'arm64'
698739
defines: '-G "Ninja Multi-Config" -D CMAKE_TOOLCHAIN_FILE=cmake/arm64-windows-llvm.cmake -DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON'
699740
- build: 'llvm-arm64-opencl-adreno'
741+
arch: 'arm64'
700742
defines: '-G "Ninja Multi-Config" -D CMAKE_TOOLCHAIN_FILE=cmake/arm64-windows-llvm.cmake -DCMAKE_PREFIX_PATH="$env:RUNNER_TEMP/opencl-arm64-release" -DGGML_OPENCL=ON -DGGML_OPENCL_USE_ADRENO_KERNELS=ON'
701-
# - build: 'kompute-x64'
702-
# defines: '-G "Ninja Multi-Config" -D CMAKE_TOOLCHAIN_FILE=cmake/x64-windows-llvm.cmake -DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DGGML_RPC=ON -DGGML_BACKEND_DL=ON -DGGML_CPU_ALL_VARIANTS=ON -DGGML_OPENMP=OFF -DGGML_KOMPUTE=ON -DKOMPUTE_OPT_DISABLE_VULKAN_VERSION_CHECK=ON'
703743

704744
steps:
705745
- name: Clone
@@ -713,12 +753,6 @@ jobs:
713753
variant: ccache
714754
evict-old-files: 1d
715755

716-
- name: Clone Kompute submodule
717-
id: clone_kompute
718-
if: ${{ matrix.build == 'kompute-x64' }}
719-
run: |
720-
git submodule update --init ggml/src/ggml-kompute/kompute
721-
722756
- name: Download OpenBLAS
723757
id: get_openblas
724758
if: ${{ matrix.build == 'openblas-x64' }}
@@ -734,9 +768,9 @@ jobs:
734768
735769
- name: Install Vulkan SDK
736770
id: get_vulkan
737-
if: ${{ matrix.build == 'kompute-x64' || matrix.build == 'vulkan-x64' }}
771+
if: ${{ matrix.build == 'vulkan-x64' }}
738772
run: |
739-
curl.exe -o $env:RUNNER_TEMP/VulkanSDK-Installer.exe -L "https://sdk.lunarg.com/sdk/download/${env:VULKAN_VERSION}/windows/VulkanSDK-${env:VULKAN_VERSION}-Installer.exe"
773+
curl.exe -o $env:RUNNER_TEMP/VulkanSDK-Installer.exe -L "https://sdk.lunarg.com/sdk/download/${env:VULKAN_VERSION}/windows/vulkansdk-windows-X64-${env:VULKAN_VERSION}.exe"
740774
& "$env:RUNNER_TEMP\VulkanSDK-Installer.exe" --accept-licenses --default-answer --confirm-command install
741775
Add-Content $env:GITHUB_ENV "VULKAN_SDK=C:\VulkanSDK\${env:VULKAN_VERSION}"
742776
Add-Content $env:GITHUB_PATH "C:\VulkanSDK\${env:VULKAN_VERSION}\bin"
@@ -769,6 +803,8 @@ jobs:
769803
- name: libCURL
770804
id: get_libcurl
771805
uses: ./.github/actions/windows-setup-curl
806+
with:
807+
architecture: ${{ matrix.arch == 'x64' && 'win64' || 'win64a' }}
772808

773809
- name: Build
774810
id: cmake_build
@@ -789,7 +825,7 @@ jobs:
789825
790826
- name: Test
791827
id: cmake_test
792-
if: ${{ matrix.build != 'llvm-arm64' && matrix.build != 'llvm-arm64-opencl-adreno' }}
828+
if: ${{ matrix.arch == 'x64' }}
793829
run: |
794830
cd build
795831
ctest -L main -C Release --verbose --timeout 900
@@ -894,7 +930,7 @@ jobs:
894930
cmake --build build --config Release
895931
896932
windows-latest-cmake-sycl:
897-
runs-on: windows-latest
933+
runs-on: windows-2022
898934

899935
defaults:
900936
run:
@@ -928,7 +964,7 @@ jobs:
928964

929965
windows-latest-cmake-hip:
930966
if: ${{ github.event.inputs.create_release != 'true' }}
931-
runs-on: windows-latest
967+
runs-on: windows-2022
932968

933969
steps:
934970
- name: Clone

.github/workflows/release.yml

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ jobs:
4949
run: |
5050
sysctl -a
5151
cmake -B build \
52-
-DCMAKE_BUILD_RPATH="@loader_path" \
52+
-DCMAKE_INSTALL_RPATH='@loader_path' \
53+
-DCMAKE_BUILD_WITH_INSTALL_RPATH=ON \
5354
-DLLAMA_FATAL_WARNINGS=ON \
5455
-DGGML_METAL_USE_BF16=ON \
5556
-DGGML_METAL_EMBED_LIBRARY=ON \
@@ -103,7 +104,8 @@ jobs:
103104
# Metal is disabled due to intermittent failures with Github runners not having a GPU:
104105
# https://github.com/ggml-org/llama.cpp/actions/runs/8635935781/job/23674807267#step:5:2313
105106
cmake -B build \
106-
-DCMAKE_BUILD_RPATH="@loader_path" \
107+
-DCMAKE_INSTALL_RPATH='@loader_path' \
108+
-DCMAKE_BUILD_WITH_INSTALL_RPATH=ON \
107109
-DLLAMA_FATAL_WARNINGS=ON \
108110
-DGGML_METAL=OFF \
109111
-DGGML_RPC=ON
@@ -160,6 +162,8 @@ jobs:
160162
id: cmake_build
161163
run: |
162164
cmake -B build \
165+
-DCMAKE_INSTALL_RPATH='$ORIGIN' \
166+
-DCMAKE_BUILD_WITH_INSTALL_RPATH=ON \
163167
-DGGML_BACKEND_DL=ON \
164168
-DGGML_NATIVE=OFF \
165169
-DGGML_CPU_ALL_VARIANTS=ON \
@@ -211,6 +215,8 @@ jobs:
211215
id: cmake_build
212216
run: |
213217
cmake -B build \
218+
-DCMAKE_INSTALL_RPATH='$ORIGIN' \
219+
-DCMAKE_BUILD_WITH_INSTALL_RPATH=ON \
214220
-DGGML_BACKEND_DL=ON \
215221
-DGGML_NATIVE=OFF \
216222
-DGGML_CPU_ALL_VARIANTS=ON \
@@ -235,7 +241,7 @@ jobs:
235241
name: llama-bin-ubuntu-vulkan-x64.zip
236242

237243
windows-cpu:
238-
runs-on: windows-latest
244+
runs-on: windows-2025
239245

240246
strategy:
241247
matrix:
@@ -271,7 +277,7 @@ jobs:
271277
env:
272278
CURL_PATH: ${{ steps.get_libcurl.outputs.curl_path }}
273279
run: |
274-
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.arch }}
280+
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.arch == 'x64' && 'x64' || 'amd64_arm64' }}
275281
cmake -S . -B build -G "Ninja Multi-Config" ^
276282
-D CMAKE_TOOLCHAIN_FILE=cmake/${{ matrix.arch }}-windows-llvm.cmake ^
277283
-DGGML_NATIVE=OFF ^
@@ -288,7 +294,7 @@ jobs:
288294
CURL_PATH: ${{ steps.get_libcurl.outputs.curl_path }}
289295
run: |
290296
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\
297+
Copy-Item "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Redist\MSVC\14.44.35112\debug_nonredist\${{ matrix.arch }}\Microsoft.VC143.OpenMP.LLVM\libomp140.${{ matrix.arch == 'x64' && 'x86_64' || 'aarch64' }}.dll" .\build\bin\Release\
292298
7z a llama-bin-win-cpu-${{ matrix.arch }}.zip .\build\bin\Release\*
293299
294300
- name: Upload artifacts
@@ -298,11 +304,11 @@ jobs:
298304
name: llama-bin-win-cpu-${{ matrix.arch }}.zip
299305

300306
windows:
301-
runs-on: windows-latest
307+
runs-on: windows-2025
302308

303309
env:
304310
OPENBLAS_VERSION: 0.3.23
305-
VULKAN_VERSION: 1.4.309.0
311+
VULKAN_VERSION: 1.4.313.2
306312

307313
strategy:
308314
matrix:
@@ -332,7 +338,7 @@ jobs:
332338
id: get_vulkan
333339
if: ${{ matrix.backend == 'vulkan' }}
334340
run: |
335-
curl.exe -o $env:RUNNER_TEMP/VulkanSDK-Installer.exe -L "https://sdk.lunarg.com/sdk/download/${env:VULKAN_VERSION}/windows/VulkanSDK-${env:VULKAN_VERSION}-Installer.exe"
341+
curl.exe -o $env:RUNNER_TEMP/VulkanSDK-Installer.exe -L "https://sdk.lunarg.com/sdk/download/${env:VULKAN_VERSION}/windows/vulkansdk-windows-X64-${env:VULKAN_VERSION}.exe"
336342
& "$env:RUNNER_TEMP\VulkanSDK-Installer.exe" --accept-licenses --default-answer --confirm-command install
337343
Add-Content $env:GITHUB_ENV "VULKAN_SDK=C:\VulkanSDK\${env:VULKAN_VERSION}"
338344
Add-Content $env:GITHUB_PATH "C:\VulkanSDK\${env:VULKAN_VERSION}\bin"
@@ -448,7 +454,7 @@ jobs:
448454
name: cudart-llama-bin-win-cuda-${{ matrix.cuda }}-x64.zip
449455

450456
windows-sycl:
451-
runs-on: windows-latest
457+
runs-on: windows-2022
452458

453459
defaults:
454460
run:
@@ -520,7 +526,7 @@ jobs:
520526
name: llama-bin-win-sycl-x64.zip
521527

522528
windows-hip:
523-
runs-on: windows-latest
529+
runs-on: windows-2022
524530

525531
strategy:
526532
matrix:

.gitmodules

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +0,0 @@
1-
[submodule "kompute"]
2-
path = ggml/src/ggml-kompute/kompute
3-
url = https://github.com/nomic-ai/kompute.git

CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ endif()
9595
if (NOT DEFINED LLAMA_BUILD_COMMIT)
9696
set(LLAMA_BUILD_COMMIT ${BUILD_COMMIT})
9797
endif()
98-
set(LLAMA_INSTALL_VERSION 0.0.${BUILD_NUMBER})
98+
set(LLAMA_INSTALL_VERSION 0.0.${LLAMA_BUILD_NUMBER})
9999

100100
# override ggml options
101101
set(GGML_ALL_WARNINGS ${LLAMA_ALL_WARNINGS})
@@ -120,7 +120,6 @@ endfunction()
120120

121121
llama_option_depr(FATAL_ERROR LLAMA_CUBLAS GGML_CUDA)
122122
llama_option_depr(WARNING LLAMA_CUDA GGML_CUDA)
123-
llama_option_depr(WARNING LLAMA_KOMPUTE GGML_KOMPUTE)
124123
llama_option_depr(WARNING LLAMA_METAL GGML_METAL)
125124
llama_option_depr(WARNING LLAMA_METAL_EMBED_LIBRARY GGML_METAL_EMBED_LIBRARY)
126125
llama_option_depr(WARNING LLAMA_NATIVE GGML_NATIVE)

0 commit comments

Comments
 (0)