@fugood/llama.node 0.3.9 → 0.3.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/bin/darwin/arm64/llama-node.node +0 -0
  2. package/bin/darwin/x64/llama-node.node +0 -0
  3. package/bin/linux/arm64/llama-node.node +0 -0
  4. package/bin/linux/x64/llama-node.node +0 -0
  5. package/bin/linux-cuda/arm64/llama-node.node +0 -0
  6. package/bin/linux-cuda/x64/llama-node.node +0 -0
  7. package/bin/linux-vulkan/arm64/llama-node.node +0 -0
  8. package/bin/linux-vulkan/x64/llama-node.node +0 -0
  9. package/bin/win32/arm64/llama-node.node +0 -0
  10. package/bin/win32/arm64/node.lib +0 -0
  11. package/bin/win32/x64/llama-node.node +0 -0
  12. package/bin/win32/x64/node.lib +0 -0
  13. package/bin/win32-vulkan/arm64/llama-node.node +0 -0
  14. package/bin/win32-vulkan/arm64/node.lib +0 -0
  15. package/bin/win32-vulkan/x64/llama-node.node +0 -0
  16. package/bin/win32-vulkan/x64/node.lib +0 -0
  17. package/lib/binding.js +2 -2
  18. package/lib/binding.ts +47 -8
  19. package/lib/index.js +21 -1
  20. package/lib/index.ts +31 -1
  21. package/package.json +12 -3
  22. package/src/LlamaCompletionWorker.cpp +33 -6
  23. package/src/LlamaCompletionWorker.h +3 -1
  24. package/src/LlamaContext.cpp +336 -28
  25. package/src/LlamaContext.h +2 -0
  26. package/src/common.hpp +19 -2
  27. package/src/llama.cpp/.github/workflows/build.yml +289 -107
  28. package/src/llama.cpp/.github/workflows/close-issue.yml +1 -1
  29. package/src/llama.cpp/.github/workflows/docker.yml +2 -1
  30. package/src/llama.cpp/.github/workflows/server.yml +25 -2
  31. package/src/llama.cpp/CMakeLists.txt +10 -19
  32. package/src/llama.cpp/cmake/build-info.cmake +1 -1
  33. package/src/llama.cpp/common/CMakeLists.txt +32 -0
  34. package/src/llama.cpp/common/arg.cpp +66 -16
  35. package/src/llama.cpp/common/chat-template.hpp +515 -0
  36. package/src/llama.cpp/common/chat.cpp +966 -0
  37. package/src/llama.cpp/common/chat.hpp +52 -0
  38. package/src/llama.cpp/common/common.cpp +159 -36
  39. package/src/llama.cpp/common/common.h +56 -14
  40. package/src/llama.cpp/common/json-schema-to-grammar.cpp +46 -66
  41. package/src/llama.cpp/common/json-schema-to-grammar.h +15 -1
  42. package/src/llama.cpp/common/llguidance.cpp +270 -0
  43. package/src/llama.cpp/common/log.cpp +1 -10
  44. package/src/llama.cpp/common/log.h +10 -0
  45. package/src/llama.cpp/common/minja.hpp +2868 -0
  46. package/src/llama.cpp/common/sampling.cpp +22 -1
  47. package/src/llama.cpp/common/sampling.h +3 -0
  48. package/src/llama.cpp/docs/build.md +54 -9
  49. package/src/llama.cpp/examples/export-lora/export-lora.cpp +12 -2
  50. package/src/llama.cpp/examples/gbnf-validator/gbnf-validator.cpp +1 -1
  51. package/src/llama.cpp/examples/llava/CMakeLists.txt +7 -0
  52. package/src/llama.cpp/examples/llava/clip-quantize-cli.cpp +59 -0
  53. package/src/llama.cpp/examples/llava/clip.cpp +133 -14
  54. package/src/llama.cpp/examples/llava/clip.h +2 -0
  55. package/src/llama.cpp/examples/llava/llava.cpp +22 -8
  56. package/src/llama.cpp/examples/llava/minicpmv-cli.cpp +9 -1
  57. package/src/llama.cpp/examples/main/main.cpp +26 -25
  58. package/src/llama.cpp/examples/run/linenoise.cpp/linenoise.cpp +136 -137
  59. package/src/llama.cpp/examples/run/linenoise.cpp/linenoise.h +18 -4
  60. package/src/llama.cpp/examples/run/run.cpp +224 -69
  61. package/src/llama.cpp/examples/server/server.cpp +252 -81
  62. package/src/llama.cpp/examples/server/utils.hpp +73 -21
  63. package/src/llama.cpp/examples/simple-chat/simple-chat.cpp +6 -4
  64. package/src/llama.cpp/examples/simple-cmake-pkg/CMakeLists.txt +11 -0
  65. package/src/llama.cpp/ggml/CMakeLists.txt +78 -1
  66. package/src/llama.cpp/ggml/include/ggml.h +1 -1
  67. package/src/llama.cpp/ggml/src/CMakeLists.txt +21 -4
  68. package/src/llama.cpp/ggml/src/ggml-alloc.c +1 -13
  69. package/src/llama.cpp/ggml/src/ggml-cpu/ggml-cpu-quants.c +91 -78
  70. package/src/llama.cpp/ggml/src/ggml-cpu/ggml-cpu.c +7 -7
  71. package/src/llama.cpp/ggml/src/ggml-cpu/ggml-cpu.cpp +2 -1
  72. package/src/llama.cpp/ggml/src/ggml-cuda/CMakeLists.txt +1 -1
  73. package/src/llama.cpp/ggml/src/ggml-cuda/vendors/hip.h +46 -0
  74. package/src/llama.cpp/ggml/src/ggml-hip/CMakeLists.txt +16 -1
  75. package/src/llama.cpp/ggml/src/ggml-musa/CMakeLists.txt +1 -1
  76. package/src/llama.cpp/ggml/src/ggml-rpc/ggml-rpc.cpp +28 -8
  77. package/src/llama.cpp/ggml/src/ggml-sycl/ggml-sycl.cpp +5 -7
  78. package/src/llama.cpp/ggml/src/ggml-sycl/softmax.cpp +33 -23
  79. package/src/llama.cpp/ggml/src/ggml-sycl/softmax.hpp +1 -5
  80. package/src/llama.cpp/ggml/src/ggml-vulkan/ggml-vulkan.cpp +323 -121
  81. package/src/llama.cpp/ggml/src/ggml-vulkan/vulkan-shaders/vulkan-shaders-gen.cpp +13 -3
  82. package/src/llama.cpp/ggml/src/ggml.c +23 -13
  83. package/src/llama.cpp/include/llama.h +14 -1
  84. package/src/llama.cpp/models/ggml-vocab-deepseek-r1-qwen.gguf.inp +112 -0
  85. package/src/llama.cpp/models/ggml-vocab-deepseek-r1-qwen.gguf.out +46 -0
  86. package/src/llama.cpp/src/CMakeLists.txt +1 -1
  87. package/src/llama.cpp/src/llama-arch.cpp +7 -2
  88. package/src/llama.cpp/src/llama-arch.h +3 -1
  89. package/src/llama.cpp/src/llama-chat.cpp +11 -2
  90. package/src/llama.cpp/src/llama-chat.h +1 -0
  91. package/src/llama.cpp/src/llama-grammar.cpp +86 -6
  92. package/src/llama.cpp/src/llama-grammar.h +22 -1
  93. package/src/llama.cpp/src/llama-mmap.cpp +1 -0
  94. package/src/llama.cpp/src/llama-model-loader.cpp +1 -1
  95. package/src/llama.cpp/src/llama-model.cpp +76 -6
  96. package/src/llama.cpp/src/llama-sampling.cpp +47 -4
  97. package/src/llama.cpp/src/llama-vocab.cpp +10 -4
  98. package/src/llama.cpp/src/llama.cpp +181 -123
  99. package/src/llama.cpp/tests/CMakeLists.txt +4 -0
  100. package/src/llama.cpp/tests/test-backend-ops.cpp +158 -57
  101. package/src/llama.cpp/tests/test-chat-template.cpp +154 -31
  102. package/src/llama.cpp/tests/test-chat.cpp +607 -0
  103. package/src/llama.cpp/tests/test-grammar-integration.cpp +2 -2
  104. package/src/llama.cpp/tests/test-grammar-llguidance.cpp +1140 -0
  105. package/src/llama.cpp/tests/test-json-schema-to-grammar.cpp +1 -1
  106. package/src/llama.cpp/examples/main-cmake-pkg/CMakeLists.txt +0 -32
