@fugood/llama.node 0.6.2 → 1.0.0-beta.1

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 (378) hide show
  1. package/CMakeLists.txt +40 -30
  2. package/README.md +4 -1
  3. package/lib/binding.js +41 -29
  4. package/lib/binding.ts +26 -25
  5. package/package.json +45 -10
  6. package/scripts/build.js +47 -0
  7. package/scripts/llama.cpp.patch +109 -0
  8. package/src/anyascii.c +22223 -0
  9. package/src/anyascii.h +42 -0
  10. package/src/tts_utils.cpp +20 -7
  11. package/src/tts_utils.h +2 -0
  12. package/bin/darwin/arm64/llama-node.node +0 -0
  13. package/bin/darwin/x64/llama-node.node +0 -0
  14. package/bin/linux/arm64/llama-node.node +0 -0
  15. package/bin/linux/x64/llama-node.node +0 -0
  16. package/bin/linux-cuda/arm64/llama-node.node +0 -0
  17. package/bin/linux-cuda/x64/llama-node.node +0 -0
  18. package/bin/linux-vulkan/arm64/llama-node.node +0 -0
  19. package/bin/linux-vulkan/x64/llama-node.node +0 -0
  20. package/bin/win32/x64/llama-node.node +0 -0
  21. package/bin/win32/x64/node.lib +0 -0
  22. package/bin/win32-vulkan/arm64/llama-node.node +0 -0
  23. package/bin/win32-vulkan/arm64/node.lib +0 -0
  24. package/bin/win32-vulkan/x64/llama-node.node +0 -0
  25. package/bin/win32-vulkan/x64/node.lib +0 -0
  26. package/patches/node-api-headers+1.1.0.patch +0 -26
  27. package/src/llama.cpp/.github/workflows/build-linux-cross.yml +0 -233
  28. package/src/llama.cpp/.github/workflows/build.yml +0 -1078
  29. package/src/llama.cpp/.github/workflows/close-issue.yml +0 -28
  30. package/src/llama.cpp/.github/workflows/docker.yml +0 -178
  31. package/src/llama.cpp/.github/workflows/editorconfig.yml +0 -29
  32. package/src/llama.cpp/.github/workflows/gguf-publish.yml +0 -44
  33. package/src/llama.cpp/.github/workflows/labeler.yml +0 -17
  34. package/src/llama.cpp/.github/workflows/python-check-requirements.yml +0 -33
  35. package/src/llama.cpp/.github/workflows/python-lint.yml +0 -30
  36. package/src/llama.cpp/.github/workflows/python-type-check.yml +0 -40
  37. package/src/llama.cpp/.github/workflows/release.yml +0 -739
  38. package/src/llama.cpp/.github/workflows/server.yml +0 -237
  39. package/src/llama.cpp/.github/workflows/winget.yml +0 -42
  40. package/src/llama.cpp/cmake/arm64-apple-clang.cmake +0 -16
  41. package/src/llama.cpp/cmake/arm64-windows-llvm.cmake +0 -16
  42. package/src/llama.cpp/cmake/build-info.cmake +0 -64
  43. package/src/llama.cpp/cmake/common.cmake +0 -35
  44. package/src/llama.cpp/cmake/git-vars.cmake +0 -22
  45. package/src/llama.cpp/cmake/x64-windows-llvm.cmake +0 -5
  46. package/src/llama.cpp/common/build-info.cpp.in +0 -4
  47. package/src/llama.cpp/docs/build.md +0 -561
  48. package/src/llama.cpp/examples/CMakeLists.txt +0 -43
  49. package/src/llama.cpp/examples/batched/CMakeLists.txt +0 -5
  50. package/src/llama.cpp/examples/batched/batched.cpp +0 -246
  51. package/src/llama.cpp/examples/chat-13B.bat +0 -57
  52. package/src/llama.cpp/examples/convert-llama2c-to-ggml/CMakeLists.txt +0 -5
  53. package/src/llama.cpp/examples/convert-llama2c-to-ggml/convert-llama2c-to-ggml.cpp +0 -941
  54. package/src/llama.cpp/examples/deprecation-warning/deprecation-warning.cpp +0 -35
  55. package/src/llama.cpp/examples/embedding/CMakeLists.txt +0 -5
  56. package/src/llama.cpp/examples/embedding/embedding.cpp +0 -323
  57. package/src/llama.cpp/examples/eval-callback/CMakeLists.txt +0 -10
  58. package/src/llama.cpp/examples/eval-callback/eval-callback.cpp +0 -194
  59. package/src/llama.cpp/examples/gen-docs/CMakeLists.txt +0 -5
  60. package/src/llama.cpp/examples/gen-docs/gen-docs.cpp +0 -83
  61. package/src/llama.cpp/examples/gguf/CMakeLists.txt +0 -5
  62. package/src/llama.cpp/examples/gguf/gguf.cpp +0 -265
  63. package/src/llama.cpp/examples/gguf-hash/CMakeLists.txt +0 -22
  64. package/src/llama.cpp/examples/gguf-hash/deps/rotate-bits/rotate-bits.h +0 -46
  65. package/src/llama.cpp/examples/gguf-hash/deps/sha1/sha1.c +0 -295
  66. package/src/llama.cpp/examples/gguf-hash/deps/sha1/sha1.h +0 -52
  67. package/src/llama.cpp/examples/gguf-hash/deps/sha256/sha256.c +0 -221
  68. package/src/llama.cpp/examples/gguf-hash/deps/sha256/sha256.h +0 -24
  69. package/src/llama.cpp/examples/gguf-hash/deps/xxhash/xxhash.c +0 -42
  70. package/src/llama.cpp/examples/gguf-hash/deps/xxhash/xxhash.h +0 -7093
  71. package/src/llama.cpp/examples/gguf-hash/gguf-hash.cpp +0 -694
  72. package/src/llama.cpp/examples/gritlm/CMakeLists.txt +0 -5
  73. package/src/llama.cpp/examples/gritlm/gritlm.cpp +0 -229
  74. package/src/llama.cpp/examples/jeopardy/questions.txt +0 -100
  75. package/src/llama.cpp/examples/llama.android/app/build.gradle.kts +0 -65
  76. package/src/llama.cpp/examples/llama.android/build.gradle.kts +0 -6
  77. package/src/llama.cpp/examples/llama.android/llama/build.gradle.kts +0 -71
  78. package/src/llama.cpp/examples/llama.android/llama/src/main/cpp/CMakeLists.txt +0 -53
  79. package/src/llama.cpp/examples/llama.android/llama/src/main/cpp/llama-android.cpp +0 -452
  80. package/src/llama.cpp/examples/llama.android/settings.gradle.kts +0 -18
  81. package/src/llama.cpp/examples/lookahead/CMakeLists.txt +0 -5
  82. package/src/llama.cpp/examples/lookahead/lookahead.cpp +0 -472
  83. package/src/llama.cpp/examples/lookup/CMakeLists.txt +0 -23
  84. package/src/llama.cpp/examples/lookup/lookup-create.cpp +0 -40
  85. package/src/llama.cpp/examples/lookup/lookup-merge.cpp +0 -47
  86. package/src/llama.cpp/examples/lookup/lookup-stats.cpp +0 -157
  87. package/src/llama.cpp/examples/lookup/lookup.cpp +0 -242
  88. package/src/llama.cpp/examples/parallel/CMakeLists.txt +0 -5
  89. package/src/llama.cpp/examples/parallel/parallel.cpp +0 -492
  90. package/src/llama.cpp/examples/passkey/CMakeLists.txt +0 -5
  91. package/src/llama.cpp/examples/passkey/passkey.cpp +0 -277
  92. package/src/llama.cpp/examples/retrieval/CMakeLists.txt +0 -5
  93. package/src/llama.cpp/examples/retrieval/retrieval.cpp +0 -304
  94. package/src/llama.cpp/examples/save-load-state/CMakeLists.txt +0 -5
  95. package/src/llama.cpp/examples/save-load-state/save-load-state.cpp +0 -246
  96. package/src/llama.cpp/examples/simple/CMakeLists.txt +0 -5
  97. package/src/llama.cpp/examples/simple/simple.cpp +0 -206
  98. package/src/llama.cpp/examples/simple-chat/CMakeLists.txt +0 -5
  99. package/src/llama.cpp/examples/simple-chat/simple-chat.cpp +0 -206
  100. package/src/llama.cpp/examples/simple-cmake-pkg/CMakeLists.txt +0 -11
  101. package/src/llama.cpp/examples/speculative/CMakeLists.txt +0 -5
  102. package/src/llama.cpp/examples/speculative/speculative.cpp +0 -644
  103. package/src/llama.cpp/examples/speculative-simple/CMakeLists.txt +0 -5
  104. package/src/llama.cpp/examples/speculative-simple/speculative-simple.cpp +0 -261
  105. package/src/llama.cpp/examples/sycl/CMakeLists.txt +0 -9
  106. package/src/llama.cpp/examples/sycl/build.sh +0 -23
  107. package/src/llama.cpp/examples/sycl/ls-sycl-device.cpp +0 -13
  108. package/src/llama.cpp/examples/sycl/run-llama2.sh +0 -27
  109. package/src/llama.cpp/examples/sycl/run-llama3.sh +0 -28
  110. package/src/llama.cpp/examples/sycl/win-build-sycl.bat +0 -33
  111. package/src/llama.cpp/examples/sycl/win-run-llama2.bat +0 -9
  112. package/src/llama.cpp/examples/sycl/win-run-llama3.bat +0 -9
  113. package/src/llama.cpp/examples/training/CMakeLists.txt +0 -5
  114. package/src/llama.cpp/examples/training/finetune.cpp +0 -96
  115. package/src/llama.cpp/ggml/cmake/GitVars.cmake +0 -22
  116. package/src/llama.cpp/ggml/cmake/common.cmake +0 -26
  117. package/src/llama.cpp/ggml/src/ggml-alloc.c +0 -1042
  118. package/src/llama.cpp/ggml/src/ggml-backend-impl.h +0 -255
  119. package/src/llama.cpp/ggml/src/ggml-backend-reg.cpp +0 -586
  120. package/src/llama.cpp/ggml/src/ggml-backend.cpp +0 -2008
  121. package/src/llama.cpp/ggml/src/ggml-blas/CMakeLists.txt +0 -87
  122. package/src/llama.cpp/ggml/src/ggml-blas/ggml-blas.cpp +0 -517
  123. package/src/llama.cpp/ggml/src/ggml-cann/CMakeLists.txt +0 -74
  124. package/src/llama.cpp/ggml/src/ggml-cann/acl_tensor.cpp +0 -179
  125. package/src/llama.cpp/ggml/src/ggml-cann/acl_tensor.h +0 -258
  126. package/src/llama.cpp/ggml/src/ggml-cann/aclnn_ops.cpp +0 -2863
  127. package/src/llama.cpp/ggml/src/ggml-cann/aclnn_ops.h +0 -1110
  128. package/src/llama.cpp/ggml/src/ggml-cann/common.h +0 -420
  129. package/src/llama.cpp/ggml/src/ggml-cann/ggml-cann.cpp +0 -2570
  130. package/src/llama.cpp/ggml/src/ggml-common.h +0 -1857
  131. package/src/llama.cpp/ggml/src/ggml-cpu/cmake/FindSIMD.cmake +0 -100
  132. package/src/llama.cpp/ggml/src/ggml-cuda/CMakeLists.txt +0 -184
  133. package/src/llama.cpp/ggml/src/ggml-cuda/vendors/cuda.h +0 -15
  134. package/src/llama.cpp/ggml/src/ggml-cuda/vendors/hip.h +0 -243
  135. package/src/llama.cpp/ggml/src/ggml-cuda/vendors/musa.h +0 -140
  136. package/src/llama.cpp/ggml/src/ggml-hip/CMakeLists.txt +0 -131
  137. package/src/llama.cpp/ggml/src/ggml-impl.h +0 -601
  138. package/src/llama.cpp/ggml/src/ggml-kompute/CMakeLists.txt +0 -166
  139. package/src/llama.cpp/ggml/src/ggml-kompute/ggml-kompute.cpp +0 -2251
  140. package/src/llama.cpp/ggml/src/ggml-metal/CMakeLists.txt +0 -120
  141. package/src/llama.cpp/ggml/src/ggml-metal/ggml-metal-impl.h +0 -622
  142. package/src/llama.cpp/ggml/src/ggml-musa/CMakeLists.txt +0 -113
  143. package/src/llama.cpp/ggml/src/ggml-opencl/CMakeLists.txt +0 -96
  144. package/src/llama.cpp/ggml/src/ggml-opencl/ggml-opencl.cpp +0 -5124
  145. package/src/llama.cpp/ggml/src/ggml-opt.cpp +0 -1037
  146. package/src/llama.cpp/ggml/src/ggml-quants.c +0 -5232
  147. package/src/llama.cpp/ggml/src/ggml-quants.h +0 -100
  148. package/src/llama.cpp/ggml/src/ggml-rpc/CMakeLists.txt +0 -9
  149. package/src/llama.cpp/ggml/src/ggml-rpc/ggml-rpc.cpp +0 -1813
  150. package/src/llama.cpp/ggml/src/ggml-sycl/CMakeLists.txt +0 -189
  151. package/src/llama.cpp/ggml/src/ggml-sycl/backend.hpp +0 -37
  152. package/src/llama.cpp/ggml/src/ggml-sycl/binbcast.cpp +0 -239
  153. package/src/llama.cpp/ggml/src/ggml-sycl/binbcast.hpp +0 -39
  154. package/src/llama.cpp/ggml/src/ggml-sycl/common.cpp +0 -83
  155. package/src/llama.cpp/ggml/src/ggml-sycl/common.hpp +0 -493
  156. package/src/llama.cpp/ggml/src/ggml-sycl/concat.cpp +0 -197
  157. package/src/llama.cpp/ggml/src/ggml-sycl/concat.hpp +0 -20
  158. package/src/llama.cpp/ggml/src/ggml-sycl/conv.cpp +0 -100
  159. package/src/llama.cpp/ggml/src/ggml-sycl/conv.hpp +0 -20
  160. package/src/llama.cpp/ggml/src/ggml-sycl/convert.cpp +0 -623
  161. package/src/llama.cpp/ggml/src/ggml-sycl/convert.hpp +0 -34
  162. package/src/llama.cpp/ggml/src/ggml-sycl/cpy.cpp +0 -701
  163. package/src/llama.cpp/ggml/src/ggml-sycl/cpy.hpp +0 -11
  164. package/src/llama.cpp/ggml/src/ggml-sycl/dequantize.hpp +0 -791
  165. package/src/llama.cpp/ggml/src/ggml-sycl/dmmv.cpp +0 -1160
  166. package/src/llama.cpp/ggml/src/ggml-sycl/dmmv.hpp +0 -27
  167. package/src/llama.cpp/ggml/src/ggml-sycl/dpct/helper.hpp +0 -2957
  168. package/src/llama.cpp/ggml/src/ggml-sycl/element_wise.cpp +0 -1536
  169. package/src/llama.cpp/ggml/src/ggml-sycl/element_wise.hpp +0 -75
  170. package/src/llama.cpp/ggml/src/ggml-sycl/gemm.hpp +0 -99
  171. package/src/llama.cpp/ggml/src/ggml-sycl/getrows.cpp +0 -311
  172. package/src/llama.cpp/ggml/src/ggml-sycl/getrows.hpp +0 -20
  173. package/src/llama.cpp/ggml/src/ggml-sycl/ggml-sycl.cpp +0 -4443
  174. package/src/llama.cpp/ggml/src/ggml-sycl/gla.cpp +0 -105
  175. package/src/llama.cpp/ggml/src/ggml-sycl/gla.hpp +0 -8
  176. package/src/llama.cpp/ggml/src/ggml-sycl/im2col.cpp +0 -136
  177. package/src/llama.cpp/ggml/src/ggml-sycl/im2col.hpp +0 -21
  178. package/src/llama.cpp/ggml/src/ggml-sycl/mmq.cpp +0 -3030
  179. package/src/llama.cpp/ggml/src/ggml-sycl/mmq.hpp +0 -33
  180. package/src/llama.cpp/ggml/src/ggml-sycl/mmvq.cpp +0 -1108
  181. package/src/llama.cpp/ggml/src/ggml-sycl/mmvq.hpp +0 -27
  182. package/src/llama.cpp/ggml/src/ggml-sycl/norm.cpp +0 -474
  183. package/src/llama.cpp/ggml/src/ggml-sycl/norm.hpp +0 -26
  184. package/src/llama.cpp/ggml/src/ggml-sycl/outprod.cpp +0 -46
  185. package/src/llama.cpp/ggml/src/ggml-sycl/outprod.hpp +0 -10
  186. package/src/llama.cpp/ggml/src/ggml-sycl/presets.hpp +0 -74
  187. package/src/llama.cpp/ggml/src/ggml-sycl/quants.hpp +0 -83
  188. package/src/llama.cpp/ggml/src/ggml-sycl/rope.cpp +0 -362
  189. package/src/llama.cpp/ggml/src/ggml-sycl/rope.hpp +0 -20
  190. package/src/llama.cpp/ggml/src/ggml-sycl/softmax.cpp +0 -264
  191. package/src/llama.cpp/ggml/src/ggml-sycl/softmax.hpp +0 -20
  192. package/src/llama.cpp/ggml/src/ggml-sycl/sycl_hw.cpp +0 -13
  193. package/src/llama.cpp/ggml/src/ggml-sycl/sycl_hw.hpp +0 -23
  194. package/src/llama.cpp/ggml/src/ggml-sycl/tsembd.cpp +0 -73
  195. package/src/llama.cpp/ggml/src/ggml-sycl/tsembd.hpp +0 -20
  196. package/src/llama.cpp/ggml/src/ggml-sycl/vecdotq.hpp +0 -1215
  197. package/src/llama.cpp/ggml/src/ggml-sycl/wkv.cpp +0 -305
  198. package/src/llama.cpp/ggml/src/ggml-sycl/wkv.hpp +0 -10
  199. package/src/llama.cpp/ggml/src/ggml-threading.cpp +0 -12
  200. package/src/llama.cpp/ggml/src/ggml-threading.h +0 -14
  201. package/src/llama.cpp/ggml/src/ggml-vulkan/CMakeLists.txt +0 -196
  202. package/src/llama.cpp/ggml/src/ggml-vulkan/ggml-vulkan.cpp +0 -10699
  203. package/src/llama.cpp/ggml/src/ggml-vulkan/vulkan-shaders/CMakeLists.txt +0 -39
  204. package/src/llama.cpp/ggml/src/ggml-vulkan/vulkan-shaders/vulkan-shaders-gen.cpp +0 -751
  205. package/src/llama.cpp/ggml/src/ggml.c +0 -6550
  206. package/src/llama.cpp/ggml/src/gguf.cpp +0 -1330
  207. package/src/llama.cpp/models/.editorconfig +0 -1
  208. package/src/llama.cpp/models/ggml-vocab-aquila.gguf +0 -0
  209. package/src/llama.cpp/models/ggml-vocab-baichuan.gguf +0 -0
  210. package/src/llama.cpp/models/ggml-vocab-bert-bge.gguf +0 -0
  211. package/src/llama.cpp/models/ggml-vocab-bert-bge.gguf.inp +0 -112
  212. package/src/llama.cpp/models/ggml-vocab-bert-bge.gguf.out +0 -46
  213. package/src/llama.cpp/models/ggml-vocab-chameleon.gguf.inp +0 -112
  214. package/src/llama.cpp/models/ggml-vocab-chameleon.gguf.out +0 -46
  215. package/src/llama.cpp/models/ggml-vocab-command-r.gguf +0 -0
  216. package/src/llama.cpp/models/ggml-vocab-command-r.gguf.inp +0 -112
  217. package/src/llama.cpp/models/ggml-vocab-command-r.gguf.out +0 -46
  218. package/src/llama.cpp/models/ggml-vocab-deepseek-coder.gguf +0 -0
  219. package/src/llama.cpp/models/ggml-vocab-deepseek-coder.gguf.inp +0 -112
  220. package/src/llama.cpp/models/ggml-vocab-deepseek-coder.gguf.out +0 -46
  221. package/src/llama.cpp/models/ggml-vocab-deepseek-llm.gguf +0 -0
  222. package/src/llama.cpp/models/ggml-vocab-deepseek-llm.gguf.inp +0 -112
  223. package/src/llama.cpp/models/ggml-vocab-deepseek-llm.gguf.out +0 -46
  224. package/src/llama.cpp/models/ggml-vocab-deepseek-r1-qwen.gguf.inp +0 -112
  225. package/src/llama.cpp/models/ggml-vocab-deepseek-r1-qwen.gguf.out +0 -46
  226. package/src/llama.cpp/models/ggml-vocab-falcon.gguf +0 -0
  227. package/src/llama.cpp/models/ggml-vocab-falcon.gguf.inp +0 -112
  228. package/src/llama.cpp/models/ggml-vocab-falcon.gguf.out +0 -46
  229. package/src/llama.cpp/models/ggml-vocab-gpt-2.gguf +0 -0
  230. package/src/llama.cpp/models/ggml-vocab-gpt-2.gguf.inp +0 -112
  231. package/src/llama.cpp/models/ggml-vocab-gpt-2.gguf.out +0 -46
  232. package/src/llama.cpp/models/ggml-vocab-gpt-4o.gguf.inp +0 -112
  233. package/src/llama.cpp/models/ggml-vocab-gpt-4o.gguf.out +0 -46
  234. package/src/llama.cpp/models/ggml-vocab-gpt-neox.gguf +0 -0
  235. package/src/llama.cpp/models/ggml-vocab-llama-bpe.gguf +0 -0
  236. package/src/llama.cpp/models/ggml-vocab-llama-bpe.gguf.inp +0 -112
  237. package/src/llama.cpp/models/ggml-vocab-llama-bpe.gguf.out +0 -46
  238. package/src/llama.cpp/models/ggml-vocab-llama-spm.gguf +0 -0
  239. package/src/llama.cpp/models/ggml-vocab-llama-spm.gguf.inp +0 -112
  240. package/src/llama.cpp/models/ggml-vocab-llama-spm.gguf.out +0 -46
  241. package/src/llama.cpp/models/ggml-vocab-llama4.gguf.inp +0 -112
  242. package/src/llama.cpp/models/ggml-vocab-llama4.gguf.out +0 -46
  243. package/src/llama.cpp/models/ggml-vocab-mpt.gguf +0 -0
  244. package/src/llama.cpp/models/ggml-vocab-mpt.gguf.inp +0 -112
  245. package/src/llama.cpp/models/ggml-vocab-mpt.gguf.out +0 -46
  246. package/src/llama.cpp/models/ggml-vocab-phi-3.gguf +0 -0
  247. package/src/llama.cpp/models/ggml-vocab-phi-3.gguf.inp +0 -112
  248. package/src/llama.cpp/models/ggml-vocab-phi-3.gguf.out +0 -46
  249. package/src/llama.cpp/models/ggml-vocab-pixtral.gguf.inp +0 -112
  250. package/src/llama.cpp/models/ggml-vocab-pixtral.gguf.out +0 -46
  251. package/src/llama.cpp/models/ggml-vocab-qwen2.gguf +0 -0
  252. package/src/llama.cpp/models/ggml-vocab-qwen2.gguf.inp +0 -112
  253. package/src/llama.cpp/models/ggml-vocab-qwen2.gguf.out +0 -46
  254. package/src/llama.cpp/models/ggml-vocab-refact.gguf +0 -0
  255. package/src/llama.cpp/models/ggml-vocab-refact.gguf.inp +0 -112
  256. package/src/llama.cpp/models/ggml-vocab-refact.gguf.out +0 -46
  257. package/src/llama.cpp/models/ggml-vocab-roberta-bpe.gguf.inp +0 -112
  258. package/src/llama.cpp/models/ggml-vocab-roberta-bpe.gguf.out +0 -46
  259. package/src/llama.cpp/models/ggml-vocab-starcoder.gguf +0 -0
  260. package/src/llama.cpp/models/ggml-vocab-starcoder.gguf.inp +0 -112
  261. package/src/llama.cpp/models/ggml-vocab-starcoder.gguf.out +0 -46
  262. package/src/llama.cpp/pocs/CMakeLists.txt +0 -14
  263. package/src/llama.cpp/pocs/vdot/CMakeLists.txt +0 -9
  264. package/src/llama.cpp/pocs/vdot/q8dot.cpp +0 -173
  265. package/src/llama.cpp/pocs/vdot/vdot.cpp +0 -311
  266. package/src/llama.cpp/prompts/LLM-questions.txt +0 -49
  267. package/src/llama.cpp/prompts/alpaca.txt +0 -1
  268. package/src/llama.cpp/prompts/assistant.txt +0 -31
  269. package/src/llama.cpp/prompts/chat-with-baichuan.txt +0 -4
  270. package/src/llama.cpp/prompts/chat-with-bob.txt +0 -7
  271. package/src/llama.cpp/prompts/chat-with-qwen.txt +0 -1
  272. package/src/llama.cpp/prompts/chat-with-vicuna-v0.txt +0 -7
  273. package/src/llama.cpp/prompts/chat-with-vicuna-v1.txt +0 -7
  274. package/src/llama.cpp/prompts/chat.txt +0 -28
  275. package/src/llama.cpp/prompts/dan-modified.txt +0 -1
  276. package/src/llama.cpp/prompts/dan.txt +0 -1
  277. package/src/llama.cpp/prompts/mnemonics.txt +0 -93
  278. package/src/llama.cpp/prompts/parallel-questions.txt +0 -43
  279. package/src/llama.cpp/prompts/reason-act.txt +0 -18
  280. package/src/llama.cpp/requirements/requirements-all.txt +0 -15
  281. package/src/llama.cpp/requirements/requirements-compare-llama-bench.txt +0 -2
  282. package/src/llama.cpp/requirements/requirements-convert_hf_to_gguf.txt +0 -7
  283. package/src/llama.cpp/requirements/requirements-convert_hf_to_gguf_update.txt +0 -7
  284. package/src/llama.cpp/requirements/requirements-convert_legacy_llama.txt +0 -5
  285. package/src/llama.cpp/requirements/requirements-convert_llama_ggml_to_gguf.txt +0 -1
  286. package/src/llama.cpp/requirements/requirements-convert_lora_to_gguf.txt +0 -4
  287. package/src/llama.cpp/requirements/requirements-gguf_editor_gui.txt +0 -3
  288. package/src/llama.cpp/requirements/requirements-pydantic.txt +0 -3
  289. package/src/llama.cpp/requirements/requirements-test-tokenizer-random.txt +0 -1
  290. package/src/llama.cpp/requirements/requirements-tool_bench.txt +0 -12
  291. package/src/llama.cpp/requirements.txt +0 -13
  292. package/src/llama.cpp/scripts/build-info.sh +0 -30
  293. package/src/llama.cpp/scripts/install-oneapi.bat +0 -19
  294. package/src/llama.cpp/scripts/xxd.cmake +0 -16
  295. package/src/llama.cpp/tests/CMakeLists.txt +0 -177
  296. package/src/llama.cpp/tests/get-model.cpp +0 -21
  297. package/src/llama.cpp/tests/get-model.h +0 -2
  298. package/src/llama.cpp/tests/test-arg-parser.cpp +0 -178
  299. package/src/llama.cpp/tests/test-autorelease.cpp +0 -24
  300. package/src/llama.cpp/tests/test-backend-ops.cpp +0 -4793
  301. package/src/llama.cpp/tests/test-barrier.cpp +0 -94
  302. package/src/llama.cpp/tests/test-c.c +0 -7
  303. package/src/llama.cpp/tests/test-chat-template.cpp +0 -417
  304. package/src/llama.cpp/tests/test-chat.cpp +0 -985
  305. package/src/llama.cpp/tests/test-double-float.cpp +0 -57
  306. package/src/llama.cpp/tests/test-gbnf-validator.cpp +0 -109
  307. package/src/llama.cpp/tests/test-gguf.cpp +0 -1338
  308. package/src/llama.cpp/tests/test-grammar-integration.cpp +0 -1308
  309. package/src/llama.cpp/tests/test-grammar-llguidance.cpp +0 -1201
  310. package/src/llama.cpp/tests/test-grammar-parser.cpp +0 -519
  311. package/src/llama.cpp/tests/test-json-schema-to-grammar.cpp +0 -1304
  312. package/src/llama.cpp/tests/test-llama-grammar.cpp +0 -408
  313. package/src/llama.cpp/tests/test-log.cpp +0 -39
  314. package/src/llama.cpp/tests/test-model-load-cancel.cpp +0 -27
  315. package/src/llama.cpp/tests/test-mtmd-c-api.c +0 -63
  316. package/src/llama.cpp/tests/test-opt.cpp +0 -904
  317. package/src/llama.cpp/tests/test-quantize-fns.cpp +0 -186
  318. package/src/llama.cpp/tests/test-quantize-perf.cpp +0 -365
  319. package/src/llama.cpp/tests/test-quantize-stats.cpp +0 -424
  320. package/src/llama.cpp/tests/test-regex-partial.cpp +0 -288
  321. package/src/llama.cpp/tests/test-rope.cpp +0 -262
  322. package/src/llama.cpp/tests/test-sampling.cpp +0 -399
  323. package/src/llama.cpp/tests/test-tokenizer-0.cpp +0 -312
  324. package/src/llama.cpp/tests/test-tokenizer-1-bpe.cpp +0 -155
  325. package/src/llama.cpp/tests/test-tokenizer-1-spm.cpp +0 -125
  326. package/src/llama.cpp/tools/CMakeLists.txt +0 -39
  327. package/src/llama.cpp/tools/batched-bench/CMakeLists.txt +0 -5
  328. package/src/llama.cpp/tools/batched-bench/batched-bench.cpp +0 -204
  329. package/src/llama.cpp/tools/cvector-generator/CMakeLists.txt +0 -5
  330. package/src/llama.cpp/tools/cvector-generator/completions.txt +0 -582
  331. package/src/llama.cpp/tools/cvector-generator/cvector-generator.cpp +0 -508
  332. package/src/llama.cpp/tools/cvector-generator/mean.hpp +0 -48
  333. package/src/llama.cpp/tools/cvector-generator/negative.txt +0 -4
  334. package/src/llama.cpp/tools/cvector-generator/pca.hpp +0 -315
  335. package/src/llama.cpp/tools/cvector-generator/positive.txt +0 -4
  336. package/src/llama.cpp/tools/export-lora/CMakeLists.txt +0 -5
  337. package/src/llama.cpp/tools/export-lora/export-lora.cpp +0 -434
  338. package/src/llama.cpp/tools/gguf-split/CMakeLists.txt +0 -5
  339. package/src/llama.cpp/tools/gguf-split/gguf-split.cpp +0 -583
  340. package/src/llama.cpp/tools/imatrix/CMakeLists.txt +0 -5
  341. package/src/llama.cpp/tools/imatrix/imatrix.cpp +0 -667
  342. package/src/llama.cpp/tools/llama-bench/CMakeLists.txt +0 -5
  343. package/src/llama.cpp/tools/llama-bench/llama-bench.cpp +0 -2024
  344. package/src/llama.cpp/tools/main/CMakeLists.txt +0 -5
  345. package/src/llama.cpp/tools/main/main.cpp +0 -977
  346. package/src/llama.cpp/tools/mtmd/CMakeLists.txt +0 -58
  347. package/src/llama.cpp/tools/mtmd/clip-impl.h +0 -462
  348. package/src/llama.cpp/tools/mtmd/clip.cpp +0 -4024
  349. package/src/llama.cpp/tools/mtmd/clip.h +0 -101
  350. package/src/llama.cpp/tools/mtmd/deprecation-warning.cpp +0 -22
  351. package/src/llama.cpp/tools/mtmd/miniaudio.h +0 -93468
  352. package/src/llama.cpp/tools/mtmd/mtmd-audio.cpp +0 -855
  353. package/src/llama.cpp/tools/mtmd/mtmd-audio.h +0 -62
  354. package/src/llama.cpp/tools/mtmd/mtmd-cli.cpp +0 -377
  355. package/src/llama.cpp/tools/mtmd/mtmd-helper.cpp +0 -297
  356. package/src/llama.cpp/tools/mtmd/mtmd.cpp +0 -942
  357. package/src/llama.cpp/tools/mtmd/mtmd.h +0 -362
  358. package/src/llama.cpp/tools/mtmd/requirements.txt +0 -5
  359. package/src/llama.cpp/tools/perplexity/CMakeLists.txt +0 -5
  360. package/src/llama.cpp/tools/perplexity/perplexity.cpp +0 -2063
  361. package/src/llama.cpp/tools/quantize/CMakeLists.txt +0 -6
  362. package/src/llama.cpp/tools/quantize/quantize.cpp +0 -519
  363. package/src/llama.cpp/tools/rpc/CMakeLists.txt +0 -4
  364. package/src/llama.cpp/tools/rpc/rpc-server.cpp +0 -322
  365. package/src/llama.cpp/tools/run/CMakeLists.txt +0 -16
  366. package/src/llama.cpp/tools/run/linenoise.cpp/linenoise.cpp +0 -1995
  367. package/src/llama.cpp/tools/run/linenoise.cpp/linenoise.h +0 -137
  368. package/src/llama.cpp/tools/run/run.cpp +0 -1261
  369. package/src/llama.cpp/tools/server/CMakeLists.txt +0 -51
  370. package/src/llama.cpp/tools/server/bench/requirements.txt +0 -2
  371. package/src/llama.cpp/tools/server/httplib.h +0 -10506
  372. package/src/llama.cpp/tools/server/server.cpp +0 -4966
  373. package/src/llama.cpp/tools/server/tests/requirements.txt +0 -8
  374. package/src/llama.cpp/tools/server/utils.hpp +0 -1337
  375. package/src/llama.cpp/tools/tokenize/CMakeLists.txt +0 -5
  376. package/src/llama.cpp/tools/tokenize/tokenize.cpp +0 -416
  377. package/src/llama.cpp/tools/tts/CMakeLists.txt +0 -5
  378. package/src/llama.cpp/tools/tts/tts.cpp +0 -1092
