@fugood/llama.node 0.6.3 → 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 (377) 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 -7
  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/src/llama.cpp/.github/workflows/build-linux-cross.yml +0 -233
  27. package/src/llama.cpp/.github/workflows/build.yml +0 -1078
  28. package/src/llama.cpp/.github/workflows/close-issue.yml +0 -28
  29. package/src/llama.cpp/.github/workflows/docker.yml +0 -178
  30. package/src/llama.cpp/.github/workflows/editorconfig.yml +0 -29
  31. package/src/llama.cpp/.github/workflows/gguf-publish.yml +0 -44
  32. package/src/llama.cpp/.github/workflows/labeler.yml +0 -17
  33. package/src/llama.cpp/.github/workflows/python-check-requirements.yml +0 -33
  34. package/src/llama.cpp/.github/workflows/python-lint.yml +0 -30
  35. package/src/llama.cpp/.github/workflows/python-type-check.yml +0 -40
  36. package/src/llama.cpp/.github/workflows/release.yml +0 -739
  37. package/src/llama.cpp/.github/workflows/server.yml +0 -237
  38. package/src/llama.cpp/.github/workflows/winget.yml +0 -42
  39. package/src/llama.cpp/cmake/arm64-apple-clang.cmake +0 -16
  40. package/src/llama.cpp/cmake/arm64-windows-llvm.cmake +0 -16
  41. package/src/llama.cpp/cmake/build-info.cmake +0 -64
  42. package/src/llama.cpp/cmake/common.cmake +0 -35
  43. package/src/llama.cpp/cmake/git-vars.cmake +0 -22
  44. package/src/llama.cpp/cmake/x64-windows-llvm.cmake +0 -5
  45. package/src/llama.cpp/common/build-info.cpp.in +0 -4
  46. package/src/llama.cpp/docs/build.md +0 -561
  47. package/src/llama.cpp/examples/CMakeLists.txt +0 -43
  48. package/src/llama.cpp/examples/batched/CMakeLists.txt +0 -5
  49. package/src/llama.cpp/examples/batched/batched.cpp +0 -246
  50. package/src/llama.cpp/examples/chat-13B.bat +0 -57
  51. package/src/llama.cpp/examples/convert-llama2c-to-ggml/CMakeLists.txt +0 -5
  52. package/src/llama.cpp/examples/convert-llama2c-to-ggml/convert-llama2c-to-ggml.cpp +0 -941
  53. package/src/llama.cpp/examples/deprecation-warning/deprecation-warning.cpp +0 -35
  54. package/src/llama.cpp/examples/embedding/CMakeLists.txt +0 -5
  55. package/src/llama.cpp/examples/embedding/embedding.cpp +0 -323
  56. package/src/llama.cpp/examples/eval-callback/CMakeLists.txt +0 -10
  57. package/src/llama.cpp/examples/eval-callback/eval-callback.cpp +0 -194
  58. package/src/llama.cpp/examples/gen-docs/CMakeLists.txt +0 -5
  59. package/src/llama.cpp/examples/gen-docs/gen-docs.cpp +0 -83
  60. package/src/llama.cpp/examples/gguf/CMakeLists.txt +0 -5
  61. package/src/llama.cpp/examples/gguf/gguf.cpp +0 -265
  62. package/src/llama.cpp/examples/gguf-hash/CMakeLists.txt +0 -22
  63. package/src/llama.cpp/examples/gguf-hash/deps/rotate-bits/rotate-bits.h +0 -46
  64. package/src/llama.cpp/examples/gguf-hash/deps/sha1/sha1.c +0 -295
  65. package/src/llama.cpp/examples/gguf-hash/deps/sha1/sha1.h +0 -52
  66. package/src/llama.cpp/examples/gguf-hash/deps/sha256/sha256.c +0 -221
  67. package/src/llama.cpp/examples/gguf-hash/deps/sha256/sha256.h +0 -24
  68. package/src/llama.cpp/examples/gguf-hash/deps/xxhash/xxhash.c +0 -42
  69. package/src/llama.cpp/examples/gguf-hash/deps/xxhash/xxhash.h +0 -7093
  70. package/src/llama.cpp/examples/gguf-hash/gguf-hash.cpp +0 -694
  71. package/src/llama.cpp/examples/gritlm/CMakeLists.txt +0 -5
  72. package/src/llama.cpp/examples/gritlm/gritlm.cpp +0 -229
  73. package/src/llama.cpp/examples/jeopardy/questions.txt +0 -100
  74. package/src/llama.cpp/examples/llama.android/app/build.gradle.kts +0 -65
  75. package/src/llama.cpp/examples/llama.android/build.gradle.kts +0 -6
  76. package/src/llama.cpp/examples/llama.android/llama/build.gradle.kts +0 -71
  77. package/src/llama.cpp/examples/llama.android/llama/src/main/cpp/CMakeLists.txt +0 -53
  78. package/src/llama.cpp/examples/llama.android/llama/src/main/cpp/llama-android.cpp +0 -452
  79. package/src/llama.cpp/examples/llama.android/settings.gradle.kts +0 -18
  80. package/src/llama.cpp/examples/lookahead/CMakeLists.txt +0 -5
  81. package/src/llama.cpp/examples/lookahead/lookahead.cpp +0 -472
  82. package/src/llama.cpp/examples/lookup/CMakeLists.txt +0 -23
  83. package/src/llama.cpp/examples/lookup/lookup-create.cpp +0 -40
  84. package/src/llama.cpp/examples/lookup/lookup-merge.cpp +0 -47
  85. package/src/llama.cpp/examples/lookup/lookup-stats.cpp +0 -157
  86. package/src/llama.cpp/examples/lookup/lookup.cpp +0 -242
  87. package/src/llama.cpp/examples/parallel/CMakeLists.txt +0 -5
  88. package/src/llama.cpp/examples/parallel/parallel.cpp +0 -492
  89. package/src/llama.cpp/examples/passkey/CMakeLists.txt +0 -5
  90. package/src/llama.cpp/examples/passkey/passkey.cpp +0 -277
  91. package/src/llama.cpp/examples/retrieval/CMakeLists.txt +0 -5
  92. package/src/llama.cpp/examples/retrieval/retrieval.cpp +0 -304
  93. package/src/llama.cpp/examples/save-load-state/CMakeLists.txt +0 -5
  94. package/src/llama.cpp/examples/save-load-state/save-load-state.cpp +0 -246
  95. package/src/llama.cpp/examples/simple/CMakeLists.txt +0 -5
  96. package/src/llama.cpp/examples/simple/simple.cpp +0 -206
  97. package/src/llama.cpp/examples/simple-chat/CMakeLists.txt +0 -5
  98. package/src/llama.cpp/examples/simple-chat/simple-chat.cpp +0 -206
  99. package/src/llama.cpp/examples/simple-cmake-pkg/CMakeLists.txt +0 -11
  100. package/src/llama.cpp/examples/speculative/CMakeLists.txt +0 -5
  101. package/src/llama.cpp/examples/speculative/speculative.cpp +0 -644
  102. package/src/llama.cpp/examples/speculative-simple/CMakeLists.txt +0 -5
  103. package/src/llama.cpp/examples/speculative-simple/speculative-simple.cpp +0 -261
  104. package/src/llama.cpp/examples/sycl/CMakeLists.txt +0 -9
  105. package/src/llama.cpp/examples/sycl/build.sh +0 -23
  106. package/src/llama.cpp/examples/sycl/ls-sycl-device.cpp +0 -13
  107. package/src/llama.cpp/examples/sycl/run-llama2.sh +0 -27
  108. package/src/llama.cpp/examples/sycl/run-llama3.sh +0 -28
  109. package/src/llama.cpp/examples/sycl/win-build-sycl.bat +0 -33
  110. package/src/llama.cpp/examples/sycl/win-run-llama2.bat +0 -9
  111. package/src/llama.cpp/examples/sycl/win-run-llama3.bat +0 -9
  112. package/src/llama.cpp/examples/training/CMakeLists.txt +0 -5
  113. package/src/llama.cpp/examples/training/finetune.cpp +0 -96
  114. package/src/llama.cpp/ggml/cmake/GitVars.cmake +0 -22
  115. package/src/llama.cpp/ggml/cmake/common.cmake +0 -26
  116. package/src/llama.cpp/ggml/src/ggml-alloc.c +0 -1042
  117. package/src/llama.cpp/ggml/src/ggml-backend-impl.h +0 -255
  118. package/src/llama.cpp/ggml/src/ggml-backend-reg.cpp +0 -586
  119. package/src/llama.cpp/ggml/src/ggml-backend.cpp +0 -2008
  120. package/src/llama.cpp/ggml/src/ggml-blas/CMakeLists.txt +0 -87
  121. package/src/llama.cpp/ggml/src/ggml-blas/ggml-blas.cpp +0 -517
  122. package/src/llama.cpp/ggml/src/ggml-cann/CMakeLists.txt +0 -74
  123. package/src/llama.cpp/ggml/src/ggml-cann/acl_tensor.cpp +0 -179
  124. package/src/llama.cpp/ggml/src/ggml-cann/acl_tensor.h +0 -258
  125. package/src/llama.cpp/ggml/src/ggml-cann/aclnn_ops.cpp +0 -2863
  126. package/src/llama.cpp/ggml/src/ggml-cann/aclnn_ops.h +0 -1110
  127. package/src/llama.cpp/ggml/src/ggml-cann/common.h +0 -420
  128. package/src/llama.cpp/ggml/src/ggml-cann/ggml-cann.cpp +0 -2570
  129. package/src/llama.cpp/ggml/src/ggml-common.h +0 -1857
  130. package/src/llama.cpp/ggml/src/ggml-cpu/cmake/FindSIMD.cmake +0 -100
  131. package/src/llama.cpp/ggml/src/ggml-cuda/CMakeLists.txt +0 -184
  132. package/src/llama.cpp/ggml/src/ggml-cuda/vendors/cuda.h +0 -15
  133. package/src/llama.cpp/ggml/src/ggml-cuda/vendors/hip.h +0 -243
  134. package/src/llama.cpp/ggml/src/ggml-cuda/vendors/musa.h +0 -140
  135. package/src/llama.cpp/ggml/src/ggml-hip/CMakeLists.txt +0 -131
  136. package/src/llama.cpp/ggml/src/ggml-impl.h +0 -601
  137. package/src/llama.cpp/ggml/src/ggml-kompute/CMakeLists.txt +0 -166
  138. package/src/llama.cpp/ggml/src/ggml-kompute/ggml-kompute.cpp +0 -2251
  139. package/src/llama.cpp/ggml/src/ggml-metal/CMakeLists.txt +0 -120
  140. package/src/llama.cpp/ggml/src/ggml-metal/ggml-metal-impl.h +0 -622
  141. package/src/llama.cpp/ggml/src/ggml-musa/CMakeLists.txt +0 -113
  142. package/src/llama.cpp/ggml/src/ggml-opencl/CMakeLists.txt +0 -96
  143. package/src/llama.cpp/ggml/src/ggml-opencl/ggml-opencl.cpp +0 -5124
  144. package/src/llama.cpp/ggml/src/ggml-opt.cpp +0 -1037
  145. package/src/llama.cpp/ggml/src/ggml-quants.c +0 -5232
  146. package/src/llama.cpp/ggml/src/ggml-quants.h +0 -100
  147. package/src/llama.cpp/ggml/src/ggml-rpc/CMakeLists.txt +0 -9
  148. package/src/llama.cpp/ggml/src/ggml-rpc/ggml-rpc.cpp +0 -1813
  149. package/src/llama.cpp/ggml/src/ggml-sycl/CMakeLists.txt +0 -189
  150. package/src/llama.cpp/ggml/src/ggml-sycl/backend.hpp +0 -37
  151. package/src/llama.cpp/ggml/src/ggml-sycl/binbcast.cpp +0 -239
  152. package/src/llama.cpp/ggml/src/ggml-sycl/binbcast.hpp +0 -39
  153. package/src/llama.cpp/ggml/src/ggml-sycl/common.cpp +0 -83
  154. package/src/llama.cpp/ggml/src/ggml-sycl/common.hpp +0 -493
  155. package/src/llama.cpp/ggml/src/ggml-sycl/concat.cpp +0 -197
  156. package/src/llama.cpp/ggml/src/ggml-sycl/concat.hpp +0 -20
  157. package/src/llama.cpp/ggml/src/ggml-sycl/conv.cpp +0 -100
  158. package/src/llama.cpp/ggml/src/ggml-sycl/conv.hpp +0 -20
  159. package/src/llama.cpp/ggml/src/ggml-sycl/convert.cpp +0 -623
  160. package/src/llama.cpp/ggml/src/ggml-sycl/convert.hpp +0 -34
  161. package/src/llama.cpp/ggml/src/ggml-sycl/cpy.cpp +0 -701
  162. package/src/llama.cpp/ggml/src/ggml-sycl/cpy.hpp +0 -11
  163. package/src/llama.cpp/ggml/src/ggml-sycl/dequantize.hpp +0 -791
  164. package/src/llama.cpp/ggml/src/ggml-sycl/dmmv.cpp +0 -1160
  165. package/src/llama.cpp/ggml/src/ggml-sycl/dmmv.hpp +0 -27
  166. package/src/llama.cpp/ggml/src/ggml-sycl/dpct/helper.hpp +0 -2957
  167. package/src/llama.cpp/ggml/src/ggml-sycl/element_wise.cpp +0 -1536
  168. package/src/llama.cpp/ggml/src/ggml-sycl/element_wise.hpp +0 -75
  169. package/src/llama.cpp/ggml/src/ggml-sycl/gemm.hpp +0 -99
  170. package/src/llama.cpp/ggml/src/ggml-sycl/getrows.cpp +0 -311
  171. package/src/llama.cpp/ggml/src/ggml-sycl/getrows.hpp +0 -20
  172. package/src/llama.cpp/ggml/src/ggml-sycl/ggml-sycl.cpp +0 -4443
  173. package/src/llama.cpp/ggml/src/ggml-sycl/gla.cpp +0 -105
  174. package/src/llama.cpp/ggml/src/ggml-sycl/gla.hpp +0 -8
  175. package/src/llama.cpp/ggml/src/ggml-sycl/im2col.cpp +0 -136
  176. package/src/llama.cpp/ggml/src/ggml-sycl/im2col.hpp +0 -21
  177. package/src/llama.cpp/ggml/src/ggml-sycl/mmq.cpp +0 -3030
  178. package/src/llama.cpp/ggml/src/ggml-sycl/mmq.hpp +0 -33
  179. package/src/llama.cpp/ggml/src/ggml-sycl/mmvq.cpp +0 -1108
  180. package/src/llama.cpp/ggml/src/ggml-sycl/mmvq.hpp +0 -27
  181. package/src/llama.cpp/ggml/src/ggml-sycl/norm.cpp +0 -474
  182. package/src/llama.cpp/ggml/src/ggml-sycl/norm.hpp +0 -26
  183. package/src/llama.cpp/ggml/src/ggml-sycl/outprod.cpp +0 -46
  184. package/src/llama.cpp/ggml/src/ggml-sycl/outprod.hpp +0 -10
  185. package/src/llama.cpp/ggml/src/ggml-sycl/presets.hpp +0 -74
  186. package/src/llama.cpp/ggml/src/ggml-sycl/quants.hpp +0 -83
  187. package/src/llama.cpp/ggml/src/ggml-sycl/rope.cpp +0 -362
  188. package/src/llama.cpp/ggml/src/ggml-sycl/rope.hpp +0 -20
  189. package/src/llama.cpp/ggml/src/ggml-sycl/softmax.cpp +0 -264
  190. package/src/llama.cpp/ggml/src/ggml-sycl/softmax.hpp +0 -20
  191. package/src/llama.cpp/ggml/src/ggml-sycl/sycl_hw.cpp +0 -13
  192. package/src/llama.cpp/ggml/src/ggml-sycl/sycl_hw.hpp +0 -23
  193. package/src/llama.cpp/ggml/src/ggml-sycl/tsembd.cpp +0 -73
  194. package/src/llama.cpp/ggml/src/ggml-sycl/tsembd.hpp +0 -20
  195. package/src/llama.cpp/ggml/src/ggml-sycl/vecdotq.hpp +0 -1215
  196. package/src/llama.cpp/ggml/src/ggml-sycl/wkv.cpp +0 -305
  197. package/src/llama.cpp/ggml/src/ggml-sycl/wkv.hpp +0 -10
  198. package/src/llama.cpp/ggml/src/ggml-threading.cpp +0 -12
  199. package/src/llama.cpp/ggml/src/ggml-threading.h +0 -14
  200. package/src/llama.cpp/ggml/src/ggml-vulkan/CMakeLists.txt +0 -196
  201. package/src/llama.cpp/ggml/src/ggml-vulkan/ggml-vulkan.cpp +0 -10699
  202. package/src/llama.cpp/ggml/src/ggml-vulkan/vulkan-shaders/CMakeLists.txt +0 -39
  203. package/src/llama.cpp/ggml/src/ggml-vulkan/vulkan-shaders/vulkan-shaders-gen.cpp +0 -751
  204. package/src/llama.cpp/ggml/src/ggml.c +0 -6550
  205. package/src/llama.cpp/ggml/src/gguf.cpp +0 -1330
  206. package/src/llama.cpp/models/.editorconfig +0 -1
  207. package/src/llama.cpp/models/ggml-vocab-aquila.gguf +0 -0
  208. package/src/llama.cpp/models/ggml-vocab-baichuan.gguf +0 -0
  209. package/src/llama.cpp/models/ggml-vocab-bert-bge.gguf +0 -0
  210. package/src/llama.cpp/models/ggml-vocab-bert-bge.gguf.inp +0 -112
  211. package/src/llama.cpp/models/ggml-vocab-bert-bge.gguf.out +0 -46
  212. package/src/llama.cpp/models/ggml-vocab-chameleon.gguf.inp +0 -112
  213. package/src/llama.cpp/models/ggml-vocab-chameleon.gguf.out +0 -46
  214. package/src/llama.cpp/models/ggml-vocab-command-r.gguf +0 -0
  215. package/src/llama.cpp/models/ggml-vocab-command-r.gguf.inp +0 -112
  216. package/src/llama.cpp/models/ggml-vocab-command-r.gguf.out +0 -46
  217. package/src/llama.cpp/models/ggml-vocab-deepseek-coder.gguf +0 -0
  218. package/src/llama.cpp/models/ggml-vocab-deepseek-coder.gguf.inp +0 -112
  219. package/src/llama.cpp/models/ggml-vocab-deepseek-coder.gguf.out +0 -46
  220. package/src/llama.cpp/models/ggml-vocab-deepseek-llm.gguf +0 -0
  221. package/src/llama.cpp/models/ggml-vocab-deepseek-llm.gguf.inp +0 -112
  222. package/src/llama.cpp/models/ggml-vocab-deepseek-llm.gguf.out +0 -46
  223. package/src/llama.cpp/models/ggml-vocab-deepseek-r1-qwen.gguf.inp +0 -112
  224. package/src/llama.cpp/models/ggml-vocab-deepseek-r1-qwen.gguf.out +0 -46
  225. package/src/llama.cpp/models/ggml-vocab-falcon.gguf +0 -0
  226. package/src/llama.cpp/models/ggml-vocab-falcon.gguf.inp +0 -112
  227. package/src/llama.cpp/models/ggml-vocab-falcon.gguf.out +0 -46
  228. package/src/llama.cpp/models/ggml-vocab-gpt-2.gguf +0 -0
  229. package/src/llama.cpp/models/ggml-vocab-gpt-2.gguf.inp +0 -112
  230. package/src/llama.cpp/models/ggml-vocab-gpt-2.gguf.out +0 -46
  231. package/src/llama.cpp/models/ggml-vocab-gpt-4o.gguf.inp +0 -112
  232. package/src/llama.cpp/models/ggml-vocab-gpt-4o.gguf.out +0 -46
  233. package/src/llama.cpp/models/ggml-vocab-gpt-neox.gguf +0 -0
  234. package/src/llama.cpp/models/ggml-vocab-llama-bpe.gguf +0 -0
  235. package/src/llama.cpp/models/ggml-vocab-llama-bpe.gguf.inp +0 -112
  236. package/src/llama.cpp/models/ggml-vocab-llama-bpe.gguf.out +0 -46
  237. package/src/llama.cpp/models/ggml-vocab-llama-spm.gguf +0 -0
  238. package/src/llama.cpp/models/ggml-vocab-llama-spm.gguf.inp +0 -112
  239. package/src/llama.cpp/models/ggml-vocab-llama-spm.gguf.out +0 -46
  240. package/src/llama.cpp/models/ggml-vocab-llama4.gguf.inp +0 -112
  241. package/src/llama.cpp/models/ggml-vocab-llama4.gguf.out +0 -46
  242. package/src/llama.cpp/models/ggml-vocab-mpt.gguf +0 -0
  243. package/src/llama.cpp/models/ggml-vocab-mpt.gguf.inp +0 -112
  244. package/src/llama.cpp/models/ggml-vocab-mpt.gguf.out +0 -46
  245. package/src/llama.cpp/models/ggml-vocab-phi-3.gguf +0 -0
  246. package/src/llama.cpp/models/ggml-vocab-phi-3.gguf.inp +0 -112
  247. package/src/llama.cpp/models/ggml-vocab-phi-3.gguf.out +0 -46
  248. package/src/llama.cpp/models/ggml-vocab-pixtral.gguf.inp +0 -112
  249. package/src/llama.cpp/models/ggml-vocab-pixtral.gguf.out +0 -46
  250. package/src/llama.cpp/models/ggml-vocab-qwen2.gguf +0 -0
  251. package/src/llama.cpp/models/ggml-vocab-qwen2.gguf.inp +0 -112
  252. package/src/llama.cpp/models/ggml-vocab-qwen2.gguf.out +0 -46
  253. package/src/llama.cpp/models/ggml-vocab-refact.gguf +0 -0
  254. package/src/llama.cpp/models/ggml-vocab-refact.gguf.inp +0 -112
  255. package/src/llama.cpp/models/ggml-vocab-refact.gguf.out +0 -46
  256. package/src/llama.cpp/models/ggml-vocab-roberta-bpe.gguf.inp +0 -112
  257. package/src/llama.cpp/models/ggml-vocab-roberta-bpe.gguf.out +0 -46
  258. package/src/llama.cpp/models/ggml-vocab-starcoder.gguf +0 -0
  259. package/src/llama.cpp/models/ggml-vocab-starcoder.gguf.inp +0 -112
  260. package/src/llama.cpp/models/ggml-vocab-starcoder.gguf.out +0 -46
  261. package/src/llama.cpp/pocs/CMakeLists.txt +0 -14
  262. package/src/llama.cpp/pocs/vdot/CMakeLists.txt +0 -9
  263. package/src/llama.cpp/pocs/vdot/q8dot.cpp +0 -173
  264. package/src/llama.cpp/pocs/vdot/vdot.cpp +0 -311
  265. package/src/llama.cpp/prompts/LLM-questions.txt +0 -49
  266. package/src/llama.cpp/prompts/alpaca.txt +0 -1
  267. package/src/llama.cpp/prompts/assistant.txt +0 -31
  268. package/src/llama.cpp/prompts/chat-with-baichuan.txt +0 -4
  269. package/src/llama.cpp/prompts/chat-with-bob.txt +0 -7
  270. package/src/llama.cpp/prompts/chat-with-qwen.txt +0 -1
  271. package/src/llama.cpp/prompts/chat-with-vicuna-v0.txt +0 -7
  272. package/src/llama.cpp/prompts/chat-with-vicuna-v1.txt +0 -7
  273. package/src/llama.cpp/prompts/chat.txt +0 -28
  274. package/src/llama.cpp/prompts/dan-modified.txt +0 -1
  275. package/src/llama.cpp/prompts/dan.txt +0 -1
  276. package/src/llama.cpp/prompts/mnemonics.txt +0 -93
  277. package/src/llama.cpp/prompts/parallel-questions.txt +0 -43
  278. package/src/llama.cpp/prompts/reason-act.txt +0 -18
  279. package/src/llama.cpp/requirements/requirements-all.txt +0 -15
  280. package/src/llama.cpp/requirements/requirements-compare-llama-bench.txt +0 -2
  281. package/src/llama.cpp/requirements/requirements-convert_hf_to_gguf.txt +0 -7
  282. package/src/llama.cpp/requirements/requirements-convert_hf_to_gguf_update.txt +0 -7
  283. package/src/llama.cpp/requirements/requirements-convert_legacy_llama.txt +0 -5
  284. package/src/llama.cpp/requirements/requirements-convert_llama_ggml_to_gguf.txt +0 -1
  285. package/src/llama.cpp/requirements/requirements-convert_lora_to_gguf.txt +0 -4
  286. package/src/llama.cpp/requirements/requirements-gguf_editor_gui.txt +0 -3
  287. package/src/llama.cpp/requirements/requirements-pydantic.txt +0 -3
  288. package/src/llama.cpp/requirements/requirements-test-tokenizer-random.txt +0 -1
  289. package/src/llama.cpp/requirements/requirements-tool_bench.txt +0 -12
  290. package/src/llama.cpp/requirements.txt +0 -13
  291. package/src/llama.cpp/scripts/build-info.sh +0 -30
  292. package/src/llama.cpp/scripts/install-oneapi.bat +0 -19
  293. package/src/llama.cpp/scripts/xxd.cmake +0 -16
  294. package/src/llama.cpp/tests/CMakeLists.txt +0 -177
  295. package/src/llama.cpp/tests/get-model.cpp +0 -21
  296. package/src/llama.cpp/tests/get-model.h +0 -2
  297. package/src/llama.cpp/tests/test-arg-parser.cpp +0 -178
  298. package/src/llama.cpp/tests/test-autorelease.cpp +0 -24
  299. package/src/llama.cpp/tests/test-backend-ops.cpp +0 -4793
  300. package/src/llama.cpp/tests/test-barrier.cpp +0 -94
  301. package/src/llama.cpp/tests/test-c.c +0 -7
  302. package/src/llama.cpp/tests/test-chat-template.cpp +0 -417
  303. package/src/llama.cpp/tests/test-chat.cpp +0 -985
  304. package/src/llama.cpp/tests/test-double-float.cpp +0 -57
  305. package/src/llama.cpp/tests/test-gbnf-validator.cpp +0 -109
  306. package/src/llama.cpp/tests/test-gguf.cpp +0 -1338
  307. package/src/llama.cpp/tests/test-grammar-integration.cpp +0 -1308
  308. package/src/llama.cpp/tests/test-grammar-llguidance.cpp +0 -1201
  309. package/src/llama.cpp/tests/test-grammar-parser.cpp +0 -519
  310. package/src/llama.cpp/tests/test-json-schema-to-grammar.cpp +0 -1304
  311. package/src/llama.cpp/tests/test-llama-grammar.cpp +0 -408
  312. package/src/llama.cpp/tests/test-log.cpp +0 -39
  313. package/src/llama.cpp/tests/test-model-load-cancel.cpp +0 -27
  314. package/src/llama.cpp/tests/test-mtmd-c-api.c +0 -63
  315. package/src/llama.cpp/tests/test-opt.cpp +0 -904
  316. package/src/llama.cpp/tests/test-quantize-fns.cpp +0 -186
  317. package/src/llama.cpp/tests/test-quantize-perf.cpp +0 -365
  318. package/src/llama.cpp/tests/test-quantize-stats.cpp +0 -424
  319. package/src/llama.cpp/tests/test-regex-partial.cpp +0 -288
  320. package/src/llama.cpp/tests/test-rope.cpp +0 -262
  321. package/src/llama.cpp/tests/test-sampling.cpp +0 -399
  322. package/src/llama.cpp/tests/test-tokenizer-0.cpp +0 -312
  323. package/src/llama.cpp/tests/test-tokenizer-1-bpe.cpp +0 -155
  324. package/src/llama.cpp/tests/test-tokenizer-1-spm.cpp +0 -125
  325. package/src/llama.cpp/tools/CMakeLists.txt +0 -39
  326. package/src/llama.cpp/tools/batched-bench/CMakeLists.txt +0 -5
  327. package/src/llama.cpp/tools/batched-bench/batched-bench.cpp +0 -204
  328. package/src/llama.cpp/tools/cvector-generator/CMakeLists.txt +0 -5
  329. package/src/llama.cpp/tools/cvector-generator/completions.txt +0 -582
  330. package/src/llama.cpp/tools/cvector-generator/cvector-generator.cpp +0 -508
  331. package/src/llama.cpp/tools/cvector-generator/mean.hpp +0 -48
  332. package/src/llama.cpp/tools/cvector-generator/negative.txt +0 -4
  333. package/src/llama.cpp/tools/cvector-generator/pca.hpp +0 -315
  334. package/src/llama.cpp/tools/cvector-generator/positive.txt +0 -4
  335. package/src/llama.cpp/tools/export-lora/CMakeLists.txt +0 -5
  336. package/src/llama.cpp/tools/export-lora/export-lora.cpp +0 -434
  337. package/src/llama.cpp/tools/gguf-split/CMakeLists.txt +0 -5
  338. package/src/llama.cpp/tools/gguf-split/gguf-split.cpp +0 -583
  339. package/src/llama.cpp/tools/imatrix/CMakeLists.txt +0 -5
  340. package/src/llama.cpp/tools/imatrix/imatrix.cpp +0 -667
  341. package/src/llama.cpp/tools/llama-bench/CMakeLists.txt +0 -5
  342. package/src/llama.cpp/tools/llama-bench/llama-bench.cpp +0 -2024
  343. package/src/llama.cpp/tools/main/CMakeLists.txt +0 -5
  344. package/src/llama.cpp/tools/main/main.cpp +0 -977
  345. package/src/llama.cpp/tools/mtmd/CMakeLists.txt +0 -58
  346. package/src/llama.cpp/tools/mtmd/clip-impl.h +0 -462
  347. package/src/llama.cpp/tools/mtmd/clip.cpp +0 -4024
  348. package/src/llama.cpp/tools/mtmd/clip.h +0 -101
  349. package/src/llama.cpp/tools/mtmd/deprecation-warning.cpp +0 -22
  350. package/src/llama.cpp/tools/mtmd/miniaudio.h +0 -93468
  351. package/src/llama.cpp/tools/mtmd/mtmd-audio.cpp +0 -855
  352. package/src/llama.cpp/tools/mtmd/mtmd-audio.h +0 -62
  353. package/src/llama.cpp/tools/mtmd/mtmd-cli.cpp +0 -377
  354. package/src/llama.cpp/tools/mtmd/mtmd-helper.cpp +0 -297
  355. package/src/llama.cpp/tools/mtmd/mtmd.cpp +0 -942
  356. package/src/llama.cpp/tools/mtmd/mtmd.h +0 -362
  357. package/src/llama.cpp/tools/mtmd/requirements.txt +0 -5
  358. package/src/llama.cpp/tools/perplexity/CMakeLists.txt +0 -5
  359. package/src/llama.cpp/tools/perplexity/perplexity.cpp +0 -2063
  360. package/src/llama.cpp/tools/quantize/CMakeLists.txt +0 -6
  361. package/src/llama.cpp/tools/quantize/quantize.cpp +0 -519
  362. package/src/llama.cpp/tools/rpc/CMakeLists.txt +0 -4
  363. package/src/llama.cpp/tools/rpc/rpc-server.cpp +0 -322
  364. package/src/llama.cpp/tools/run/CMakeLists.txt +0 -16
  365. package/src/llama.cpp/tools/run/linenoise.cpp/linenoise.cpp +0 -1995
  366. package/src/llama.cpp/tools/run/linenoise.cpp/linenoise.h +0 -137
  367. package/src/llama.cpp/tools/run/run.cpp +0 -1261
  368. package/src/llama.cpp/tools/server/CMakeLists.txt +0 -51
  369. package/src/llama.cpp/tools/server/bench/requirements.txt +0 -2
  370. package/src/llama.cpp/tools/server/httplib.h +0 -10506
  371. package/src/llama.cpp/tools/server/server.cpp +0 -4966
  372. package/src/llama.cpp/tools/server/tests/requirements.txt +0 -8
  373. package/src/llama.cpp/tools/server/utils.hpp +0 -1337
  374. package/src/llama.cpp/tools/tokenize/CMakeLists.txt +0 -5
  375. package/src/llama.cpp/tools/tokenize/tokenize.cpp +0 -416
  376. package/src/llama.cpp/tools/tts/CMakeLists.txt +0 -5
  377. package/src/llama.cpp/tools/tts/tts.cpp +0 -1092