@@ -10,10 +10,10 @@ on:
10
10
  push:
11
11
  branches:
12
12
  - master
13
- paths: ['.github/workflows/build.yml', '**/CMakeLists.txt', '**/Makefile', '**/*.h', '**/*.hpp', '**/*.c', '**/*.cpp', '**/*.cu', '**/*.cuh', '**/*.swift', '**/*.m', '**/*.metal']
13
+ paths: ['.github/workflows/build.yml', '**/CMakeLists.txt', '**/Makefile', '**/*.h', '**/*.hpp', '**/*.c', '**/*.cpp', '**/*.cu', '**/*.cuh', '**/*.swift', '**/*.m', '**/*.metal', '**/*.comp']
14
14
  pull_request:
15
15
  types: [opened, synchronize, reopened]
16
- paths: ['.github/workflows/build.yml', '**/CMakeLists.txt', '**/Makefile', '**/*.h', '**/*.hpp', '**/*.c', '**/*.cpp', '**/*.cu', '**/*.cuh', '**/*.swift', '**/*.m', '**/*.metal']
16
+ paths: ['.github/workflows/build.yml', '**/CMakeLists.txt', '**/Makefile', '**/*.h', '**/*.hpp', '**/*.c', '**/*.cpp', '**/*.cu', '**/*.cuh', '**/*.swift', '**/*.m', '**/*.metal', '**/*.comp']
17
17
 
18
18
  concurrency:
19
19
  group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }}
@@ -43,6 +43,12 @@ jobs:
43
43
  with:
44
44
  fetch-depth: 0
45
45
 
46
+ - name: ccache
47
+ uses: hendrikmuhs/ccache-action@v1.2.16
48
+ with:
49
+ key: macOS-latest-cmake-arm64
50
+ evict-old-files: 1d
51
+
46
52
  - name: Dependencies
47
53
  id: depends
48
54
  continue-on-error: true
@@ -53,15 +59,14 @@ jobs:
53
59
  id: cmake_build
54
60
  run: |
55
61
  sysctl -a
56
- mkdir build
57
- cd build
58
- cmake .. \
62
+ cmake -B build \
63
+ -DCMAKE_BUILD_RPATH="@loader_path" \
59
64
  -DLLAMA_FATAL_WARNINGS=ON \
60
65
  -DLLAMA_CURL=ON \
61
66
  -DGGML_METAL_USE_BF16=ON \
62
67
  -DGGML_METAL_EMBED_LIBRARY=ON \
63
68
  -DGGML_RPC=ON