@@ -1,622 +0,0 @@
1
- #ifndef GGML_METAL_IMPL
2
- #define GGML_METAL_IMPL
3
-
4
- // kernel parameters for mat-vec threadgroups
5
- //
6
- // N_R0: number of src0 rows to process per simdgroup
7
- // N_SG: number of simdgroups per threadgroup
8
- //
9
- // TODO: for optimal performance, become function of the device and work size
10
-
11
- #define N_R0_Q4_0 4
12
- #define N_SG_Q4_0 2
13
-
14
- #define N_R0_Q4_1 4
15
- #define N_SG_Q4_1 2
16
-
17
- #define N_R0_Q5_0 4
18
- #define N_SG_Q5_0 2
19
-
20
- #define N_R0_Q5_1 4
21
- #define N_SG_Q5_1 2
22
-
23
- #define N_R0_Q8_0 4
24
- #define N_SG_Q8_0 2
25
-
26
- #define N_R0_Q2_K 4
27
- #define N_SG_Q2_K 2
28
-
29
- #define N_R0_Q3_K 2
30
- #define N_SG_Q3_K 2
31
-
32
- #define N_R0_Q4_K 4
33
- #define N_SG_Q4_K 2
34
-
35
- #define N_R0_Q5_K 2
36
- #define N_SG_Q5_K 2
37
-
38
- #define N_R0_Q6_K 1
39
- #define N_SG_Q6_K 2
40
-
41
- #define N_R0_IQ1_S 4
42
- #define N_SG_IQ1_S 2
43
-
44
- #define N_R0_IQ1_M 4
45
- #define N_SG_IQ1_M 2
46
-
47
- #define N_R0_IQ2_XXS 4
48
- #define N_SG_IQ2_XXS 2
49
-
50
- #define N_R0_IQ2_XS 4
51
- #define N_SG_IQ2_XS 2
52
-
53
- #define N_R0_IQ2_S 4
54
- #define N_SG_IQ2_S 2
55
-
56
- #define N_R0_IQ3_XXS 4
57
- #define N_SG_IQ3_XXS 2
58
-
59
- #define N_R0_IQ3_S 4
60
- #define N_SG_IQ3_S 2
61
-
62
- #define N_R0_IQ4_NL 2
63
- #define N_SG_IQ4_NL 2
64
-
65
- #define N_R0_IQ4_XS 2
66
- #define N_SG_IQ4_XS 2
67
-
68
- // kernel argument structs
69
- //
70
- // - element counters (e.g. ne00) typically use int32_t to reduce register usage
71
- // however, be careful from int overflows when using those in the kernel implementation
72
- //
73
- // - strides (e.g. nb00) use uint64_t
74
-
75
- typedef struct {
76
- int32_t ne00;
77
- int32_t ne01;
78
- int32_t ne02;
79
- int32_t ne03;
80
- uint64_t nb00;
81
- uint64_t nb01;
82
- uint64_t nb02;
83
- uint64_t nb03;
84
- int32_t ne10;
85
- int32_t ne11;
86
- int32_t ne12;
87
- int32_t ne13;
88
- uint64_t nb10;
89
- uint64_t nb11;
90
- uint64_t nb12;
91
- uint64_t nb13;
92
- int32_t ne0;
93
- int32_t ne1;
94
- int32_t ne2;
95
- int32_t ne3;
96
- uint64_t nb0;
97
- uint64_t nb1;
98
- uint64_t nb2;
99
- uint64_t nb3;
100
- int32_t dim;
101
- } ggml_metal_kargs_concat;
102
-
103
- typedef struct {
104
- int32_t ne00;
105
- int32_t ne01;
106
- int32_t ne02;
107
- int32_t ne03;
108
- uint64_t nb00;
109
- uint64_t nb01;
110
- uint64_t nb02;
111
- uint64_t nb03;
112
- int32_t ne10;
113
- int32_t ne11;
114
- int32_t ne12;
115
- int32_t ne13;
116
- uint64_t nb10;
117
- uint64_t nb11;
118
- uint64_t nb12;
119
- uint64_t nb13;
120
- int32_t ne0;
121
- int32_t ne1;
122
- int32_t ne2;
123
- int32_t ne3;
124
- uint64_t nb0;
125
- uint64_t nb1;
126
- uint64_t nb2;
127
- uint64_t nb3;
128
- uint64_t offs;
129
- } ggml_metal_kargs_bin;
130
-
131
- typedef struct {
132
- int32_t ne00;
133
- int32_t ne01;
134
- int32_t ne02;
135
- int32_t ne03;
136
- uint64_t nb00;
137
- uint64_t nb01;
138
- uint64_t nb02;
139
- uint64_t nb03;
140
- int32_t ne0;
141
- int32_t ne1;
142
- int32_t ne2;
143
- int32_t ne3;
144
- uint64_t nb0;
145
- uint64_t nb1;
146
- uint64_t nb2;
147
- uint64_t nb3;
148
- } ggml_metal_kargs_repeat;
149
-
150
- typedef struct {
151
- int64_t ne00;
152
- int64_t ne01;
153
- int64_t ne02;
154
- int64_t ne03;
155
- uint64_t nb00;
156
- uint64_t nb01;
157
- uint64_t nb02;
158
- uint64_t nb03;
159
- int64_t ne0;
160
- int64_t ne1;
161
- int64_t ne2;
162
- int64_t ne3;
163
- uint64_t nb0;
164
- uint64_t nb1;
165
- uint64_t nb2;
166
- uint64_t nb3;
167
- } ggml_metal_kargs_cpy;
168
-
169
- typedef struct {
170
- int64_t ne10;
171
- int64_t ne11;
172
- int64_t ne12;
173
- uint64_t nb10;
174
- uint64_t nb11;
175
- uint64_t nb12;
176
- uint64_t nb13;
177
- uint64_t nb1;
178
- uint64_t nb2;
179
- uint64_t nb3;
180
- uint64_t offs;
181
- bool inplace;
182
- } ggml_metal_kargs_set;
183
-
184
- typedef struct {
185
- int32_t ne00;
186
- int32_t ne01;
187
- int32_t ne02;
188
- int32_t ne03;
189
- uint64_t nb00;
190
- uint64_t nb01;
191
- uint64_t nb02;
192
- uint64_t nb03;
193
- int32_t ne0;
194
- int32_t ne1;
195
- int32_t ne2;
196
- int32_t ne3;
197
- uint64_t nb0;
198
- uint64_t nb1;
199
- uint64_t nb2;
200
- uint64_t nb3;
201
- int32_t n_past;
202
- int32_t n_dims;
203
- int32_t n_ctx_orig;
204
- float freq_base;
205
- float freq_scale;
206
- float ext_factor;
207
- float attn_factor;
208
- float beta_fast;
209
- float beta_slow;
210
- int32_t sect_0;
211
- int32_t sect_1;
212
- int32_t sect_2;
213
- int32_t sect_3;
214
- } ggml_metal_kargs_rope;
215
-
216
- typedef struct {
217
- int32_t ne01;
218
- int32_t ne02;
219
- int32_t ne03;
220
- uint64_t nb01;
221
- uint64_t nb02;
222
- uint64_t nb03;
223
- int32_t ne11;
224
- int32_t ne_12_2; // assume K and V are same shape
225
- int32_t ne_12_3;
226
- uint64_t nb11;
227
- uint64_t nb12;
228
- uint64_t nb13;
229
- uint64_t nb21;
230
- uint64_t nb22;
231
- uint64_t nb23;
232
- uint64_t nb31;
233
- int32_t ne1;
234
- int32_t ne2;
235
- float scale;
236
- float max_bias;
237
- float m0;
238
- float m1;
239
- uint16_t n_head_log2;
240
- float logit_softcap;
241
- } ggml_metal_kargs_flash_attn_ext;
242
-
243
- typedef struct {
244
- int32_t ne00;
245
- int32_t ne02;
246
- uint64_t nb01;
247
- uint64_t nb02;
248
- uint64_t nb03;
249
- int32_t ne12;
250
- uint64_t nb10;
251
- uint64_t nb11;
252
- uint64_t nb12;
253
- uint64_t nb13;
254
- int32_t ne0;
255
- int32_t ne1;
256
- int16_t r2;
257
- int16_t r3;
258
- } ggml_metal_kargs_mul_mm;
259
-
260
- typedef struct {
261
- int32_t ne00;
262
- int32_t ne01;
263
- int32_t ne02;
264
- uint64_t nb00;
265
- uint64_t nb01;
266
- uint64_t nb02;
267
- uint64_t nb03;
268
- int32_t ne10;
269
- int32_t ne11;
270
- int32_t ne12;
271
- uint64_t nb10;
272
- uint64_t nb11;
273
- uint64_t nb12;
274
- uint64_t nb13;
275
- int32_t ne0;
276
- int32_t ne1;
277
- int16_t r2;
278
- int16_t r3;
279
- } ggml_metal_kargs_mul_mv;
280
-
281
- typedef struct {
282
- int32_t ne00;
283
- int32_t ne01;
284
- int32_t ne02;
285
- uint64_t nb00;
286
- uint64_t nb01;
287
- uint64_t nb02;
288
- uint64_t nb03;
289
- int32_t ne10;
290
- int32_t ne11;
291
- int32_t ne12;
292
- uint64_t nb10;
293
- uint64_t nb11;
294
- uint64_t nb12;
295
- uint64_t nb13;
296
- int32_t ne0;
297
- int32_t ne1;
298
- int16_t r2;
299
- int16_t r3;
300
- int16_t nsg;
301
- int16_t nxpsg;
302
- int16_t r1ptg;
303
- } ggml_metal_kargs_mul_mv_ext;
304
-
305
- typedef struct {
306
- int32_t ne10;
307
- int32_t ne11; // n_expert_used (bcast)
308
- uint64_t nb11;
309
- uint64_t nb12;
310
- int32_t neh11; // n_tokens
311
- uint64_t nbh11;
312
- int32_t ne20; // n_expert_used
313
- uint64_t nb21;
314
- } ggml_metal_kargs_mul_mm_id_map0;
315
-
316
- typedef struct {
317
- int32_t ne20; // n_expert_used
318
- int32_t neh0;
319
- int32_t neh1;
320
- uint64_t nbh1;
321
- uint64_t nbh2;
322
- int32_t ne0;
323
- uint64_t nb1;
324
- uint64_t nb2;
325
- } ggml_metal_kargs_mul_mm_id_map1;
326
-
327
- typedef struct {
328
- int32_t ne00;
329
- int32_t ne02;
330
- uint64_t nb01;
331
- uint64_t nb02;
332
- uint64_t nb03;
333
- int32_t neh12;
334
- uint64_t nbh10;
335
- uint64_t nbh11;
336
- uint64_t nbh12;
337
- uint64_t nbh13;
338
- int32_t neh0;
339
- int32_t neh1;
340
- int16_t r2;
341
- int16_t r3;
342
- } ggml_metal_kargs_mul_mm_id;
343
-
344
- typedef struct {
345
- int32_t nei0;
346
- int32_t nei1;
347
- uint64_t nbi1;
348
- int32_t ne00;
349
- int32_t ne01;
350
- int32_t ne02;
351
- uint64_t nb00;
352
- uint64_t nb01;
353
- uint64_t nb02;
354
- int32_t ne10;
355
- int32_t ne11;
356
- int32_t ne12;
357
- int32_t ne13;
358
- uint64_t nb10;
359
- uint64_t nb11;
360
- uint64_t nb12;
361
- int32_t ne0;
362
- int32_t ne1;
363
- uint64_t nb1;
364
- } ggml_metal_kargs_mul_mv_id;
365
-
366
- typedef struct {
367
- int32_t ne00;
368
- int32_t ne00_4;
369
- uint64_t nb01;
370
- float eps;
371
- } ggml_metal_kargs_norm;
372
-
373
- typedef struct {
374
- int32_t ne00;
375
- int32_t ne00_4;
376
- uint64_t nb01;
377
- float eps;
378
- } ggml_metal_kargs_rms_norm;
379
-
380
- typedef struct {
381
- int32_t ne00;
382
- int32_t ne00_4;
383
- uint64_t nb01;
384
- float eps;
385
- } ggml_metal_kargs_l2_norm;
386
-
387
- typedef struct {
388
- int64_t ne00;
389
- int64_t ne01;
390
- int64_t ne02;
391
- uint64_t nb00;
392
- uint64_t nb01;
393
- uint64_t nb02;
394
- int32_t n_groups;
395
- float eps;
396
- } ggml_metal_kargs_group_norm;
397
-
398
- typedef struct {
399
- int32_t IC;
400
- int32_t IL;
401
- int32_t K;
402
- int32_t s0;
403
- uint64_t nb0;
404
- uint64_t nb1;
405
- } ggml_metal_kargs_conv_transpose_1d;
406
-
407
- typedef struct {
408
- uint64_t ofs0;
409
- uint64_t ofs1;
410
- int32_t IW;
411
- int32_t IH;
412
- int32_t CHW;
413
- int32_t s0;
414
- int32_t s1;
415
- int32_t p0;
416
- int32_t p1;
417
- int32_t d0;
418
- int32_t d1;
419
- int32_t N;
420
- int32_t KH;
421
- int32_t KW;
422
- int32_t KHW; // KH * KW, pre-computed on CPU to save GPU resources
423
- } ggml_metal_kargs_im2col;
424
-
425
- typedef struct {
426
- int64_t ne00;
427
- int64_t ne01;
428
- int64_t ne02;
429
- int64_t ne03;
430
- uint64_t nb00;
431
- uint64_t nb01;
432
- uint64_t nb02;
433
- uint64_t nb03;
434
- int64_t ne10;
435
- int64_t ne11;
436
- int64_t ne12;
437
- int64_t ne13;
438
- uint64_t nb10;
439
- uint64_t nb11;
440
- uint64_t nb12;
441
- uint64_t nb13;
442
- int64_t ne0;
443
- int64_t ne1;
444
- int64_t ne2;
445
- int64_t ne3;
446
- uint64_t nb0;
447
- uint64_t nb1;
448
- uint64_t nb2;
449
- uint64_t nb3;
450
- } ggml_metal_kargs_sum_rows;
451
-
452
- typedef struct {
453
- int64_t ne00;
454
- int64_t ne01;
455
- int64_t ne02;
456
- float scale;
457
- float max_bias;
458
- float m0;
459
- float m1;
460
- uint32_t n_head_log2;
461
- } ggml_metal_kargs_soft_max;
462
-
463
- typedef struct {
464
- int64_t ne00;
465
- int64_t ne01;
466
- int n_past;
467
- } ggml_metal_kargs_diag_mask_inf;
468
-
469
- typedef struct {
470
- int64_t ne00;
471
- int64_t ne01;
472
- int64_t ne02;
473
- uint64_t nb00;
474
- uint64_t nb01;
475
- uint64_t nb02;
476
- int64_t ne10;
477
- int64_t ne11;
478
- uint64_t nb10;
479
- uint64_t nb11;
480
- int64_t ne0;
481
- int64_t ne1;
482
- int64_t ne2;
483
- uint64_t nb0;
484
- uint64_t nb1;
485
- uint64_t nb2;
486
- } ggml_metal_kargs_ssm_conv;
487
-
488
- typedef struct {
489
- int64_t d_state;
490
- int64_t d_inner;
491
- int64_t n_seq_tokens;
492
- int64_t n_seqs;
493
- uint64_t nb00;
494
- uint64_t nb01;
495
- uint64_t nb02;
496
- uint64_t nb10;
497
- uint64_t nb11;
498
- uint64_t nb12;
499
- uint64_t nb13;
500
- uint64_t nb20;
501
- uint64_t nb21;
502
- uint64_t nb22;
503
- uint64_t nb30;
504
- uint64_t nb31;
505
- uint64_t nb40;
506
- uint64_t nb41;
507
- uint64_t nb42;
508
- uint64_t nb50;
509
- uint64_t nb51;
510
- uint64_t nb52;
511
- } ggml_metal_kargs_ssm_scan;
512
-
513
- typedef struct {
514
- int64_t ne00;
515
- uint64_t nb01;
516
- uint64_t nb02;
517
- int64_t ne10;
518
- uint64_t nb10;
519
- uint64_t nb11;
520
- uint64_t nb1;
521
- uint64_t nb2;
522
- } ggml_metal_kargs_get_rows;
523
-
524
- typedef struct {
525
- int64_t ne00;
526
- int64_t ne01;
527
- int64_t ne02;
528
- int64_t ne03;
529
- uint64_t nb00;
530
- uint64_t nb01;
531
- uint64_t nb02;
532
- uint64_t nb03;
533
- int64_t ne0;
534
- int64_t ne1;
535
- int64_t ne2;
536
- int64_t ne3;
537
- uint64_t nb0;
538
- uint64_t nb1;
539
- uint64_t nb2;
540
- uint64_t nb3;
541
- float sf0;
542
- float sf1;
543
- float sf2;
544
- float sf3;
545
- } ggml_metal_kargs_upscale;
546
-
547
- typedef struct {
548
- int64_t ne00;
549
- int64_t ne01;
550
- int64_t ne02;
551
- int64_t ne03;
552
- uint64_t nb00;
553
- uint64_t nb01;
554
- uint64_t nb02;
555
- uint64_t nb03;
556
- int64_t ne0;
557
- int64_t ne1;
558
- int64_t ne2;
559
- int64_t ne3;
560
- uint64_t nb0;
561
- uint64_t nb1;
562
- uint64_t nb2;
563
- uint64_t nb3;
564
- } ggml_metal_kargs_pad;
565
-
566
- typedef struct {
567
- int64_t ne00;
568
- int64_t ne01;
569
- int64_t ne02;
570
- int64_t ne03;
571
- uint64_t nb00;
572
- uint64_t nb01;
573
- uint64_t nb02;
574
- uint64_t nb03;
575
- int64_t ne0;
576
- int64_t ne1;
577
- int64_t ne2;
578
- int64_t ne3;
579
- uint64_t nb0;
580
- uint64_t nb1;
581
- uint64_t nb2;
582
- uint64_t nb3;
583
- int32_t p0;
584
- int32_t p1;
585
- } ggml_metal_kargs_pad_reflect_1d;
586
-
587
- typedef struct {
588
- uint64_t nb1;
589
- int dim;
590
- int max_period;
591
- } ggml_metal_kargs_timestep_embedding;
592
-
593
- typedef struct {
594
- float slope;
595
- } ggml_metal_kargs_leaky_relu;
596
-
597
- typedef struct {
598
- int64_t ncols;
599
- int64_t ncols_pad;
600
- } ggml_metal_kargs_argsort;
601
-
602
- typedef struct {
603
- int64_t ne0;
604
- float start;
605
- float step;
606
- } ggml_metal_kargs_arange;
607
-
608
- typedef struct {
609
- int32_t k0;
610
- int32_t k1;
611
- int32_t s0;
612
- int32_t s1;
613
- int32_t p0;
614
- int32_t p1;
615
- int64_t IH;
616
- int64_t IW;
617
- int64_t OH;
618
- int64_t OW;
619
- int64_t parallel_elements;
620
- } ggml_metal_kargs_pool_2d;
621
-
622
- #endif // GGML_METAL_IMPL
@@ -1,113 +0,0 @@
1
- if (NOT EXISTS $ENV{MUSA_PATH})
2
- if (NOT EXISTS /opt/musa)
3
- set(MUSA_PATH /usr/local/musa)
4
- else()
5
- set(MUSA_PATH /opt/musa)
6
- endif()
7
- else()
8
- set(MUSA_PATH $ENV{MUSA_PATH})
9
- endif()
10
-
11
- set(CMAKE_C_COMPILER "${MUSA_PATH}/bin/clang")
12
- set(CMAKE_C_EXTENSIONS OFF)
13
- set(CMAKE_CXX_COMPILER "${MUSA_PATH}/bin/clang++")
14
- set(CMAKE_CXX_EXTENSIONS OFF)
15
-
16
- list(APPEND CMAKE_MODULE_PATH "${MUSA_PATH}/cmake")
17
-
18
- find_package(MUSAToolkit)
19
-
20
- if (MUSAToolkit_FOUND)
21
- message(STATUS "MUSA Toolkit found")
22
-
23
- if (NOT DEFINED MUSA_ARCHITECTURES)
24
- set(MUSA_ARCHITECTURES "21;22;31")
25
- endif()
26
- message(STATUS "Using MUSA architectures: ${MUSA_ARCHITECTURES}")
27
-
28
- file(GLOB GGML_HEADERS_MUSA "../ggml-cuda/*.cuh")
29
- list(APPEND GGML_HEADERS_MUSA "../../include/ggml-cuda.h")
30
- list(APPEND GGML_HEADERS_MUSA "../ggml-musa/mudnn.cuh")
31
-
32
- file(GLOB GGML_SOURCES_MUSA "../ggml-cuda/*.cu")
33
- file(GLOB SRCS "../ggml-cuda/template-instances/fattn-mma*.cu")
34
- list(APPEND GGML_SOURCES_MUSA ${SRCS})
35
- file(GLOB SRCS "../ggml-cuda/template-instances/mmq*.cu")
36
- list(APPEND GGML_SOURCES_MUSA ${SRCS})
37
- file(GLOB SRCS "../ggml-musa/*.cu")
38
- list(APPEND GGML_SOURCES_MUSA ${SRCS})
39
-
40
- if (GGML_CUDA_FA_ALL_QUANTS)
41
- file(GLOB SRCS "../ggml-cuda/template-instances/fattn-vec*.cu")
42
- list(APPEND GGML_SOURCES_MUSA ${SRCS})
43
- add_compile_definitions(GGML_CUDA_FA_ALL_QUANTS)
44
- else()
45
- file(GLOB SRCS "../ggml-cuda/template-instances/fattn-vec*q4_0-q4_0.cu")
46
- list(APPEND GGML_SOURCES_MUSA ${SRCS})
47
- file(GLOB SRCS "../ggml-cuda/template-instances/fattn-vec*q8_0-q8_0.cu")
48
- list(APPEND GGML_SOURCES_MUSA ${SRCS})
49
- file(GLOB SRCS "../ggml-cuda/template-instances/fattn-vec*f16-f16.cu")
50
- list(APPEND GGML_SOURCES_MUSA ${SRCS})
51
- endif()
52
-
53
- set_source_files_properties(${GGML_SOURCES_MUSA} PROPERTIES LANGUAGE CXX)
54
- foreach(SOURCE ${GGML_SOURCES_MUSA})
55
- set(COMPILE_FLAGS "-fsigned-char -x musa -mtgpu")
56
- foreach(ARCH ${MUSA_ARCHITECTURES})
57
- set(COMPILE_FLAGS "${COMPILE_FLAGS} --cuda-gpu-arch=mp_${ARCH}")
58
- endforeach()
59
- set_property(SOURCE ${SOURCE} PROPERTY COMPILE_FLAGS ${COMPILE_FLAGS})
60
- endforeach()
61
-
62
- ggml_add_backend_library(ggml-musa
63
- ${GGML_HEADERS_MUSA}
64
- ${GGML_SOURCES_MUSA}
65
- )
66
-
67
- # TODO: do not use CUDA definitions for MUSA
68
- if (NOT GGML_BACKEND_DL)
69
- target_compile_definitions(ggml PUBLIC GGML_USE_CUDA)
70
- endif()
71
-
72
- add_compile_definitions(GGML_USE_MUSA)
73
- add_compile_definitions(GGML_CUDA_PEER_MAX_BATCH_SIZE=${GGML_CUDA_PEER_MAX_BATCH_SIZE})
74
-
75
- if (GGML_CUDA_FORCE_MMQ)
76
- add_compile_definitions(GGML_CUDA_FORCE_MMQ)
77
- endif()
78
-
79
- if (GGML_CUDA_FORCE_CUBLAS)
80
- add_compile_definitions(GGML_CUDA_FORCE_CUBLAS)
81
- endif()
82
-
83
- if (GGML_CUDA_NO_VMM)
84
- add_compile_definitions(GGML_CUDA_NO_VMM)
85
- endif()
86
-
87
- if (NOT GGML_CUDA_FA)
88
- add_compile_definitions(GGML_CUDA_NO_FA)
89
- endif()
90
-
91
- if (GGML_CUDA_F16 OR GGML_CUDA_DMMV_F16)
92
- add_compile_definitions(GGML_CUDA_F16)
93
- endif()
94
-
95
- if (GGML_CUDA_NO_PEER_COPY)
96
- add_compile_definitions(GGML_CUDA_NO_PEER_COPY)
97
- endif()
98
-
99
- if (GGML_STATIC)
100
- # TODO: mudnn has not provided static libraries yet
101
- target_link_libraries(ggml-musa PRIVATE MUSA::musart_static MUSA::mublas_static)
102
- else()
103
- target_link_libraries(ggml-musa PRIVATE MUSA::musart MUSA::mublas mudnn)
104
- endif()
105
-
106
- if (GGML_CUDA_NO_VMM)
107
- # No VMM requested, no need to link directly with the musa driver lib (libmusa.so)
108
- else()
109
- target_link_libraries(ggml-musa PRIVATE MUSA::musa_driver)
110
- endif()
111
- else()
112
- message(FATAL_ERROR "MUSA Toolkit not found")
113
- endif()