@@ -1,623 +0,0 @@
1
- #include "convert.hpp"
2
- #include "dequantize.hpp"
3
- #include "presets.hpp"
4
-
5
- template <int qk, int qr, dequantize_kernel_t dequantize_kernel, typename dst_t>
6
- static void dequantize_block(const void * __restrict__ vx, dst_t * __restrict__ y, const int64_t k,
7
- const sycl::nd_item<3> &item_ct1) {
8
- const int64_t i = 2 * (item_ct1.get_local_range(2) * item_ct1.get_group(2) +
9
- item_ct1.get_local_id(2));
10
-
11
- if (i >= k) {
12
- return;
13
- }
14
-
15
- const int64_t ib = i/qk; // block index
16
- const int64_t iqs = (i%qk)/qr; // quant index
17
- const int64_t iybs = i - i%qk; // y block start index
18
- const int64_t y_offset = qr == 1 ? 1 : qk/2;
19
-
20
- // dequantize
21
- dfloat2 v;
22
- dequantize_kernel(vx, ib, iqs, v);
23
-
24
- y[iybs + iqs + 0] = v.x();
25
- y[iybs + iqs + y_offset] = v.y();
26
- }
27
-
28
- template <int qk, int qr, dequantize_kernel_t dequantize_kernel, typename dst_t>
29
- static void dequantize_block_sycl(const void *__restrict__ vx,
30
- dst_t *__restrict__ y, const int64_t k,
31
- dpct::queue_ptr stream) {
32
- const int64_t num_blocks = (k + 2*SYCL_DEQUANTIZE_BLOCK_SIZE - 1) / (2*SYCL_DEQUANTIZE_BLOCK_SIZE);
33
- {
34
- dpct::has_capability_or_fail(stream->get_device(),
35
- {sycl::aspect::fp16});
36
- stream->parallel_for(
37
- sycl::nd_range<3>(
38
- sycl::range<3>(1, 1, num_blocks) *
39
- sycl::range<3>(1, 1, SYCL_DEQUANTIZE_BLOCK_SIZE),
40
- sycl::range<3>(1, 1, SYCL_DEQUANTIZE_BLOCK_SIZE)),
41
- [=](sycl::nd_item<3> item_ct1) {
42
- dequantize_block<qk, qr, dequantize_kernel>(vx, y, k, item_ct1);
43
- });
44
- }
45
- }
46
-
47
- template <typename dst_t>
48
- static void dequantize_row_q2_K_sycl(const void *vx, dst_t *y, const int64_t k,
49
- dpct::queue_ptr stream) {
50
- const int64_t nb = k / QK_K;
51
- #if QK_K == 256
52
- {
53
- dpct::has_capability_or_fail(stream->get_device(),
54
- {sycl::aspect::fp16});
55
-
56
- stream->parallel_for(sycl::nd_range<3>(sycl::range<3>(1, 1, nb) *
57
- sycl::range<3>(1, 1, 64),
58
- sycl::range<3>(1, 1, 64)),
59
- [=](sycl::nd_item<3> item_ct1) {
60
- dequantize_block_q2_K(vx, y, item_ct1);
61
- });
62
- }
63
- #else
64
- {
65
- dpct::has_capability_or_fail(stream->get_device(),
66
- {sycl::aspect::fp16});
67
-
68
- stream->parallel_for(sycl::nd_range<3>(sycl::range<3>(1, 1, nb) *
69
- sycl::range<3>(1, 1, 32),
70
- sycl::range<3>(1, 1, 32)),
71
- [=](sycl::nd_item<3> item_ct1) {
72
- dequantize_block_q2_K(vx, y, item_ct1);
73
- });
74
- }
75
-
76
- #endif
77
- }
78
-
79
- template <typename dst_t>
80
- static void dequantize_row_q3_K_sycl(const void *vx, dst_t *y, const int64_t k,
81
- dpct::queue_ptr stream) {
82
- const int64_t nb = k / QK_K;
83
- #if QK_K == 256
84
- {
85
- dpct::has_capability_or_fail(stream->get_device(),
86
- {sycl::aspect::fp16});
87
-
88
- stream->parallel_for(sycl::nd_range<3>(sycl::range<3>(1, 1, nb) *
89
- sycl::range<3>(1, 1, 64),
90
- sycl::range<3>(1, 1, 64)),
91
- [=](sycl::nd_item<3> item_ct1) {
92
- dequantize_block_q3_K(vx, y, item_ct1);
93
- });
94
- }
95
- #else
96
- {
97
- dpct::has_capability_or_fail(stream->get_device(),
98
- {sycl::aspect::fp16});
99
-
100
- stream->parallel_for(sycl::nd_range<3>(sycl::range<3>(1, 1, nb) *
101
- sycl::range<3>(1, 1, 32),
102
- sycl::range<3>(1, 1, 32)),
103
- [=](sycl::nd_item<3> item_ct1) {
104
- dequantize_block_q3_K(vx, y, item_ct1);
105
- });
106
- }
107
- #endif
108
- }
109
-
110
- template <typename dst_t>
111
- static void dequantize_row_q4_0_sycl(const void *vx, dst_t *y, const int64_t k,
112
- dpct::queue_ptr stream) {
113
- const int64_t nb32 = k / 32;
114
- const int64_t nb = (k + 255) / 256;
115
- {
116
- dpct::has_capability_or_fail(stream->get_device(),
117
- {sycl::aspect::fp16});
118
-
119
- stream->parallel_for(sycl::nd_range<3>(sycl::range<3>(1, 1, nb) *
120
- sycl::range<3>(1, 1, 32),
121
- sycl::range<3>(1, 1, 32)),
122
- [=](sycl::nd_item<3> item_ct1) {
123
- dequantize_block_q4_0(vx, y, nb32, item_ct1);
124
- });
125
- }
126
- }
127
-
128
- template <typename dst_t>
129
- static void dequantize_row_q4_0_sycl_reorder(const void *vx, dst_t *y, const int64_t k,
130
- dpct::queue_ptr stream) {
131
-
132
- dpct::has_capability_or_fail(stream->get_device(),
133
- {sycl::aspect::fp16});
134
-
135
- int constexpr WARP_K = WARP_SIZE * QK4_0;
136
- const int n_warp = (k + WARP_K - 1) / WARP_K;
137
- GGML_ASSERT(k % 2 == 0);
138
- stream->parallel_for(sycl::nd_range<3>(sycl::range<3>(1, 1, n_warp) *
139
- sycl::range<3>(1, 1, WARP_SIZE),
140
- sycl::range<3>(1, 1, WARP_SIZE)),
141
- [=](sycl::nd_item<3> item_ct1) [[sycl::reqd_sub_group_size(WARP_SIZE)]]{
142
- dequantize_block_q4_0_reorder(vx, y, k, item_ct1);
143
- });
144
-
145
- }
146
-
147
- template <typename dst_t>
148
- static void dequantize_row_q4_1_sycl(const void *vx, dst_t *y, const int64_t k,
149
- dpct::queue_ptr stream) {
150
- const int64_t nb32 = k / 32;
151
- const int64_t nb = (k + 255) / 256;
152
- {
153
- dpct::has_capability_or_fail(stream->get_device(),
154
- {sycl::aspect::fp16});
155
-
156
- stream->parallel_for(sycl::nd_range<3>(sycl::range<3>(1, 1, nb) *
157
- sycl::range<3>(1, 1, 32),
158
- sycl::range<3>(1, 1, 32)),
159
- [=](sycl::nd_item<3> item_ct1) {
160
- dequantize_block_q4_1(vx, y, nb32, item_ct1);
161
- });
162
- }
163
- }
164
-
165
-
166
- template <typename dst_t>
167
- static void dequantize_row_q4_K_sycl(const void *vx, dst_t *y, const int64_t k,
168
- dpct::queue_ptr stream) {
169
- const int64_t nb = k / QK_K;
170
- {
171
- dpct::has_capability_or_fail(stream->get_device(),
172
- {sycl::aspect::fp16});
173
-
174
- stream->submit([&](sycl::handler &cgh) {
175
- sycl::local_accessor<uint8_t, 1> scale_local_acc(sycl::range<1>(12), cgh);
176
- cgh.parallel_for(sycl::nd_range<3>(sycl::range<3>(1, 1, nb) *
177
- sycl::range<3>(1, 1, 32),
178
- sycl::range<3>(1, 1, 32)),
179
- [=](sycl::nd_item<3> item_ct1) {
180
- dequantize_block_q4_K(vx, y, get_pointer(scale_local_acc), item_ct1);
181
- });
182
- });
183
- }
184
- }
185
-
186
- template <typename dst_t>
187
- static void dequantize_row_q4_K_sycl_reorder(const void * vx, dst_t * y, const int64_t k, dpct::queue_ptr stream) {
188
- const int64_t nb = k / QK_K;
189
- const size_t local_size = 32;
190
- const size_t global_size = nb * local_size;
191
-
192
- dpct::has_capability_or_fail(stream->get_device(), { sycl::aspect::fp16 });
193
-
194
- stream->submit([&](sycl::handler & cgh) {
195
- sycl::local_accessor<uint8_t, 1> scale_local_acc(sycl::range<1>(12), cgh);
196
-
197
- cgh.parallel_for(sycl::nd_range<1>(sycl::range<1>(global_size), sycl::range<1>(local_size)),
198
- [=](sycl::nd_item<1> item_ct1) {
199
- dequantize_block_q4_K_reorder(vx, y, get_pointer(scale_local_acc), item_ct1, nb);
200
- });
201
- });
202
- }
203
-
204
- template <typename dst_t>
205
- static void dequantize_row_q5_K_sycl(const void *vx, dst_t *y, const int64_t k,
206
- dpct::queue_ptr stream) {
207
- const int64_t nb = k / QK_K;
208
- #if QK_K == 256
209
- {
210
- dpct::has_capability_or_fail(stream->get_device(),
211
- {sycl::aspect::fp16});
212
-
213
- stream->parallel_for(sycl::nd_range<3>(sycl::range<3>(1, 1, nb) *
214
- sycl::range<3>(1, 1, 64),
215
- sycl::range<3>(1, 1, 64)),
216
- [=](sycl::nd_item<3> item_ct1) {
217
- dequantize_block_q5_K(vx, y, item_ct1);
218
- });
219
- }
220
- #else
221
- {
222
- dpct::has_capability_or_fail(stream->get_device(),
223
- {sycl::aspect::fp16});
224
-
225
- stream->parallel_for(sycl::nd_range<3>(sycl::range<3>(1, 1, nb) *
226
- sycl::range<3>(1, 1, 32),
227
- sycl::range<3>(1, 1, 32)),
228
- [=](sycl::nd_item<3> item_ct1) {
229
- dequantize_block_q5_K(vx, y, item_ct1);
230
- });
231
- }
232
-
233
- #endif
234
- }
235
-
236
- template <typename dst_t>
237
- static void dequantize_row_q6_K_sycl(const void *vx, dst_t *y, const int64_t k,
238
- dpct::queue_ptr stream) {
239
- const int64_t nb = k / QK_K;
240
- #if QK_K == 256
241
- {
242
- dpct::has_capability_or_fail(stream->get_device(),
243
- {sycl::aspect::fp16});
244
-
245
- stream->parallel_for(sycl::nd_range<3>(sycl::range<3>(1, 1, nb) *
246
- sycl::range<3>(1, 1, 64),
247
- sycl::range<3>(1, 1, 64)),
248
- [=](sycl::nd_item<3> item_ct1) {
249
- dequantize_block_q6_K(vx, y, item_ct1);
250
- });
251
- }
252
- #else
253
- {
254
- dpct::has_capability_or_fail(stream->get_device(),
255
- {sycl::aspect::fp16});
256
-
257
- stream->parallel_for(sycl::nd_range<3>(sycl::range<3>(1, 1, nb) *
258
- sycl::range<3>(1, 1, 32),
259
- sycl::range<3>(1, 1, 32)),
260
- [=](sycl::nd_item<3> item_ct1) {
261
- dequantize_block_q6_K(vx, y, item_ct1);
262
- });
263
- }
264
-
265
- #endif
266
- }
267
-
268
- template <typename dst_t>
269
- static void dequantize_row_iq1_s_sycl(const void *vx, dst_t *y, const int64_t k,
270
- dpct::queue_ptr stream) {
271
- const int64_t nb = k / QK_K;
272
- {
273
- dpct::has_capability_or_fail(stream->get_device(),
274
- {sycl::aspect::fp16});
275
-
276
- stream->submit([&](sycl::handler &cgh) {
277
- cgh.parallel_for(sycl::nd_range<3>(sycl::range<3>(1, 1, nb) *
278
- sycl::range<3>(1, 1, 32),
279
- sycl::range<3>(1, 1, 32)),
280
- [=](sycl::nd_item<3> item_ct1) {
281
- dequantize_block_iq1_s(
282
- vx, y, item_ct1, iq1s_grid_gpu
283
- );
284
- });
285
- });
286
- }
287
- }
288
-
289
- template <typename dst_t>
290
- static void dequantize_row_iq1_m_sycl(const void *vx, dst_t *y, const int64_t k,
291
- dpct::queue_ptr stream) {
292
- const int64_t nb = k / QK_K;
293
- {
294
- dpct::has_capability_or_fail(stream->get_device(),
295
- {sycl::aspect::fp16});
296
-
297
- stream->submit([&](sycl::handler &cgh) {
298
- cgh.parallel_for(sycl::nd_range<3>(sycl::range<3>(1, 1, nb) *
299
- sycl::range<3>(1, 1, 32),
300
- sycl::range<3>(1, 1, 32)),
301
- [=](sycl::nd_item<3> item_ct1) {
302
- dequantize_block_iq1_m(
303
- vx, y, item_ct1, iq1s_grid_gpu
304
- );
305
- });
306
- });
307
- }
308
- }
309
-
310
- template <typename dst_t>
311
- static void dequantize_row_iq2_xxs_sycl(const void *vx, dst_t *y, const int64_t k,
312
- dpct::queue_ptr stream) {
313
- const int64_t nb = k / QK_K;
314
- {
315
- dpct::has_capability_or_fail(stream->get_device(),
316
- {sycl::aspect::fp16});
317
-
318
- stream->submit([&](sycl::handler &cgh) {
319
- cgh.parallel_for(sycl::nd_range<3>(sycl::range<3>(1, 1, nb) *
320
- sycl::range<3>(1, 1, 32),
321
- sycl::range<3>(1, 1, 32)),
322
- [=](sycl::nd_item<3> item_ct1) {
323
- dequantize_block_iq2_xxs(
324
- vx, y, item_ct1, iq2xxs_grid,
325
- ksigns_iq2xs, kmask_iq2xs);
326
- });
327
- });
328
- }
329
- }
330
-
331
- template <typename dst_t>
332
- static void dequantize_row_iq2_xs_sycl(const void *vx, dst_t *y, const int64_t k,
333
- dpct::queue_ptr stream) {
334
- const int64_t nb = k / QK_K;
335
- {
336
- dpct::has_capability_or_fail(stream->get_device(),
337
- {sycl::aspect::fp16});
338
-
339
- stream->submit([&](sycl::handler &cgh) {
340
- cgh.parallel_for(sycl::nd_range<3>(sycl::range<3>(1, 1, nb) *
341
- sycl::range<3>(1, 1, 32),
342
- sycl::range<3>(1, 1, 32)),
343
- [=](sycl::nd_item<3> item_ct1) {
344
- dequantize_block_iq2_xs(
345
- vx, y, item_ct1, iq2xs_grid,
346
- ksigns_iq2xs, kmask_iq2xs);
347
- });
348
- });
349
- }
350
- }
351
-
352
- template <typename dst_t>
353
- static void dequantize_row_iq2_s_sycl(const void *vx, dst_t *y, const int64_t k,
354
- dpct::queue_ptr stream) {
355
- const int64_t nb = k / QK_K;
356
- {
357
- dpct::has_capability_or_fail(stream->get_device(),
358
- {sycl::aspect::fp16});
359
-
360
- stream->submit([&](sycl::handler &cgh) {
361
- cgh.parallel_for(sycl::nd_range<3>(sycl::range<3>(1, 1, nb) *
362
- sycl::range<3>(1, 1, 32),
363
- sycl::range<3>(1, 1, 32)),
364
- [=](sycl::nd_item<3> item_ct1) {
365
- dequantize_block_iq2_s(vx, y, item_ct1);
366
- });
367
- });
368
- }
369
- }
370
-
371
-
372
- template <typename dst_t>
373
- static void dequantize_row_iq3_xxs_sycl(const void *vx, dst_t *y, const int64_t k,
374
- dpct::queue_ptr stream) {
375
- const int64_t nb = k / QK_K;
376
- {
377
- dpct::has_capability_or_fail(stream->get_device(),
378
- {sycl::aspect::fp16});
379
-
380
- stream->submit([&](sycl::handler &cgh) {
381
- cgh.parallel_for(sycl::nd_range<3>(sycl::range<3>(1, 1, nb) *
382
- sycl::range<3>(1, 1, 32),
383
- sycl::range<3>(1, 1, 32)),
384
- [=](sycl::nd_item<3> item_ct1) {
385
- dequantize_block_iq3_xxs(
386
- vx, y, item_ct1, iq3xxs_grid,
387
- ksigns_iq2xs, kmask_iq2xs);
388
- });
389
- });
390
- }
391
- }
392
-
393
- template <typename dst_t>
394
- static void dequantize_row_iq3_s_sycl(const void *vx, dst_t *y, const int64_t k,
395
- dpct::queue_ptr stream) {
396
- const int64_t nb = k / QK_K;
397
- {
398
- dpct::has_capability_or_fail(stream->get_device(),
399
- {sycl::aspect::fp16});
400
-
401
- stream->submit([&](sycl::handler &cgh) {
402
- cgh.parallel_for(sycl::nd_range<3>(sycl::range<3>(1, 1, nb) *
403
- sycl::range<3>(1, 1, 32),
404
- sycl::range<3>(1, 1, 32)),
405
- [=](sycl::nd_item<3> item_ct1) {
406
- dequantize_block_iq3_s(
407
- vx, y, item_ct1, kmask_iq2xs, iq3s_grid);
408
- });
409
- });
410
- }
411
- }
412
-
413
- template <typename dst_t>
414
- static void dequantize_row_iq4_xs_sycl(const void *vx, dst_t *y, const int64_t k,
415
- dpct::queue_ptr stream) {
416
- const int64_t nb = (k + QK_K - 1) / QK_K;
417
- #if QK_K == 64
418
- dequantize_row_iq4_nl_sycl(vx, y, k, stream);
419
- #else
420
- {
421
- dpct::has_capability_or_fail(stream->get_device(),
422
- {sycl::aspect::fp16});
423
-
424
- stream->submit([&](sycl::handler &cgh) {
425
- cgh.parallel_for(
426
- sycl::nd_range<3>(sycl::range<3>(1, 1, nb) *
427
- sycl::range<3>(1, 1, 32),
428
- sycl::range<3>(1, 1, 32)),
429
- [=](sycl::nd_item<3> item_ct1) {
430
- dequantize_block_iq4_xs(vx, y, item_ct1);
431
- });
432
- });
433
- }
434
- #endif
435
- }
436
-
437
- template <typename dst_t>
438
- static void dequantize_row_iq4_nl_sycl(const void *vx, dst_t *y, const int64_t k,
439
- dpct::queue_ptr stream) {
440
- const int64_t nb = (k + QK_K - 1) / QK_K;
441
- {
442
- dpct::has_capability_or_fail(stream->get_device(),
443
- {sycl::aspect::fp16});
444
-
445
- stream->submit([&](sycl::handler &cgh) {
446
- cgh.parallel_for(
447
- sycl::nd_range<3>(sycl::range<3>(1, 1, nb) *
448
- sycl::range<3>(1, 1, 32),
449
- sycl::range<3>(1, 1, 32)),
450
- [=](sycl::nd_item<3> item_ct1) {
451
- dequantize_block_iq4_nl(vx, y, item_ct1);
452
- });
453
- });
454
- }
455
- }
456
-
457
- template <typename src_t, typename dst_t>
458
- static void convert_unary_nc(const void * __restrict__ vx, dst_t * __restrict__ y, const int64_t ne00, const int64_t ne01,
459
- const int64_t ne02, const int64_t s01, const int64_t s02, const int64_t s03,
460
- const sycl::nd_item<3> & item_ct1) {
461
-
462
- const int64_t work_group_size = item_ct1.get_local_range(2);
463
- const int64_t global_id = item_ct1.get_local_id(2) + work_group_size * item_ct1.get_group(2);
464
-
465
- const int64_t i01 = item_ct1.get_group(1);
466
- const int64_t i02 = item_ct1.get_group(0) % ne02;
467
- const int64_t i03 = item_ct1.get_group(0) / ne02;
468
-
469
- // make each work-item deal with more elements since sycl global range can not exceed max int
470
- const src_t * x = static_cast<const src_t *>(vx);
471
- const int64_t ix = i03 * s03 + i02 * s02 + i01 * s01;
472
- const int64_t iy = ((i03 * ne02 + i02) * ne01 + i01) * ne00;
473
-
474
- #pragma unroll
475
- for (int64_t i00 = global_id; i00 < ne00; i00 += work_group_size * item_ct1.get_group_range(2)) {
476
- y[iy + i00] = static_cast<dst_t>(x[ix + i00]);
477
- }
478
- }
479
-
480
- template <typename src_t, typename dst_t>
481
- static void convert_unary_nc_sycl(const void * __restrict__ vx, dst_t * __restrict__ y,
482
- const int64_t ne00, const int64_t ne01, const int64_t ne02, const int64_t ne03,
483
- const int64_t s01, const int64_t s02, const int64_t s03, dpct::queue_ptr queue) {
484
- dpct::has_capability_or_fail(queue->get_device(), { sycl::aspect::fp16 });
485
-
486
- sycl::range<3> global_size(ne02 * ne03, ne01, ceil_div(ne00, SYCL_DEQUANTIZE_BLOCK_SIZE));
487
-
488
- // decrease global range when it exceeds the max int
489
- // TODO: Downsample logic is separated from the kernel, a rewrite is desirable
490
- int64_t downsized_workgroup = downsample_sycl_global_range(global_size[0], SYCL_DEQUANTIZE_BLOCK_SIZE);
491
- sycl::range<3> workgroup_size(1, 1, downsized_workgroup);
492
-
493
- queue->parallel_for(sycl::nd_range<3>(global_size * workgroup_size, workgroup_size), [=](sycl::nd_item<3> item_ct1) {
494
- convert_unary_nc<src_t>(vx, y, ne00, ne01, ne02, s01, s02, s03, item_ct1);
495
- });
496
- }
497
-
498
- template <typename src_t, typename dst_t>
499
- static void convert_unary_sycl(const void * vx, dst_t * y, const int64_t k, dpct::queue_ptr queue) {
500
- convert_unary_nc_sycl<src_t>(vx, y, k, 1, 1, 1, k, k, k, queue);
501
- }
502
-
503
- to_fp16_sycl_t ggml_get_to_fp16_sycl(ggml_type type, ggml_tensor * dst) {
504
- switch (type) {
505
- case GGML_TYPE_Q4_0:
506
- if (dst->src[0]->extra &&
507
- ((ggml_tensor_extra_gpu*)dst->src[0]->extra)->optimized_feature.reorder) {
508
- return dequantize_row_q4_0_sycl_reorder;
509
- } else {
510
- return dequantize_block_sycl<QK4_0, QR4_0, dequantize_q4_0>;
511
- }
512
- case GGML_TYPE_Q4_1:
513
- return dequantize_block_sycl<QK4_1, QR4_1, dequantize_q4_1>;
514
- case GGML_TYPE_Q5_0:
515
- return dequantize_block_sycl<QK5_0, QR5_0, dequantize_q5_0>;
516
- case GGML_TYPE_Q5_1:
517
- return dequantize_block_sycl<QK5_1, QR5_1, dequantize_q5_1>;
518
- case GGML_TYPE_Q8_0:
519
- return dequantize_block_sycl<QK8_0, QR8_0, dequantize_q8_0>;
520
- case GGML_TYPE_Q2_K:
521
- return dequantize_row_q2_K_sycl;
522
- case GGML_TYPE_Q3_K:
523
- return dequantize_row_q3_K_sycl;
524
- case GGML_TYPE_Q4_K:
525
- if (dst->src[0]->extra && ((ggml_tensor_extra_gpu *) dst->src[0]->extra)->optimized_feature.reorder) {
526
- return dequantize_row_q4_K_sycl_reorder;
527
- } else {
528
- return dequantize_row_q4_K_sycl;
529
- }
530
- case GGML_TYPE_Q5_K:
531
- return dequantize_row_q5_K_sycl;
532
- case GGML_TYPE_Q6_K:
533
- return dequantize_row_q6_K_sycl;
534
- case GGML_TYPE_IQ1_S:
535
- return dequantize_row_iq1_s_sycl;
536
- case GGML_TYPE_IQ1_M:
537
- return dequantize_row_iq1_m_sycl;
538
- case GGML_TYPE_IQ2_XXS:
539
- return dequantize_row_iq2_xxs_sycl;
540
- case GGML_TYPE_IQ2_XS:
541
- return dequantize_row_iq2_xs_sycl;
542
- case GGML_TYPE_IQ2_S:
543
- return dequantize_row_iq2_s_sycl;
544
- case GGML_TYPE_IQ3_XXS:
545
- return dequantize_row_iq3_xxs_sycl;
546
- case GGML_TYPE_IQ3_S:
547
- return dequantize_row_iq3_s_sycl;
548
- case GGML_TYPE_IQ4_XS:
549
- return dequantize_row_iq4_xs_sycl;
550
- case GGML_TYPE_IQ4_NL:
551
- return dequantize_row_iq4_nl_sycl;
552
- case GGML_TYPE_F32:
553
- return convert_unary_sycl<float>;
554
- default:
555
- return nullptr;
556
- }
557
- }
558
-
559
- to_fp32_sycl_t ggml_get_to_fp32_sycl(ggml_type type, ggml_tensor *dst) {
560
- switch (type) {
561
- case GGML_TYPE_Q4_0:
562
- if (dst->src[0]->extra &&
563
- ((ggml_tensor_extra_gpu*)dst->src[0]->extra)->optimized_feature.reorder) {
564
- return dequantize_row_q4_0_sycl_reorder;
565
- } else {
566
- return dequantize_row_q4_0_sycl;
567
- }
568
- case GGML_TYPE_Q4_1:
569
- return dequantize_row_q4_1_sycl;
570
- case GGML_TYPE_Q5_0:
571
- return dequantize_block_sycl<QK5_0, QR5_0, dequantize_q5_0>;
572
- case GGML_TYPE_Q5_1:
573
- return dequantize_block_sycl<QK5_1, QR5_1, dequantize_q5_1>;
574
- case GGML_TYPE_Q8_0:
575
- return dequantize_block_sycl<QK8_0, QR8_0, dequantize_q8_0>;
576
- case GGML_TYPE_Q2_K:
577
- return dequantize_row_q2_K_sycl;
578
- case GGML_TYPE_Q3_K:
579
- return dequantize_row_q3_K_sycl;
580
- case GGML_TYPE_Q4_K:
581
- if (dst->src[0]->extra &&
582
- ((ggml_tensor_extra_gpu*)dst->src[0]->extra)->optimized_feature.reorder) {
583
- return dequantize_row_q4_K_sycl_reorder;
584
- } else {
585
- return dequantize_row_q4_K_sycl;
586
- }
587
- case GGML_TYPE_Q5_K:
588
- return dequantize_row_q5_K_sycl;
589
- case GGML_TYPE_Q6_K:
590
- return dequantize_row_q6_K_sycl;
591
- case GGML_TYPE_IQ1_S:
592
- return dequantize_row_iq1_s_sycl;
593
- case GGML_TYPE_IQ1_M:
594
- return dequantize_row_iq1_m_sycl;
595
- case GGML_TYPE_IQ2_XXS:
596
- return dequantize_row_iq2_xxs_sycl;
597
- case GGML_TYPE_IQ2_XS:
598
- return dequantize_row_iq2_xs_sycl;
599
- case GGML_TYPE_IQ2_S:
600
- return dequantize_row_iq2_s_sycl;
601
- case GGML_TYPE_IQ3_XXS:
602
- return dequantize_row_iq3_xxs_sycl;
603
- case GGML_TYPE_IQ3_S:
604
- return dequantize_row_iq3_s_sycl;
605
- case GGML_TYPE_IQ4_XS:
606
- return dequantize_row_iq4_xs_sycl;
607
- case GGML_TYPE_IQ4_NL:
608
- return dequantize_row_iq4_nl_sycl;
609
- case GGML_TYPE_F16:
610
- return convert_unary_sycl<sycl::half>;
611
- default:
612
- return nullptr;
613
- }
614
- }
615
-
616
- to_fp16_nc_sycl_t get_to_fp16_nc_sycl(ggml_type type) {
617
- switch (type) {
618
- case GGML_TYPE_F32:
619
- return convert_unary_nc_sycl<float>;
620
- default:
621
- return nullptr;
622
- }
623
- }
@@ -1,34 +0,0 @@
1
- //
2
- // MIT license
3
- // Copyright (C) 2025 Intel Corporation
4
- // SPDX-License-Identifier: MIT
5
- //
6
-
7
- //
8
- // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
9
- // See https://llvm.org/LICENSE.txt for license information.
10
- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
11
- //
12
-
13
- #ifndef GGML_SYCL_CONVERT_HPP
14
- #define GGML_SYCL_CONVERT_HPP
15
-
16
- #include "common.hpp"
17
-
18
- template <typename T>
19
- using to_t_sycl_t = void (*)(const void * __restrict__ x, T * __restrict__ y, int64_t k, dpct::queue_ptr stream);
20
- typedef to_t_sycl_t<float> to_fp32_sycl_t;
21
- typedef to_t_sycl_t<sycl::half> to_fp16_sycl_t;
22
-
23
- to_fp16_sycl_t ggml_get_to_fp16_sycl(ggml_type type, ggml_tensor * dst);
24
- to_fp32_sycl_t ggml_get_to_fp32_sycl(ggml_type type, ggml_tensor * dst);
25
-
26
- // Nc = Non-contiguous
27
- template <typename T>
28
- using to_t_nc_sycl_t = void (*)(const void * x, T * y, int64_t ne00, int64_t ne01, int64_t ne02, int64_t ne03,
29
- int64_t s01, int64_t s02, int64_t s03, dpct::queue_ptr queue);
30
-
31
- typedef to_t_nc_sycl_t<sycl::half> to_fp16_nc_sycl_t;
32
- to_fp16_nc_sycl_t get_to_fp16_nc_sycl(ggml_type type);
33
-
34
- #endif // GGML_SYCL_CONVERT_HPP