64
- cmake --build . --config Release -j $(sysctl -n hw.logicalcpu)
69
+ cmake --build build --config Release -j $(sysctl -n hw.logicalcpu)
65
70
 
66
71
  - name: Test
67
72
  id: cmake_test
@@ -107,6 +112,12 @@ jobs:
107
112
  with:
108
113
  fetch-depth: 0
109
114
 
115
+ - name: ccache
116
+ uses: hendrikmuhs/ccache-action@v1.2.16
117
+ with:
118
+ key: macOS-latest-cmake-x64
119
+ evict-old-files: 1d
120
+
110
121
  - name: Dependencies
111
122
  id: depends
112
123
  continue-on-error: true
@@ -120,6 +131,7 @@ jobs:
120
131
  # Metal is disabled due to intermittent failures with Github runners not having a GPU:
121
132
  # https://github.com/ggerganov/llama.cpp/actions/runs/8635935781/job/23674807267#step:5:2313
122
133
  cmake -B build \
134
+ -DCMAKE_BUILD_RPATH="@loader_path" \
123
135
  -DLLAMA_FATAL_WARNINGS=ON \
124
136
  -DLLAMA_CURL=ON \
125
137
  -DGGML_METAL=OFF \
@@ -160,8 +172,8 @@ jobs:
160
172
  path: llama-${{ steps.tag.outputs.name }}-bin-macos-x64.zip
161
173
  name: llama-bin-macos-x64.zip
162
174
 
163
- ubuntu-latest-cmake:
164
- runs-on: ubuntu-latest
175
+ ubuntu-cpu-cmake:
176
+ runs-on: ubuntu-22.04
165
177
 
166
178
  steps:
167
179
  - name: Clone
@@ -170,6 +182,12 @@ jobs:
170
182
  with:
171
183
  fetch-depth: 0
172
184
 
185
+ - name: ccache
186
+ uses: hendrikmuhs/ccache-action@v1.2.16
187
+ with:
188
+ key: ubuntu-cpu-cmake
189
+ evict-old-files: 1d
190
+
173
191
  - name: Dependencies
174
192
  id: depends
175
193
  run: |
@@ -179,10 +197,11 @@ jobs:
179
197
  - name: Build
180
198
  id: cmake_build
181
199
  run: |
182
- mkdir build
183
- cd build
184
- cmake .. -DLLAMA_FATAL_WARNINGS=ON -DLLAMA_CURL=ON -DGGML_RPC=ON
185
- cmake --build . --config Release -j $(nproc)
200
+ cmake -B build \
201
+ -DLLAMA_FATAL_WARNINGS=ON \
202
+ -DLLAMA_CURL=ON \
203
+ -DGGML_RPC=ON
204
+ cmake --build build --config Release -j $(nproc)
186
205
 
187
206
  - name: Test
188
207
  id: cmake_test
@@ -244,6 +263,12 @@ jobs:
244
263
  id: checkout
245
264
  uses: actions/checkout@v4
246
265
 
266
+ - name: ccache
267
+ uses: hendrikmuhs/ccache-action@v1.2.16
268
+ with:
269
+ key: ubuntu-latest-cmake-sanitizer-${{ matrix.sanitizer }}
270
+ evict-old-files: 1d
271
+
247
272
  - name: Dependencies
248
273
  id: depends
249
274
  run: |
@@ -254,19 +279,52 @@ jobs:
254
279
  id: cmake_build
255
280
  if: ${{ matrix.sanitizer != 'THREAD' }}
256
281
  run: |
257
- mkdir build
258
- cd build
259
- cmake .. -DLLAMA_FATAL_WARNINGS=ON -DLLAMA_SANITIZE_${{ matrix.sanitizer }}=ON -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
260
- cmake --build . --config ${{ matrix.build_type }} -j $(nproc)
282
+ cmake -B build \
283
+ -DLLAMA_FATAL_WARNINGS=ON \
284
+ -DLLAMA_SANITIZE_${{ matrix.sanitizer }}=ON \
285
+ -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
286
+ cmake --build build --config ${{ matrix.build_type }} -j $(nproc)
261
287
 
262
288
  - name: Build (no OpenMP)
263
289
  id: cmake_build_no_openmp
264
290
  if: ${{ matrix.sanitizer == 'THREAD' }}
291
+ run: |
292
+ cmake -B build \
293
+ -DLLAMA_FATAL_WARNINGS=ON \
294
+ -DLLAMA_SANITIZE_${{ matrix.sanitizer }}=ON \
295
+ -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
296
+ -DGGML_OPENMP=OFF
297
+ cmake --build build --config ${{ matrix.build_type }} -j $(nproc)
298
+
299
+ - name: Test
300
+ id: cmake_test
301
+ run: |
302
+ cd build
303
+ ctest -L main --verbose --timeout 900
304
+
305
+ ubuntu-latest-llguidance:
306
+ runs-on: ubuntu-latest
307
+
308
+ steps:
309
+ - name: Clone
310
+ id: checkout
311
+ uses: actions/checkout@v4
312
+
313
+ - name: Dependencies
314
+ id: depends
315
+ run: |
316
+ sudo apt-get update
317
+ sudo apt-get install build-essential
318
+
319
+ - name: Build
320
+ id: cmake_build
265
321
  run: |
266
322
  mkdir build
267
323
  cd build
268
- cmake .. -DLLAMA_FATAL_WARNINGS=ON -DLLAMA_SANITIZE_${{ matrix.sanitizer }}=ON -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DGGML_OPENMP=OFF
269
- cmake --build . --config ${{ matrix.build_type }} -j $(nproc)
324
+ cmake .. \
325
+ -DLLAMA_FATAL_WARNINGS=ON \
326
+ -DLLAMA_LLGUIDANCE=ON
327
+ cmake --build . --config Release -j $(nproc)
270
328
 
271
329
  - name: Test
272
330
  id: cmake_test
@@ -284,6 +342,12 @@ jobs:
284
342
  id: checkout
285
343
  uses: actions/checkout@v4
286
344
 
345
+ - name: ccache
346
+ uses: hendrikmuhs/ccache-action@v1.2.16
347
+ with:
348
+ key: ubuntu-latest-cmake-rpc
349
+ evict-old-files: 1d
350
+
287
351
  - name: Dependencies
288
352
  id: depends
289
353
  run: |
@@ -293,10 +357,9 @@ jobs:
293
357
  - name: Build
294
358
  id: cmake_build
295
359
  run: |
296
- mkdir build
297
- cd build
298
- cmake -DGGML_RPC=ON ..
299
- cmake --build . --config Release -j $(nproc)
360
+ cmake -B build \
361
+ -DGGML_RPC=ON
362
+ cmake --build build --config Release -j $(nproc)
300
363
 
301
364
  - name: Test
302
365
  id: cmake_test
@@ -312,6 +375,12 @@ jobs:
312
375
  id: checkout
313
376
  uses: actions/checkout@v4
314
377
 
378
+ - name: ccache
379
+ uses: hendrikmuhs/ccache-action@v1.2.16
380
+ with:
381
+ key: ubuntu-22-cmake-vulkan
382
+ evict-old-files: 1d
383
+
315
384
  - name: Dependencies
316
385
  id: depends
317
386
  run: |
@@ -323,16 +392,16 @@ jobs:
323
392
  - name: Build
324
393
  id: cmake_build
325
394
  run: |
326
- mkdir build
327
- cd build
328
- cmake -DGGML_VULKAN=ON ..
329
- cmake --build . --config Release -j $(nproc)
395
+ cmake -B build \
396
+ -DGGML_VULKAN=ON
397
+ cmake --build build --config Release -j $(nproc)
330
398
 
331
399
  - name: Test
332
400
  id: cmake_test
333
401
  run: |
334
402
  cd build
335
- ctest -L main --verbose --timeout 900
403
+ # This is using llvmpipe and runs slower than other backends
404
+ ctest -L main --verbose --timeout 1800
336
405
 
337
406
  ubuntu-22-cmake-hip:
338
407
  runs-on: ubuntu-22.04
@@ -349,16 +418,27 @@ jobs:
349
418
  sudo apt-get update
350
419
  sudo apt-get install -y build-essential git cmake rocblas-dev hipblas-dev
351
420
 
421
+ - name: ccache
422
+ uses: hendrikmuhs/ccache-action@v1.2.16
423
+ with:
424
+ key: ubuntu-22-cmake-hip
425
+ evict-old-files: 1d
426
+
352
427
  - name: Build with native CMake HIP support
353
428
  id: cmake_build
354
429
  run: |
355
- cmake -B build -S . -DCMAKE_HIP_COMPILER="$(hipconfig -l)/clang" -DGGML_HIP=ON
430
+ cmake -B build -S . \
431
+ -DCMAKE_HIP_COMPILER="$(hipconfig -l)/clang" \
432
+ -DGGML_HIP=ON
356
433
  cmake --build build --config Release -j $(nproc)
357
434
 
358
435
  - name: Build with legacy HIP support
359
436
  id: cmake_build_legacy_hip
360
437
  run: |
361
- cmake -B build2 -S . -DCMAKE_C_COMPILER=hipcc -DCMAKE_CXX_COMPILER=hipcc -DGGML_HIP=ON
438
+ cmake -B build2 -S . \
439
+ -DCMAKE_C_COMPILER=hipcc \
440
+ -DCMAKE_CXX_COMPILER=hipcc \
441
+ -DGGML_HIP=ON
362
442
  cmake --build build2 --config Release -j $(nproc)
363
443
 
364
444
  ubuntu-22-cmake-musa:
@@ -376,10 +456,17 @@ jobs:
376
456
  apt-get update
377
457
  apt-get install -y build-essential git cmake libcurl4-openssl-dev
378
458
 
459
+ - name: ccache
460
+ uses: hendrikmuhs/ccache-action@v1.2.16
461
+ with:
462
+ key: ubuntu-22-cmake-musa
463
+ evict-old-files: 1d
464
+
379
465
  - name: Build with native CMake MUSA support
380
466
  id: cmake_build
381
467
  run: |
382
- cmake -B build -S . -DGGML_MUSA=ON
468
+ cmake -B build -S . \
469
+ -DGGML_MUSA=ON
383
470
  cmake --build build --config Release -j $(nproc)
384
471
 
385
472
  ubuntu-22-cmake-sycl:
@@ -414,14 +501,21 @@ jobs:
414
501
  id: checkout
415
502
  uses: actions/checkout@v4
416
503
 
504
+ - name: ccache
505
+ uses: hendrikmuhs/ccache-action@v1.2.16
506
+ with:
507
+ key: ubuntu-22-cmake-sycl
508
+ evict-old-files: 1d
509
+
417
510
  - name: Build
418
511
  id: cmake_build
419
512
  run: |
420
513
  source /opt/intel/oneapi/setvars.sh
421
- mkdir build
422
- cd build
423
- cmake -DGGML_SYCL=ON -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx ..
424
- cmake --build . --config Release -j $(nproc)
514
+ cmake -B build \
515
+ -DGGML_SYCL=ON \
516
+ -DCMAKE_C_COMPILER=icx \
517
+ -DCMAKE_CXX_COMPILER=icpx
518
+ cmake --build build --config Release -j $(nproc)
425
519
 
426
520
  ubuntu-22-cmake-sycl-fp16:
427
521
  runs-on: ubuntu-22.04
@@ -455,47 +549,22 @@ jobs:
455
549
  id: checkout
456
550
  uses: actions/checkout@v4
457
551
 
458
- - name: Build
459
- id: cmake_build
460
- run: |
461
- source /opt/intel/oneapi/setvars.sh
462
- mkdir build
463
- cd build
464
- cmake -DGGML_SYCL=ON -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx -DGGML_SYCL_F16=ON ..
465
- cmake --build . --config Release -j $(nproc)
466
-
467
- # TODO: build with GGML_METAL=OFF because test-backend-ops fail on "Apple Paravirtual device" and I don't know
468
- # how to debug it.
469
- # ref: https://github.com/ggerganov/llama.cpp/actions/runs/7132125951/job/19422043567?pr=4359#step:5:6584
470
- # would be great if we fix these
471
- macOS-latest-cmake:
472
- runs-on: macos-latest
473
-
474
- steps:
475
- - name: Clone
476
- id: checkout
477
- uses: actions/checkout@v4
478
-
479
- - name: Dependencies
480
- id: depends
481
- continue-on-error: true
482
- run: |
483
- brew update
552
+ - name: ccache
553
+ uses: hendrikmuhs/ccache-action@v1.2.16
554
+ with:
555
+ key: ubuntu-22-cmake-sycl-fp16
556
+ evict-old-files: 1d
484
557
 
485
558
  - name: Build
486
559
  id: cmake_build
487
560
  run: |
488
- sysctl -a
489
- mkdir build
490
- cd build
491
- cmake -DLLAMA_FATAL_WARNINGS=ON -DGGML_METAL=OFF ..
492
- cmake --build . --config Release -j $(sysctl -n hw.logicalcpu)
493
-
494
- - name: Test
495
- id: cmake_test
496
- run: |
497
- cd build
498
- ctest -L main --verbose --timeout 900
561
+ source /opt/intel/oneapi/setvars.sh
562
+ cmake -B build \
563
+ -DGGML_SYCL=ON \
564
+ -DCMAKE_C_COMPILER=icx \
565
+ -DCMAKE_CXX_COMPILER=icpx \
566
+ -DGGML_SYCL_F16=ON
567
+ cmake --build build --config Release -j $(nproc)
499
568
 
500
569
  macOS-latest-cmake-ios:
501
570
  runs-on: macos-latest
@@ -505,6 +574,12 @@ jobs:
505
574
  id: checkout
506
575
  uses: actions/checkout@v4
507
576
 
577
+ - name: ccache
578
+ uses: hendrikmuhs/ccache-action@v1.2.16
579
+ with:
580
+ key: macOS-latest-cmake-ios
581
+ evict-old-files: 1d
582
+
508
583
  - name: Dependencies
509
584
  id: depends
510
585
  continue-on-error: true
@@ -515,9 +590,7 @@ jobs:
515
590
  id: cmake_build
516
591
  run: |
517
592
  sysctl -a
518
- mkdir build
519
- cd build
520
- cmake -G Xcode .. \
593
+ cmake -B build -G Xcode \
521
594
  -DGGML_METAL_USE_BF16=ON \
522
595
  -DGGML_METAL_EMBED_LIBRARY=ON \
523
596
  -DLLAMA_BUILD_EXAMPLES=OFF \
@@ -526,7 +599,7 @@ jobs:
526
599
  -DCMAKE_SYSTEM_NAME=iOS \
527
600
  -DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 \
528
601
  -DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=ggml
529
- cmake --build . --config Release -j $(sysctl -n hw.logicalcpu) -- CODE_SIGNING_ALLOWED=NO
602
+ cmake --build build --config Release -j $(sysctl -n hw.logicalcpu) -- CODE_SIGNING_ALLOWED=NO
530
603
 
531
604
  macOS-latest-cmake-tvos:
532
605
  runs-on: macos-latest
@@ -536,6 +609,12 @@ jobs:
536
609
  id: checkout
537
610
  uses: actions/checkout@v4
538
611
 
612
+ - name: ccache
613
+ uses: hendrikmuhs/ccache-action@v1.2.16
614
+ with:
615
+ key: macOS-latest-cmake-tvos
616
+ evict-old-files: 1d
617
+
539
618
  - name: Dependencies
540
619
  id: depends
541
620
  continue-on-error: true
@@ -546,9 +625,7 @@ jobs:
546
625
  id: cmake_build
547
626
  run: |
548
627
  sysctl -a
549
- mkdir build
550
- cd build
551
- cmake -G Xcode .. \
628
+ cmake -B build -G Xcode \
552
629
  -DGGML_METAL_USE_BF16=ON \
553
630
  -DGGML_METAL_EMBED_LIBRARY=ON \
554
631
  -DLLAMA_BUILD_EXAMPLES=OFF \
@@ -557,7 +634,7 @@ jobs:
557
634
  -DCMAKE_SYSTEM_NAME=tvOS \
558
635
  -DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 \
559
636
  -DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=ggml
560
- cmake --build . --config Release -j $(sysctl -n hw.logicalcpu) -- CODE_SIGNING_ALLOWED=NO
637
+ cmake --build build --config Release -j $(sysctl -n hw.logicalcpu) -- CODE_SIGNING_ALLOWED=NO
561
638
 
562
639
  macOS-latest-swift:
563
640
  runs-on: macos-latest
@@ -571,6 +648,12 @@ jobs:
571
648
  id: checkout
572
649
  uses: actions/checkout@v4
573
650
 
651
+ - name: ccache
652
+ uses: hendrikmuhs/ccache-action@v1.2.16
653
+ with:
654
+ key: macOS-latest-swift
655
+ evict-old-files: 1d
656
+
574
657
  - name: Dependencies
575
658
  id: depends
576
659
  continue-on-error: true
@@ -581,17 +664,15 @@ jobs:
581
664
  id: cmake_build
582
665
  run: |
583
666
  sysctl -a
584
- mkdir build
585
- cd build
586
- cmake -G Xcode .. \
667
+ cmake -B build -G Xcode \
587
668
  -DGGML_METAL_USE_BF16=ON \
588
669
  -DGGML_METAL_EMBED_LIBRARY=ON \
589
670
  -DLLAMA_BUILD_EXAMPLES=OFF \
590
671
  -DLLAMA_BUILD_TESTS=OFF \
591
672
  -DLLAMA_BUILD_SERVER=OFF \
592
673
  -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64"
593
- cmake --build . --config Release -j $(sysctl -n hw.logicalcpu)
594
- sudo cmake --install . --config Release
674
+ cmake --build build --config Release -j $(sysctl -n hw.logicalcpu)
675
+ sudo cmake --install build --config Release
595
676
 
596
677
  - name: xcodebuild for swift package
597
678
  id: xcodebuild
@@ -612,6 +693,13 @@ jobs:
612
693
  - name: Clone
613
694
  uses: actions/checkout@v4
614
695
 
696
+ - name: ccache
697
+ uses: hendrikmuhs/ccache-action@v1.2.16
698
+ with:
699
+ key: windows-msys2
700
+ variant: sccache
701
+ evict-old-files: 1d
702
+
615
703
  - name: Setup ${{ matrix.sys }}
616
704
  uses: msys2/setup-msys2@v2
617
705
  with:
@@ -619,6 +707,7 @@ jobs:
619
707
  msystem: ${{matrix.sys}}
620
708
  install: >-
621
709
  base-devel
710
+ git
622
711
  mingw-w64-${{matrix.env}}-toolchain
623
712
  mingw-w64-${{matrix.env}}-cmake
624
713
  mingw-w64-${{matrix.env}}-openblas
@@ -679,6 +768,13 @@ jobs:
679
768
  with:
680
769
  fetch-depth: 0
681
770
 
771
+ - name: ccache
772
+ uses: hendrikmuhs/ccache-action@v1.2.16
773
+ with:
774
+ key: windows-latest-cmake-${{ matrix.build }}
775
+ variant: sccache
776
+ evict-old-files: 1d
777
+
682
778
  - name: Clone Kompute submodule
683
779
  id: clone_kompute
684
780
  if: ${{ matrix.build == 'kompute-x64' }}
@@ -718,21 +814,19 @@ jobs:
718
814
  run: |
719
815
  git clone https://github.com/KhronosGroup/OpenCL-Headers
720
816
  cd OpenCL-Headers
721
- mkdir build && cd build
722
- cmake .. `
817
+ cmake -B build `
723
818
  -DBUILD_TESTING=OFF `
724
819
  -DOPENCL_HEADERS_BUILD_TESTING=OFF `
725
820
  -DOPENCL_HEADERS_BUILD_CXX_TESTS=OFF `
726
821
  -DCMAKE_INSTALL_PREFIX="$env:RUNNER_TEMP/opencl-arm64-release"
727
- cmake --build . --target install
822
+ cmake --build build --target install
728
823
  git clone https://github.com/KhronosGroup/OpenCL-ICD-Loader
729
824
  cd OpenCL-ICD-Loader
730
- mkdir build-arm64-release && cd build-arm64-release
731
- cmake .. `
825
+ cmake -B build-arm64-release `
732
826
  -A arm64 `
733
827
  -DCMAKE_PREFIX_PATH="$env:RUNNER_TEMP/opencl-arm64-release" `
734
828
  -DCMAKE_INSTALL_PREFIX="$env:RUNNER_TEMP/opencl-arm64-release"
735
- cmake --build . --target install --config release
829
+ cmake --build build-arm64-release --target install --config release
736
830
 
737
831
  - name: Build
738
832
  id: cmake_build
@@ -817,6 +911,8 @@ jobs:
817
911
  - name: Clone
818
912
  id: checkout
819
913
  uses: actions/checkout@v4
914
+ with:
915
+ fetch-depth: 0
820
916
 
821
917
  - name: Install dependencies
822
918
  env:
@@ -825,9 +921,21 @@ jobs:
825
921
  apt update
826
922
  apt install -y cmake build-essential ninja-build libgomp1 git
827
923
 
924
+ - name: ccache
925
+ uses: hendrikmuhs/ccache-action@v1.2.16
926
+ with:
927
+ key: ubuntu-latest-cmake-cuda
928
+ evict-old-files: 1d
929
+
828
930
  - name: Build with CMake
829
931
  run: |
830
- cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DGGML_NATIVE=OFF -DGGML_CUDA=ON -DCMAKE_CUDA_ARCHITECTURES=89-real -DCMAKE_EXE_LINKER_FLAGS=-Wl,--allow-shlib-undefined -DLLAMA_FATAL_WARNINGS=ON
932
+ cmake -S . -B build -G Ninja \
933
+ -DCMAKE_BUILD_TYPE=Release \
934
+ -DCMAKE_CUDA_ARCHITECTURES=89-real \
935
+ -DCMAKE_EXE_LINKER_FLAGS=-Wl,--allow-shlib-undefined \
936
+ -DLLAMA_FATAL_WARNINGS=ON \
937
+ -DGGML_NATIVE=OFF \
938
+ -DGGML_CUDA=ON
831
939
  cmake --build build
832
940
 
833
941
  windows-2019-cmake-cuda:
@@ -845,6 +953,13 @@ jobs:
845
953
  with:
846
954
  fetch-depth: 0
847
955
 
956
+ - name: Install ccache
957
+ uses: hendrikmuhs/ccache-action@v1.2.16
958
+ with:
959
+ key: ${{ github.job }}-${{ matrix.cuda }}-${{ matrix.build }}
960
+ variant: sccache
961
+ evict-old-files: 1d
962
+
848
963
  - name: Install Cuda Toolkit 11.7
849
964
  if: ${{ matrix.cuda == '11.7' }}
850
965
  run: |
@@ -901,11 +1016,6 @@ jobs:
901
1016
  echo "CUDA_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
902
1017
  echo "CUDA_PATH_V12_4=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
903
1018
 
904
- - name: Install ccache
905
- uses: hendrikmuhs/ccache-action@v1.2
906
- with:
907
- key: ${{ github.job }}-${{ matrix.cuda }}-${{ matrix.build }}
908
-
909
1019
  - name: Install Ninja
910
1020
  id: install_ninja
911
1021
  run: |
@@ -916,7 +1026,11 @@ jobs:
916
1026
  shell: cmd
917
1027
  run: |
918
1028
  call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
919
- cmake -S . -B build -G "Ninja Multi-Config" -DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DGGML_CUDA=ON -DGGML_RPC=ON
1029
+ cmake -S . -B build -G "Ninja Multi-Config" ^
1030
+ -DLLAMA_BUILD_SERVER=ON ^
1031
+ -DGGML_NATIVE=OFF ^
1032
+ -DGGML_CUDA=ON ^
1033
+ -DGGML_RPC=ON
920
1034
  set /A NINJA_JOBS=%NUMBER_OF_PROCESSORS%-1
921
1035
  cmake --build build --config Release -j %NINJA_JOBS% -t ggml
922
1036
  cmake --build build --config Release
@@ -981,6 +1095,13 @@ jobs:
981
1095
  with:
982
1096
  fetch-depth: 0
983
1097
 
1098
+ - name: ccache
1099
+ uses: hendrikmuhs/ccache-action@v1.2.16
1100
+ with:
1101
+ key: windows-latest-cmake-sycl
1102
+ variant: sccache
1103
+ evict-old-files: 1d
1104
+
984
1105
  - name: Install
985
1106
  run: |
986
1107
  scripts/install-oneapi.bat $WINDOWS_BASEKIT_URL $WINDOWS_DPCPP_MKL
@@ -1060,16 +1181,22 @@ jobs:
1060
1181
  & 'C:\Program Files\AMD\ROCm\*\bin\clang.exe' --version
1061
1182
 
1062
1183
  - name: Install ccache
1063
- uses: hendrikmuhs/ccache-action@v1.2
1184
+ uses: hendrikmuhs/ccache-action@v1.2.16
1064
1185
  with:
1065
1186
  key: ${{ github.job }}
1187
+ evict-old-files: 1d
1066
1188
 
1067
1189
  - name: Build
1068
1190
  id: cmake_build
1069
1191
  run: |
1070
1192
  $env:HIP_PATH=$(Resolve-Path 'C:\Program Files\AMD\ROCm\*\bin\clang.exe' | split-path | split-path)
1071
1193
  $env:CMAKE_PREFIX_PATH="${env:HIP_PATH}"
1072
- cmake -G "Unix Makefiles" -B build -S . -DCMAKE_C_COMPILER="${env:HIP_PATH}\bin\clang.exe" -DCMAKE_CXX_COMPILER="${env:HIP_PATH}\bin\clang++.exe" -DGGML_HIP=ON -DCMAKE_BUILD_TYPE=Release -DGGML_RPC=ON
1194
+ cmake -G "Unix Makefiles" -B build -S . `
1195
+ -DCMAKE_C_COMPILER="${env:HIP_PATH}\bin\clang.exe" `
1196
+ -DCMAKE_CXX_COMPILER="${env:HIP_PATH}\bin\clang++.exe" `
1197
+ -DCMAKE_BUILD_TYPE=Release `
1198
+ -DGGML_HIP=ON `
1199
+ -DGGML_RPC=ON
1073
1200
  cmake --build build -j ${env:NUMBER_OF_PROCESSORS}
1074
1201
 
1075
1202
  windows-latest-cmake-hip-release:
@@ -1087,6 +1214,12 @@ jobs:
1087
1214
  with:
1088
1215
  fetch-depth: 0
1089
1216
 
1217
+ - name: ccache
1218
+ uses: hendrikmuhs/ccache-action@v1.2.16
1219
+ with:
1220
+ key: windows-latest-cmake-hip-release
1221
+ evict-old-files: 1d
1222
+
1090
1223
  - name: Install
1091
1224
  id: depends
1092
1225
  run: |
@@ -1107,7 +1240,13 @@ jobs:
1107
1240
  run: |
1108
1241
  $env:HIP_PATH=$(Resolve-Path 'C:\Program Files\AMD\ROCm\*\bin\clang.exe' | split-path | split-path)
1109
1242
  $env:CMAKE_PREFIX_PATH="${env:HIP_PATH}"
1110
- cmake -G "Unix Makefiles" -B build -S . -DCMAKE_C_COMPILER="${env:HIP_PATH}\bin\clang.exe" -DCMAKE_CXX_COMPILER="${env:HIP_PATH}\bin\clang++.exe" -DGGML_HIP=ON -DCMAKE_BUILD_TYPE=Release -DAMDGPU_TARGETS=${{ matrix.gpu_target }} -DGGML_RPC=ON
1243
+ cmake -G "Unix Makefiles" -B build -S . `
1244
+ -DCMAKE_C_COMPILER="${env:HIP_PATH}\bin\clang.exe" `
1245
+ -DCMAKE_CXX_COMPILER="${env:HIP_PATH}\bin\clang++.exe" `
1246
+ -DCMAKE_BUILD_TYPE=Release `
1247
+ -DAMDGPU_TARGETS=${{ matrix.gpu_target }} `
1248
+ -DGGML_HIP=ON `
1249
+ -DGGML_RPC=ON
1111
1250
  cmake --build build -j ${env:NUMBER_OF_PROCESSORS}
1112
1251
  md "build\bin\rocblas\library\"
1113
1252
  cp "${env:HIP_PATH}\bin\hipblas.dll" "build\bin\"
@@ -1149,9 +1288,7 @@ jobs:
1149
1288
  id: cmake_build
1150
1289
  run: |
1151
1290
  sysctl -a
1152
- mkdir build
1153
- cd build
1154
- cmake -G Xcode .. \
1291
+ cmake -B build -G Xcode \
1155
1292
  -DGGML_METAL_USE_BF16=ON \
1156
1293
  -DGGML_METAL_EMBED_LIBRARY=ON \
1157
1294
  -DLLAMA_BUILD_EXAMPLES=OFF \
@@ -1160,8 +1297,8 @@ jobs:
1160
1297
  -DCMAKE_SYSTEM_NAME=iOS \
1161
1298
  -DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 \
1162
1299
  -DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=ggml
1163
- cmake --build . --config Release -j $(sysctl -n hw.logicalcpu) -- CODE_SIGNING_ALLOWED=NO
1164
- sudo cmake --install . --config Release
1300
+ cmake --build build --config Release -j $(sysctl -n hw.logicalcpu) -- CODE_SIGNING_ALLOWED=NO
1301
+ sudo cmake --install build --config Release
1165
1302
 
1166
1303
  - name: xcodebuild for swift package
1167
1304
  id: xcodebuild
@@ -1178,6 +1315,12 @@ jobs:
1178
1315
  - name: Clone
1179
1316
  uses: actions/checkout@v4
1180
1317
 
1318
+ - name: ccache
1319
+ uses: hendrikmuhs/ccache-action@v1.2.16
1320
+ with:
1321
+ key: android-build
1322
+ evict-old-files: 1d
1323
+
1181
1324
  - name: Set up JDK
1182
1325
  uses: actions/setup-java@v3
1183
1326
  with:
@@ -1201,8 +1344,7 @@ jobs:
1201
1344
  runs-on: ubuntu-latest
1202
1345
 
1203
1346
  needs:
1204
- - ubuntu-latest-cmake
1205
- - macOS-latest-cmake
1347
+ - ubuntu-cpu-cmake
1206
1348
  - windows-latest-cmake
1207
1349
  - windows-2019-cmake-cuda
1208
1350
  - windows-latest-cmake-hip-release
@@ -1216,6 +1358,12 @@ jobs:
1216
1358
  with:
1217
1359
  fetch-depth: 0
1218
1360
 
1361
+ - name: ccache
1362
+ uses: hendrikmuhs/ccache-action@v1.2.16
1363
+ with:
1364
+ key: release
1365
+ evict-old-files: 1d
1366
+
1219
1367
  - name: Determine tag name
1220
1368
  id: tag
1221
1369
  shell: bash
@@ -1461,3 +1609,37 @@ jobs:
1461
1609
  # popd
1462
1610
  # emcmake cmake . -DCMAKE_BUILD_TYPE=${{ matrix.build }}
1463
1611
  # make
1612
+
1613
+ openEuler-latest-cmake-cann:
1614
+ if: ${{ github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'Ascend NPU') }}
1615
+ defaults:
1616
+ run:
1617
+ shell: bash -el {0}
1618
+ runs-on: ubuntu-24.04-arm
1619
+ strategy:
1620
+ matrix:
1621
+ cann:
1622
+ - '8.0.rc3.beta1-910b-openeuler22.03-py3.10'
1623
+ device:
1624
+ - 'ascend910b3'
1625
+ build:
1626
+ - 'Release'
1627
+ container: ascendai/cann:${{ matrix.cann }}
1628
+ steps:
1629
+ - name: Checkout
1630
+ uses: actions/checkout@v4
1631
+
1632
+ - name: Dependencies
1633
+ run: |
1634
+ yum update -y
1635
+ yum install -y git gcc gcc-c++ make cmake
1636
+
1637
+ - name: Build
1638
+ run: |
1639
+ export LD_LIBRARY_PATH=${ASCEND_TOOLKIT_HOME}/lib64:${ASCEND_TOOLKIT_HOME}/$(uname -m)-linux/devlib/:${LD_LIBRARY_PATH}
1640
+
1641
+ cmake -S . -B build \
1642
+ -DCMAKE_BUILD_TYPE=${{ matrix.build }} \
1643
+ -DGGML_CANN=on \
1644
+ -DSOC_TYPE=${{ matrix.device }}
1645
+ cmake --build build -j $(nproc)