@fugood/llama.node 0.6.3 → 1.0.0-beta.2

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 +40 -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,1108 +0,0 @@
1
- #include "mmvq.hpp"
2
-
3
- #include "ggml.h"
4
- #include "common.hpp"
5
- #include "quants.hpp"
6
- #include "vecdotq.hpp"
7
-
8
- template <typename reorder_vec_dot_q_sycl>
9
- static void mul_mat_vec_q_reorder(const void * __restrict__ vx, const void * __restrict__ vy, float * __restrict__ dst,
10
- const int ncols, const int nrows, const sycl::nd_item<3> & nd_item) {
11
- using block_type = ggml_sycl_reordered::block_q_t<reorder_vec_dot_q_sycl::gtype>;
12
- using block_traits = typename block_type::traits;
13
-
14
- const auto sg = nd_item.get_sub_group();
15
- const int sg_range = sg.get_group_linear_range();
16
- const int workgroup_id = nd_item.get_group_linear_id();
17
- const int sg_id = sg.get_group_linear_id();
18
- const int row = workgroup_id * sg_range + sg_id;
19
-
20
- if (row >= nrows) {
21
- return;
22
- }
23
-
24
- const int blocks_per_row = ncols / block_traits::qk;
25
- constexpr int blocks_per_subgroup = ceil_div(block_traits::vdr_mmvq * WARP_SIZE, block_traits::qi);
26
- constexpr int block_elements_per_subgroup = block_traits::qi / block_traits::vdr_mmvq;
27
- const int nblocks = nrows * (ncols / block_traits::qk);
28
-
29
- static_assert(blocks_per_subgroup > 0);
30
- static_assert(block_elements_per_subgroup > 0);
31
-
32
- const block_q8_1 * y = (const block_q8_1 *) vy;
33
-
34
- float partial_sum = 0.0f;
35
- for (int i = sg.get_local_linear_id() / block_elements_per_subgroup; i < blocks_per_row; i += blocks_per_subgroup) {
36
- const int ibx = row * blocks_per_row + i; // x block index
37
- // TODO: Generalize offsets, right now only works for quantizations that don't split high and low bits
38
- const int bx_offset = block_type::get_block_offset(ibx);
39
- const int d_offset = block_type::get_d_offset(nrows, ncols, ibx);
40
-
41
- // Y block index that aligns with ibx
42
- const int iby = i * block_type::block_to_q8_1_ratio();
43
-
44
- #pragma unroll
45
- for (int elem = 0; elem < block_elements_per_subgroup; elem += WARP_SIZE) {
46
- // x block quant index when casting the quants to int
47
- const int iqs = elem + block_traits::vdr_mmvq * (sg.get_local_linear_id() % block_elements_per_subgroup);
48
-
49
- partial_sum += reorder_vec_dot_q_sycl()(vx, bx_offset, d_offset, &y[iby], iqs, nblocks);
50
- }
51
- }
52
-
53
- auto sum = sycl::reduce_over_group(nd_item.get_sub_group(), partial_sum, std::plus<>());
54
-
55
- if (sg.leader()) {
56
- dst[row] = sum;
57
- }
58
- }
59
-
60
- template <int qk, int qi, typename block_q_t, int vdr, vec_dot_q_sycl_t vec_dot_q_sycl>
61
- static void mul_mat_vec_q(const void * __restrict__ vx, const void * __restrict__ vy, float * __restrict__ dst,
62
- const int ncols, const int nrows, const sycl::nd_item<3> & item_ct1) {
63
- const int row = item_ct1.get_group(2) * item_ct1.get_local_range(1) + item_ct1.get_local_id(1);
64
-
65
- if (row >= nrows) {
66
- return;
67
- }
68
-
69
- const int blocks_per_row = ncols / qk;
70
- constexpr int blocks_per_warp = (vdr * WARP_SIZE + qi - 1) / qi; // Ensuring blocks_per_warp > 0
71
-
72
- assert(blocks_per_warp > 0);
73
-
74
- // partial sum for each thread
75
- float tmp = 0.0f;
76
-
77
- const block_q_t * x = (const block_q_t *) vx;
78
- const block_q8_1 * y = (const block_q8_1 *) vy;
79
-
80
- for (int i = item_ct1.get_local_id(2) / (qi / vdr); i < blocks_per_row; i += blocks_per_warp) {
81
- const int ibx = row * blocks_per_row + i; // x block index
82
-
83
- const int iby = i * (qk / QK8_1); // y block index that aligns with ibx
84
-
85
- for (size_t elem = 0; elem < qi / vdr; elem += WARP_SIZE) {
86
- const int iqs = elem + vdr * (item_ct1.get_local_id(2) %
87
- (qi / vdr)); // x block quant index when casting the quants to int
88
-
89
- tmp += vec_dot_q_sycl(&x[ibx], &y[iby], iqs);
90
- }
91
- }
92
-
93
- // sum up partial sums and write back result
94
- #pragma unroll
95
- for (int mask = WARP_SIZE / 2; mask > 0; mask >>= 1) {
96
- tmp += dpct::permute_sub_group_by_xor(item_ct1.get_sub_group(), tmp, mask);
97
- }
98
-
99
- if (item_ct1.get_local_id(2) == 0) {
100
- dst[row] = tmp;
101
- }
102
- }
103
-
104
- template <int qk, int qi, typename block_q_t, int vdr>
105
- static void mul_mat_vec_q_iq2_xxs_q8_1(const void *__restrict__ vx,
106
- const void *__restrict__ vy,
107
- float *__restrict__ dst, const int ncols,
108
- const int nrows,
109
- const sycl::nd_item<3> &item_ct1) {
110
- const int row = item_ct1.get_group(2) * item_ct1.get_local_range(1) +
111
- item_ct1.get_local_id(1);
112
-
113
- if (row >= nrows) {
114
- return;
115
- }
116
-
117
- const int blocks_per_row = ncols / qk;
118
- const int blocks_per_warp = vdr * WARP_SIZE / qi;
119
- assert(blocks_per_warp>0);
120
-
121
- // partial sum for each thread
122
- float tmp = 0.0f;
123
-
124
- const block_q_t * x = (const block_q_t *) vx;
125
- const block_q8_1 * y = (const block_q8_1 *) vy;
126
-
127
- for (int i = item_ct1.get_local_id(2) / (qi / vdr); i < blocks_per_row;
128
- i += blocks_per_warp) {
129
- const int ibx = row*blocks_per_row + i; // x block index
130
-
131
- const int iby = i * (qk/QK8_1); // y block index that aligns with ibx
132
-
133
- const int iqs =
134
- vdr *
135
- (item_ct1.get_local_id(2) %
136
- (qi / vdr)); // x block quant index when casting the quants to int
137
-
138
- tmp += vec_dot_iq2_xxs_q8_1(&x[ibx], &y[iby], iqs, iq2xxs_grid, ksigns_iq2xs, kmask_iq2xs);
139
- }
140
-
141
- // sum up partial sums and write back result
142
- #pragma unroll
143
- for (int mask = WARP_SIZE / 2; mask > 0; mask >>= 1) {
144
- tmp +=
145
- dpct::permute_sub_group_by_xor(item_ct1.get_sub_group(), tmp, mask);
146
- }
147
-
148
- if (item_ct1.get_local_id(2) == 0) {
149
- dst[row] = tmp;
150
- }
151
- }
152
-
153
- template <int qk, int qi, typename block_q_t, int vdr>
154
- static void mul_mat_vec_q_iq2_xs_q8_1(const void *__restrict__ vx,
155
- const void *__restrict__ vy,
156
- float *__restrict__ dst, const int ncols,
157
- const int nrows,
158
- const sycl::nd_item<3> &item_ct1) {
159
- const int row = item_ct1.get_group(2) * item_ct1.get_local_range(1) +
160
- item_ct1.get_local_id(1);
161
-
162
- if (row >= nrows) {
163
- return;
164
- }
165
-
166
- const int blocks_per_row = ncols / qk;
167
- const int blocks_per_warp = vdr * WARP_SIZE / qi;
168
- assert(blocks_per_warp>0);
169
- // partial sum for each thread
170
- float tmp = 0.0f;
171
-
172
- const block_q_t * x = (const block_q_t *) vx;
173
- const block_q8_1 * y = (const block_q8_1 *) vy;
174
-
175
- for (int i = item_ct1.get_local_id(2) / (qi / vdr); i < blocks_per_row;
176
- i += blocks_per_warp) {
177
- const int ibx = row*blocks_per_row + i; // x block index
178
-
179
- const int iby = i * (qk/QK8_1); // y block index that aligns with ibx
180
-
181
- const int iqs =
182
- vdr *
183
- (item_ct1.get_local_id(2) %
184
- (qi / vdr)); // x block quant index when casting the quants to int
185
-
186
- tmp += vec_dot_iq2_xs_q8_1(&x[ibx], &y[iby], iqs, iq2xs_grid, ksigns64);
187
- }
188
-
189
- // sum up partial sums and write back result
190
- #pragma unroll
191
- for (int mask = WARP_SIZE / 2; mask > 0; mask >>= 1) {
192
- tmp +=
193
- dpct::permute_sub_group_by_xor(item_ct1.get_sub_group(), tmp, mask);
194
- }
195
-
196
- if (item_ct1.get_local_id(2) == 0) {
197
- dst[row] = tmp;
198
- }
199
- }
200
-
201
- template <int qk, int qi, typename block_q_t, int vdr>
202
- static void mul_mat_vec_q_iq2_s_q8_1(const void *__restrict__ vx,
203
- const void *__restrict__ vy,
204
- float *__restrict__ dst, const int ncols,
205
- const int nrows,
206
- const sycl::nd_item<3> &item_ct1) {
207
- const int row = item_ct1.get_group(2) * item_ct1.get_local_range(1) +
208
- item_ct1.get_local_id(1);
209
-
210
- if (row >= nrows) {
211
- return;
212
- }
213
-
214
- const int blocks_per_row = ncols / qk;
215
- const int blocks_per_warp = vdr * WARP_SIZE / qi;
216
- assert(blocks_per_warp>0);
217
- // partial sum for each thread
218
- float tmp = 0.0f;
219
-
220
- const block_q_t * x = (const block_q_t *) vx;
221
- const block_q8_1 * y = (const block_q8_1 *) vy;
222
-
223
- for (int i = item_ct1.get_local_id(2) / (qi / vdr); i < blocks_per_row;
224
- i += blocks_per_warp) {
225
- const int ibx = row*blocks_per_row + i; // x block index
226
-
227
- const int iby = i * (qk/QK8_1); // y block index that aligns with ibx
228
-
229
- const int iqs =
230
- vdr *
231
- (item_ct1.get_local_id(2) %
232
- (qi / vdr)); // x block quant index when casting the quants to int
233
-
234
- tmp += vec_dot_iq2_s_q8_1(&x[ibx], &y[iby], iqs);
235
- }
236
-
237
- // sum up partial sums and write back result
238
- #pragma unroll
239
- for (int mask = WARP_SIZE / 2; mask > 0; mask >>= 1) {
240
- tmp +=
241
- dpct::permute_sub_group_by_xor(item_ct1.get_sub_group(), tmp, mask);
242
- }
243
-
244
- if (item_ct1.get_local_id(2) == 0) {
245
- dst[row] = tmp;
246
- }
247
- }
248
-
249
- template <int qk, int qi, typename block_q_t, int vdr>
250
- static void mul_mat_vec_q_iq3_xxs_q8_1(const void *__restrict__ vx,
251
- const void *__restrict__ vy,
252
- float *__restrict__ dst, const int ncols,
253
- const int nrows,
254
- const sycl::nd_item<3> &item_ct1) {
255
- const int row = item_ct1.get_group(2) * item_ct1.get_local_range(1) +
256
- item_ct1.get_local_id(1);
257
-
258
- if (row >= nrows) {
259
- return;
260
- }
261
-
262
- const int blocks_per_row = ncols / qk;
263
- const int blocks_per_warp = vdr * WARP_SIZE / qi;
264
- assert(blocks_per_warp>0);
265
- // partial sum for each thread
266
- float tmp = 0.0f;
267
-
268
- const block_q_t * x = (const block_q_t *) vx;
269
- const block_q8_1 * y = (const block_q8_1 *) vy;
270
-
271
- for (int i = item_ct1.get_local_id(2) / (qi / vdr); i < blocks_per_row;
272
- i += blocks_per_warp) {
273
- const int ibx = row*blocks_per_row + i; // x block index
274
-
275
- const int iby = i * (qk/QK8_1); // y block index that aligns with ibx
276
-
277
- const int iqs =
278
- vdr *
279
- (item_ct1.get_local_id(2) %
280
- (qi / vdr)); // x block quant index when casting the quants to int
281
-
282
- tmp += vec_dot_iq3_xxs_q8_1(&x[ibx], &y[iby], iqs, iq3xxs_grid, ksigns64);
283
- }
284
-
285
- // sum up partial sums and write back result
286
- #pragma unroll
287
- for (int mask = WARP_SIZE / 2; mask > 0; mask >>= 1) {
288
- tmp +=
289
- dpct::permute_sub_group_by_xor(item_ct1.get_sub_group(), tmp, mask);
290
- }
291
-
292
- if (item_ct1.get_local_id(2) == 0) {
293
- dst[row] = tmp;
294
- }
295
- }
296
-
297
- template <int qk, int qi, typename block_q_t, int vdr>
298
- static void mul_mat_vec_q_iq3_s_q8_1(const void *__restrict__ vx,
299
- const void *__restrict__ vy,
300
- float *__restrict__ dst, const int ncols,
301
- const int nrows,
302
- const sycl::nd_item<3> &item_ct1) {
303
- const int row = item_ct1.get_group(2) * item_ct1.get_local_range(1) +
304
- item_ct1.get_local_id(1);
305
-
306
- if (row >= nrows) {
307
- return;
308
- }
309
-
310
- const int blocks_per_row = ncols / qk;
311
- const int blocks_per_warp = vdr * WARP_SIZE / qi;
312
- assert(blocks_per_warp>0);
313
- // partial sum for each thread
314
- float tmp = 0.0f;
315
-
316
- const block_q_t * x = (const block_q_t *) vx;
317
- const block_q8_1 * y = (const block_q8_1 *) vy;
318
-
319
- for (int i = item_ct1.get_local_id(2) / (qi / vdr); i < blocks_per_row;
320
- i += blocks_per_warp) {
321
- const int ibx = row*blocks_per_row + i; // x block index
322
-
323
- const int iby = i * (qk/QK8_1); // y block index that aligns with ibx
324
-
325
- const int iqs =
326
- vdr *
327
- (item_ct1.get_local_id(2) %
328
- (qi / vdr)); // x block quant index when casting the quants to int
329
-
330
- tmp += vec_dot_iq3_s_q8_1(&x[ibx], &y[iby], iqs, iq3s_grid);
331
- }
332
-
333
- // sum up partial sums and write back result
334
- #pragma unroll
335
- for (int mask = WARP_SIZE / 2; mask > 0; mask >>= 1) {
336
- tmp +=
337
- dpct::permute_sub_group_by_xor(item_ct1.get_sub_group(), tmp, mask);
338
- }
339
-
340
- if (item_ct1.get_local_id(2) == 0) {
341
- dst[row] = tmp;
342
- }
343
- }
344
-
345
- template <int qk, int qi, typename block_q_t, int vdr>
346
- static void mul_mat_vec_q_iq1_s_q8_1(const void *__restrict__ vx,
347
- const void *__restrict__ vy,
348
- float *__restrict__ dst, const int ncols,
349
- const int nrows,
350
- const sycl::nd_item<3> &item_ct1) {
351
- const int row = item_ct1.get_group(2) * item_ct1.get_local_range(1) +
352
- item_ct1.get_local_id(1);
353
-
354
- if (row >= nrows) {
355
- return;
356
- }
357
-
358
- const int blocks_per_row = ncols / qk;
359
- const int blocks_per_warp = vdr * WARP_SIZE / qi;
360
- assert(blocks_per_warp>0);
361
- // partial sum for each thread
362
- float tmp = 0.0f;
363
-
364
- const block_q_t * x = (const block_q_t *) vx;
365
- const block_q8_1 * y = (const block_q8_1 *) vy;
366
-
367
- for (int i = item_ct1.get_local_id(2) / (qi / vdr); i < blocks_per_row;
368
- i += blocks_per_warp) {
369
- const int ibx = row*blocks_per_row + i; // x block index
370
-
371
- const int iby = i * (qk/QK8_1); // y block index that aligns with ibx
372
-
373
- const int iqs =
374
- vdr *
375
- (item_ct1.get_local_id(2) %
376
- (qi / vdr)); // x block quant index when casting the quants to int
377
-
378
- tmp += vec_dot_iq1_s_q8_1(&x[ibx], &y[iby], iqs, iq1s_grid_gpu);
379
- }
380
-
381
- // sum up partial sums and write back result
382
- #pragma unroll
383
- for (int mask = WARP_SIZE / 2; mask > 0; mask >>= 1) {
384
- tmp +=
385
- dpct::permute_sub_group_by_xor(item_ct1.get_sub_group(), tmp, mask);
386
- }
387
-
388
- if (item_ct1.get_local_id(2) == 0) {
389
- dst[row] = tmp;
390
- }
391
- }
392
-
393
- template <int qk, int qi, typename block_q_t, int vdr>
394
- static void mul_mat_vec_q_iq1_m_q8_1(const void *__restrict__ vx,
395
- const void *__restrict__ vy,
396
- float *__restrict__ dst, const int ncols,
397
- const int nrows,
398
- const sycl::nd_item<3> &item_ct1) {
399
- const int row = item_ct1.get_group(2) * item_ct1.get_local_range(1) +
400
- item_ct1.get_local_id(1);
401
-
402
- if (row >= nrows) {
403
- return;
404
- }
405
-
406
- const int blocks_per_row = ncols / qk;
407
- const int blocks_per_warp = vdr * WARP_SIZE / qi;
408
- assert(blocks_per_warp>0);
409
- // partial sum for each thread
410
- float tmp = 0.0f;
411
-
412
- const block_q_t * x = (const block_q_t *) vx;
413
- const block_q8_1 * y = (const block_q8_1 *) vy;
414
-
415
- for (int i = item_ct1.get_local_id(2) / (qi / vdr); i < blocks_per_row;
416
- i += blocks_per_warp) {
417
- const int ibx = row*blocks_per_row + i; // x block index
418
-
419
- const int iby = i * (qk/QK8_1); // y block index that aligns with ibx
420
-
421
- const int iqs =
422
- vdr *
423
- (item_ct1.get_local_id(2) %
424
- (qi / vdr)); // x block quant index when casting the quants to int
425
-
426
- tmp += vec_dot_iq1_m_q8_1(&x[ibx], &y[iby], iqs);
427
- }
428
-
429
- // sum up partial sums and write back result
430
- #pragma unroll
431
- for (int mask = WARP_SIZE / 2; mask > 0; mask >>= 1) {
432
- tmp +=
433
- dpct::permute_sub_group_by_xor(item_ct1.get_sub_group(), tmp, mask);
434
- }
435
-
436
- if (item_ct1.get_local_id(2) == 0) {
437
- dst[row] = tmp;
438
- }
439
- }
440
-
441
- template <int qk, int qi, typename block_q_t, int vdr>
442
- static void mul_mat_vec_q_iq4_nl_q8_1(const void *__restrict__ vx,
443
- const void *__restrict__ vy,
444
- float *__restrict__ dst, const int ncols,
445
- const int nrows,
446
- const sycl::nd_item<3> &item_ct1) {
447
- const int row = item_ct1.get_group(2) * item_ct1.get_local_range(1) +
448
- item_ct1.get_local_id(1);
449
-
450
- if (row >= nrows) {
451
- return;
452
- }
453
-
454
- const int blocks_per_row = ncols / qk;
455
- const int blocks_per_warp = vdr * WARP_SIZE / qi;
456
- assert(blocks_per_warp>0);
457
- // partial sum for each thread
458
- float tmp = 0.0f;
459
-
460
- const block_q_t * x = (const block_q_t *) vx;
461
- const block_q8_1 * y = (const block_q8_1 *) vy;
462
-
463
- for (int i = item_ct1.get_local_id(2) / (qi / vdr); i < blocks_per_row;
464
- i += blocks_per_warp) {
465
- const int ibx = row*blocks_per_row + i; // x block index
466
-
467
- const int iby = i * (qk/QK8_1); // y block index that aligns with ibx
468
-
469
- const int iqs =
470
- vdr *
471
- (item_ct1.get_local_id(2) %
472
- (qi / vdr)); // x block quant index when casting the quants to int
473
-
474
- tmp += vec_dot_iq4_nl_q8_1(&x[ibx], &y[iby], iqs);
475
- }
476
-
477
- // sum up partial sums and write back result
478
- #pragma unroll
479
- for (int mask = WARP_SIZE / 2; mask > 0; mask >>= 1) {
480
- tmp +=
481
- dpct::permute_sub_group_by_xor(item_ct1.get_sub_group(), tmp, mask);
482
- }
483
-
484
- if (item_ct1.get_local_id(2) == 0) {
485
- dst[row] = tmp;
486
- }
487
- }
488
-
489
-
490
- template <int qk, int qi, typename block_q_t, int vdr>
491
- static void mul_mat_vec_q_iq4_xs_q8_1(const void *__restrict__ vx,
492
- const void *__restrict__ vy,
493
- float *__restrict__ dst, const int ncols,
494
- const int nrows,
495
- const sycl::nd_item<3> &item_ct1) {
496
- const int row = item_ct1.get_group(2) * item_ct1.get_local_range(1) +
497
- item_ct1.get_local_id(1);
498
-
499
- if (row >= nrows) {
500
- return;
501
- }
502
-
503
- const int blocks_per_row = ncols / qk;
504
- const int blocks_per_warp = vdr * WARP_SIZE / qi;
505
- assert(blocks_per_warp>0);
506
- // partial sum for each thread
507
- float tmp = 0.0f;
508
-
509
- const block_q_t * x = (const block_q_t *) vx;
510
- const block_q8_1 * y = (const block_q8_1 *) vy;
511
-
512
- for (int i = item_ct1.get_local_id(2) / (qi / vdr); i < blocks_per_row;
513
- i += blocks_per_warp) {
514
- const int ibx = row*blocks_per_row + i; // x block index
515
-
516
- const int iby = i * (qk/QK8_1); // y block index that aligns with ibx
517
-
518
- const int iqs =
519
- vdr *
520
- (item_ct1.get_local_id(2) %
521
- (qi / vdr)); // x block quant index when casting the quants to int
522
-
523
- tmp += vec_dot_iq4_xs_q8_1(&x[ibx], &y[iby], iqs);
524
- }
525
-
526
- // sum up partial sums and write back result
527
- #pragma unroll
528
- for (int mask = WARP_SIZE / 2; mask > 0; mask >>= 1) {
529
- tmp +=
530
- dpct::permute_sub_group_by_xor(item_ct1.get_sub_group(), tmp, mask);
531
- }
532
-
533
- if (item_ct1.get_local_id(2) == 0) {
534
- dst[row] = tmp;
535
- }
536
- }
537
-
538
- static void reorder_mul_mat_vec_q4_0_q8_1_sycl(const void * vx, const void * vy, float * dst, const int ncols,
539
- const int nrows, dpct::queue_ptr stream) {
540
- GGML_ASSERT(ncols % QK4_0 == 0);
541
- const int block_num_y = ceil_div(nrows, GGML_SYCL_MMV_Y);
542
- constexpr size_t num_subgroups = 16;
543
- GGML_ASSERT(block_num_y % num_subgroups == 0);
544
-
545
- const sycl::range<3> global_size(1, GGML_SYCL_MMV_Y, (block_num_y * WARP_SIZE));
546
- const sycl::range<3> workgroup_size(1, GGML_SYCL_MMV_Y, num_subgroups * WARP_SIZE);
547
-
548
- stream->submit([&](sycl::handler & cgh) {
549
- cgh.parallel_for(sycl::nd_range<3>(global_size, workgroup_size),
550
- [=](sycl::nd_item<3> nd_item) [[sycl::reqd_sub_group_size(WARP_SIZE)]] {
551
- mul_mat_vec_q_reorder<reorder_vec_dot_q_sycl<GGML_TYPE_Q4_0>>(vx, vy, dst, ncols, nrows,
552
- nd_item);
553
- });
554
- });
555
- }
556
-
557
- static void mul_mat_vec_q4_0_q8_1_sycl(const void * vx, const void * vy, float * dst, const int ncols, const int nrows,
558
- dpct::queue_ptr stream) {
559
- GGML_ASSERT(ncols % QK4_0 == 0);
560
- const int block_num_y = (nrows + GGML_SYCL_MMV_Y - 1) / GGML_SYCL_MMV_Y;
561
- const sycl::range<3> block_nums(1, 1, block_num_y);
562
- const sycl::range<3> block_dims(1, GGML_SYCL_MMV_Y, WARP_SIZE);
563
-
564
- {
565
- stream->submit([&](sycl::handler & cgh) {
566
- cgh.parallel_for(sycl::nd_range<3>(block_nums * block_dims, block_dims),
567
- [=](sycl::nd_item<3> item_ct1) [[sycl::reqd_sub_group_size(WARP_SIZE)]] {
568
- mul_mat_vec_q<QK4_0, QI4_0, block_q4_0, VDR_Q4_0_Q8_1_MMVQ, vec_dot_q4_0_q8_1>(
569
- vx, vy, dst, ncols, nrows, item_ct1);
570
- });
571
- });
572
- }
573
- }
574
-
575
- static void mul_mat_vec_q4_1_q8_1_sycl(const void *vx, const void *vy,
576
- float *dst, const int ncols,
577
- const int nrows,
578
- dpct::queue_ptr stream) {
579
- GGML_ASSERT(ncols % QK4_1 == 0);
580
- const int block_num_y = (nrows + GGML_SYCL_MMV_Y - 1) / GGML_SYCL_MMV_Y;
581
- const sycl::range<3> block_nums(1, 1, block_num_y);
582
- const sycl::range<3> block_dims(1, GGML_SYCL_MMV_Y, WARP_SIZE);
583
- {
584
-
585
- stream->submit([&](sycl::handler &cgh) {
586
-
587
- cgh.parallel_for(
588
- sycl::nd_range<3>(block_nums * block_dims, block_dims),
589
- [=](sycl::nd_item<3> item_ct1)
590
- [[sycl::reqd_sub_group_size(WARP_SIZE)]] {
591
- mul_mat_vec_q<QK4_0, QI4_1, block_q4_1,
592
- VDR_Q4_1_Q8_1_MMVQ, vec_dot_q4_1_q8_1>(
593
- vx, vy, dst, ncols, nrows, item_ct1);
594
- });
595
- });
596
- }
597
- }
598
-
599
- static void mul_mat_vec_q5_0_q8_1_sycl(const void *vx, const void *vy,
600
- float *dst, const int ncols,
601
- const int nrows,
602
- dpct::queue_ptr stream) {
603
- GGML_ASSERT(ncols % QK5_0 == 0);
604
- const int block_num_y = (nrows + GGML_SYCL_MMV_Y - 1) / GGML_SYCL_MMV_Y;
605
- const sycl::range<3> block_nums(1, 1, block_num_y);
606
- const sycl::range<3> block_dims(1, GGML_SYCL_MMV_Y, WARP_SIZE);
607
- {
608
-
609
- stream->submit([&](sycl::handler &cgh) {
610
-
611
- cgh.parallel_for(
612
- sycl::nd_range<3>(block_nums * block_dims, block_dims),
613
- [=](sycl::nd_item<3> item_ct1)
614
- [[sycl::reqd_sub_group_size(WARP_SIZE)]] {
615
- mul_mat_vec_q<QK5_0, QI5_0, block_q5_0,
616
- VDR_Q5_0_Q8_1_MMVQ, vec_dot_q5_0_q8_1>(
617
- vx, vy, dst, ncols, nrows, item_ct1);
618
- });
619
- });
620
- }
621
- }
622
-
623
- static void mul_mat_vec_q5_1_q8_1_sycl(const void *vx, const void *vy,
624
- float *dst, const int ncols,
625
- const int nrows,
626
- dpct::queue_ptr stream) {
627
- GGML_ASSERT(ncols % QK5_1 == 0);
628
- const int block_num_y = (nrows + GGML_SYCL_MMV_Y - 1) / GGML_SYCL_MMV_Y;
629
- const sycl::range<3> block_nums(1, 1, block_num_y);
630
- const sycl::range<3> block_dims(1, GGML_SYCL_MMV_Y, WARP_SIZE);
631
- {
632
-
633
- stream->submit([&](sycl::handler &cgh) {
634
-
635
- cgh.parallel_for(
636
- sycl::nd_range<3>(block_nums * block_dims, block_dims),
637
- [=](sycl::nd_item<3> item_ct1)
638
- [[sycl::reqd_sub_group_size(WARP_SIZE)]] {
639
- mul_mat_vec_q<QK5_1, QI5_1, block_q5_1,
640
- VDR_Q5_1_Q8_1_MMVQ, vec_dot_q5_1_q8_1>(
641
- vx, vy, dst, ncols, nrows, item_ct1);
642
- });
643
- });
644
- }
645
- }
646
-
647
- static void mul_mat_vec_q8_0_q8_1_sycl(const void *vx, const void *vy,
648
- float *dst, const int ncols,
649
- const int nrows,
650
- dpct::queue_ptr stream) {
651
- GGML_ASSERT(ncols % QK8_0 == 0);
652
- const int block_num_y = (nrows + GGML_SYCL_MMV_Y - 1) / GGML_SYCL_MMV_Y;
653
- const sycl::range<3> block_nums(1, 1, block_num_y);
654
- const sycl::range<3> block_dims(1, GGML_SYCL_MMV_Y, WARP_SIZE);
655
- {
656
-
657
- stream->submit([&](sycl::handler &cgh) {
658
-
659
- cgh.parallel_for(
660
- sycl::nd_range<3>(block_nums * block_dims, block_dims),
661
- [=](sycl::nd_item<3> item_ct1)
662
- [[sycl::reqd_sub_group_size(WARP_SIZE)]] {
663
- mul_mat_vec_q<QK8_0, QI8_0, block_q8_0,
664
- VDR_Q8_0_Q8_1_MMVQ, vec_dot_q8_0_q8_1>(
665
- vx, vy, dst, ncols, nrows, item_ct1);
666
- });
667
- });
668
- }
669
- }
670
-
671
- static void mul_mat_vec_q2_K_q8_1_sycl(const void *vx, const void *vy,
672
- float *dst, const int ncols,
673
- const int nrows,
674
- dpct::queue_ptr stream) {
675
- GGML_ASSERT(ncols % QK_K == 0);
676
- const int block_num_y = (nrows + GGML_SYCL_MMV_Y - 1) / GGML_SYCL_MMV_Y;
677
- const sycl::range<3> block_nums(1, 1, block_num_y);
678
- const sycl::range<3> block_dims(1, GGML_SYCL_MMV_Y, WARP_SIZE);
679
- {
680
-
681
- stream->submit([&](sycl::handler &cgh) {
682
-
683
- cgh.parallel_for(
684
- sycl::nd_range<3>(block_nums * block_dims, block_dims),
685
- [=](sycl::nd_item<3> item_ct1)
686
- [[sycl::reqd_sub_group_size(WARP_SIZE)]] {
687
- mul_mat_vec_q<QK_K, QI2_K, block_q2_K,
688
- VDR_Q2_K_Q8_1_MMVQ, vec_dot_q2_K_q8_1>(
689
- vx, vy, dst, ncols, nrows, item_ct1);
690
- });
691
- });
692
- }
693
- }
694
-
695
- static void mul_mat_vec_q3_K_q8_1_sycl(const void *vx, const void *vy,
696
- float *dst, const int ncols,
697
- const int nrows,
698
- dpct::queue_ptr stream) {
699
- GGML_ASSERT(ncols % QK_K == 0);
700
- const int block_num_y = (nrows + GGML_SYCL_MMV_Y - 1) / GGML_SYCL_MMV_Y;
701
- const sycl::range<3> block_nums(1, 1, block_num_y);
702
- const sycl::range<3> block_dims(1, GGML_SYCL_MMV_Y, WARP_SIZE);
703
- {
704
-
705
- stream->submit([&](sycl::handler &cgh) {
706
-
707
- cgh.parallel_for(
708
- sycl::nd_range<3>(block_nums * block_dims, block_dims),
709
- [=](sycl::nd_item<3> item_ct1)
710
- [[sycl::reqd_sub_group_size(WARP_SIZE)]] {
711
- mul_mat_vec_q<QK_K, QI3_K, block_q3_K,
712
- VDR_Q3_K_Q8_1_MMVQ, vec_dot_q3_K_q8_1>(
713
- vx, vy, dst, ncols, nrows, item_ct1);
714
- });
715
- });
716
- }
717
- }
718
-
719
- static void mul_mat_vec_q4_K_q8_1_sycl(const void *vx, const void *vy,
720
- float *dst, const int ncols,
721
- const int nrows,
722
- dpct::queue_ptr stream) {
723
- GGML_ASSERT(ncols % QK_K == 0);
724
- const int block_num_y = (nrows + GGML_SYCL_MMV_Y - 1) / GGML_SYCL_MMV_Y;
725
- const sycl::range<3> block_nums(1, 1, block_num_y);
726
- const sycl::range<3> block_dims(1, GGML_SYCL_MMV_Y, WARP_SIZE);
727
- {
728
-
729
- stream->submit([&](sycl::handler &cgh) {
730
-
731
- cgh.parallel_for(
732
- sycl::nd_range<3>(block_nums * block_dims, block_dims),
733
- [=](sycl::nd_item<3> item_ct1)
734
- [[sycl::reqd_sub_group_size(WARP_SIZE)]] {
735
- mul_mat_vec_q<QK_K, QI4_K, block_q4_K,
736
- VDR_Q4_K_Q8_1_MMVQ, vec_dot_q4_K_q8_1>(
737
- vx, vy, dst, ncols, nrows, item_ct1);
738
- });
739
- });
740
- }
741
- }
742
-
743
- static void reorder_mul_mat_vec_q4_k_q8_1_sycl(const void * vx, const void * vy, float * dst, const int ncols,
744
- const int nrows, dpct::queue_ptr stream) {
745
- GGML_ASSERT(ncols % QK_K == 0);
746
-
747
- const int block_num_y = ceil_div(nrows, GGML_SYCL_MMV_Y);
748
- constexpr size_t num_subgroups = 16;
749
- GGML_ASSERT(block_num_y % num_subgroups == 0);
750
-
751
- const sycl::range<3> global_size(1, GGML_SYCL_MMV_Y, block_num_y * WARP_SIZE);
752
- const sycl::range<3> workgroup_size(1, GGML_SYCL_MMV_Y, num_subgroups * WARP_SIZE);
753
-
754
- stream->submit([&](sycl::handler & cgh) {
755
- cgh.parallel_for(sycl::nd_range<3>(global_size, workgroup_size),
756
- [=](sycl::nd_item<3> nd_item) [[sycl::reqd_sub_group_size(WARP_SIZE)]] {
757
- mul_mat_vec_q_reorder<reorder_vec_dot_q_sycl<GGML_TYPE_Q4_K>>(vx, vy, dst, ncols,
758
- nrows, nd_item);
759
- });
760
- });
761
- }
762
-
763
-
764
- static void mul_mat_vec_q5_K_q8_1_sycl(const void *vx, const void *vy,
765
- float *dst, const int ncols,
766
- const int nrows,
767
- dpct::queue_ptr stream) {
768
- GGML_ASSERT(ncols % QK_K == 0);
769
- const int block_num_y = (nrows + GGML_SYCL_MMV_Y - 1) / GGML_SYCL_MMV_Y;
770
- const sycl::range<3> block_nums(1, 1, block_num_y);
771
- const sycl::range<3> block_dims(1, GGML_SYCL_MMV_Y, WARP_SIZE);
772
- {
773
-
774
- stream->submit([&](sycl::handler &cgh) {
775
-
776
- cgh.parallel_for(
777
- sycl::nd_range<3>(block_nums * block_dims, block_dims),
778
- [=](sycl::nd_item<3> item_ct1)
779
- [[sycl::reqd_sub_group_size(WARP_SIZE)]] {
780
- mul_mat_vec_q<QK_K, QI5_K, block_q5_K,
781
- VDR_Q5_K_Q8_1_MMVQ, vec_dot_q5_K_q8_1>(
782
- vx, vy, dst, ncols, nrows, item_ct1);
783
- });
784
- });
785
- }
786
- }
787
-
788
- static void mul_mat_vec_q6_K_q8_1_sycl(const void *vx, const void *vy,
789
- float *dst, const int ncols,
790
- const int nrows,
791
- dpct::queue_ptr stream) {
792
- GGML_ASSERT(ncols % QK_K == 0);
793
- const int block_num_y = (nrows + GGML_SYCL_MMV_Y - 1) / GGML_SYCL_MMV_Y;
794
- const sycl::range<3> block_nums(1, 1, block_num_y);
795
- const sycl::range<3> block_dims(1, GGML_SYCL_MMV_Y, WARP_SIZE);
796
- {
797
-
798
- stream->submit([&](sycl::handler &cgh) {
799
-
800
- cgh.parallel_for(
801
- sycl::nd_range<3>(block_nums * block_dims, block_dims),
802
- [=](sycl::nd_item<3> item_ct1)
803
- [[sycl::reqd_sub_group_size(WARP_SIZE)]] {
804
- mul_mat_vec_q<QK_K, QI6_K, block_q6_K,
805
- VDR_Q6_K_Q8_1_MMVQ, vec_dot_q6_K_q8_1>(
806
- vx, vy, dst, ncols, nrows, item_ct1);
807
- });
808
- });
809
- }
810
- }
811
-
812
-
813
- static void mul_mat_vec_iq2_xxs_q8_1_sycl(const void *vx, const void *vy,
814
- float *dst, const int ncols,
815
- const int nrows,
816
- dpct::queue_ptr stream) {
817
- GGML_ASSERT(ncols % QK_K == 0);
818
- const int block_num_y = (nrows + GGML_SYCL_MMV_Y - 1) / GGML_SYCL_MMV_Y;
819
- const sycl::range<3> block_nums(1, 1, block_num_y);
820
- const sycl::range<3> block_dims(1, GGML_SYCL_MMV_Y, WARP_SIZE);
821
- {
822
- stream->submit([&](sycl::handler &cgh) {
823
- cgh.parallel_for(
824
- sycl::nd_range<3>(block_nums * block_dims, block_dims),
825
- [=](sycl::nd_item<3> item_ct1)
826
- [[sycl::reqd_sub_group_size(WARP_SIZE)]] {
827
- mul_mat_vec_q_iq2_xxs_q8_1<QK_K, QI2_XXS/2, block_iq2_xxs, 1>(
828
- vx, vy, dst, ncols, nrows, item_ct1);
829
- });
830
- });
831
- }
832
- }
833
-
834
- static void mul_mat_vec_iq2_xs_q8_1_sycl(const void *vx, const void *vy,
835
- float *dst, const int ncols,
836
- const int nrows,
837
- dpct::queue_ptr stream) {
838
- GGML_ASSERT(ncols % QK_K == 0);
839
- const int block_num_y = (nrows + GGML_SYCL_MMV_Y - 1) / GGML_SYCL_MMV_Y;
840
- const sycl::range<3> block_nums(1, 1, block_num_y);
841
- const sycl::range<3> block_dims(1, GGML_SYCL_MMV_Y, WARP_SIZE);
842
- {
843
- stream->submit([&](sycl::handler & cgh) {
844
- cgh.parallel_for(
845
- sycl::nd_range<3>(block_nums * block_dims, block_dims),
846
- [=](sycl::nd_item<3> item_ct1)
847
- [[sycl::reqd_sub_group_size(WARP_SIZE)]] {
848
- mul_mat_vec_q_iq2_xs_q8_1<QK_K, QI2_XS/2, block_iq2_xs, 1>(
849
- vx, vy, dst, ncols, nrows, item_ct1);
850
- });
851
- });
852
- }
853
- }
854
-
855
- static void mul_mat_vec_iq2_s_q8_1_sycl(const void *vx, const void *vy,
856
- float *dst, const int ncols,
857
- const int nrows,
858
- dpct::queue_ptr stream) {
859
- GGML_ASSERT(ncols % QK_K == 0);
860
- const int block_num_y = (nrows + GGML_SYCL_MMV_Y - 1) / GGML_SYCL_MMV_Y;
861
- const sycl::range<3> block_nums(1, 1, block_num_y);
862
- const sycl::range<3> block_dims(1, GGML_SYCL_MMV_Y, WARP_SIZE);
863
- {
864
-
865
- stream->submit([&](sycl::handler &cgh) {
866
- cgh.parallel_for(
867
- sycl::nd_range<3>(block_nums * block_dims, block_dims),
868
- [=](sycl::nd_item<3> item_ct1)
869
- [[sycl::reqd_sub_group_size(WARP_SIZE)]] {
870
- mul_mat_vec_q_iq2_s_q8_1<QK_K, QI2_S/2, block_iq2_s, 1>(
871
- vx, vy, dst, ncols, nrows, item_ct1);
872
- });
873
- });
874
- }
875
- }
876
-
877
- static void mul_mat_vec_iq3_xxs_q8_1_sycl(const void *vx, const void *vy,
878
- float *dst, const int ncols,
879
- const int nrows,
880
- dpct::queue_ptr stream) {
881
- GGML_ASSERT(ncols % QK_K == 0);
882
- const int block_num_y = (nrows + GGML_SYCL_MMV_Y - 1) / GGML_SYCL_MMV_Y;
883
- const sycl::range<3> block_nums(1, 1, block_num_y);
884
- const sycl::range<3> block_dims(1, GGML_SYCL_MMV_Y, WARP_SIZE);
885
- {
886
-
887
- stream->submit([&](sycl::handler &cgh) {
888
- cgh.parallel_for(
889
- sycl::nd_range<3>(block_nums * block_dims, block_dims),
890
- [=](sycl::nd_item<3> item_ct1)
891
- [[sycl::reqd_sub_group_size(WARP_SIZE)]] {
892
- mul_mat_vec_q_iq3_xxs_q8_1<QK_K, QI3_XXS/2, block_iq3_xxs, 1>(
893
- vx, vy, dst, ncols, nrows, item_ct1);
894
- });
895
- });
896
- }
897
- }
898
-
899
- static void mul_mat_vec_iq3_s_q8_1_sycl(const void *vx, const void *vy,
900
- float *dst, const int ncols,
901
- const int nrows,
902
- dpct::queue_ptr stream) {
903
- GGML_ASSERT(ncols % QK_K == 0);
904
- const int block_num_y = (nrows + GGML_SYCL_MMV_Y - 1) / GGML_SYCL_MMV_Y;
905
- const sycl::range<3> block_nums(1, 1, block_num_y);
906
- const sycl::range<3> block_dims(1, GGML_SYCL_MMV_Y, WARP_SIZE);
907
- {
908
-
909
- stream->submit([&](sycl::handler &cgh) {
910
- cgh.parallel_for(
911
- sycl::nd_range<3>(block_nums * block_dims, block_dims),
912
- [=](sycl::nd_item<3> item_ct1)
913
- [[sycl::reqd_sub_group_size(WARP_SIZE)]] {
914
- mul_mat_vec_q_iq3_s_q8_1<QK_K, QI3_S/2, block_iq3_s, 1>(
915
- vx, vy, dst, ncols, nrows, item_ct1);
916
- });
917
- });
918
- }
919
- }
920
-
921
- static void mul_mat_vec_iq1_s_q8_1_sycl(const void *vx, const void *vy,
922
- float *dst, const int ncols,
923
- const int nrows,
924
- dpct::queue_ptr stream) {
925
- GGML_ASSERT(ncols % QK_K == 0);
926
- const int block_num_y = (nrows + GGML_SYCL_MMV_Y - 1) / GGML_SYCL_MMV_Y;
927
- const sycl::range<3> block_nums(1, 1, block_num_y);
928
- const sycl::range<3> block_dims(1, GGML_SYCL_MMV_Y, WARP_SIZE);
929
- {
930
-
931
- stream->submit([&](sycl::handler &cgh) {
932
- cgh.parallel_for(
933
- sycl::nd_range<3>(block_nums * block_dims, block_dims),
934
- [=](sycl::nd_item<3> item_ct1)
935
- [[sycl::reqd_sub_group_size(WARP_SIZE)]] {
936
- mul_mat_vec_q_iq1_s_q8_1<QK_K, QI1_S, block_iq1_s, 1>(
937
- vx, vy, dst, ncols, nrows, item_ct1);
938
- });
939
- });
940
- }
941
- }
942
-
943
- static void mul_mat_vec_iq1_m_q8_1_sycl(const void *vx, const void *vy,
944
- float *dst, const int ncols,
945
- const int nrows,
946
- dpct::queue_ptr stream) {
947
- GGML_ASSERT(ncols % QK_K == 0);
948
- const int block_num_y = (nrows + GGML_SYCL_MMV_Y - 1) / GGML_SYCL_MMV_Y;
949
- const sycl::range<3> block_nums(1, 1, block_num_y);
950
- const sycl::range<3> block_dims(1, GGML_SYCL_MMV_Y, WARP_SIZE);
951
- {
952
- stream->submit([&](sycl::handler &cgh) {
953
- cgh.parallel_for(
954
- sycl::nd_range<3>(block_nums * block_dims, block_dims),
955
- [=](sycl::nd_item<3> item_ct1)
956
- [[sycl::reqd_sub_group_size(WARP_SIZE)]] {
957
- mul_mat_vec_q_iq1_m_q8_1<QK_K, QI1_S, block_iq1_m, 1>(
958
- vx, vy, dst, ncols, nrows, item_ct1);
959
- });
960
- });
961
- }
962
- }
963
-
964
- static void mul_mat_vec_iq4_nl_q8_1_sycl(const void *vx, const void *vy,
965
- float *dst, const int ncols,
966
- const int nrows,
967
- dpct::queue_ptr stream) {
968
- GGML_ASSERT(ncols % QK4_NL == 0);
969
- const int block_num_y = (nrows + GGML_SYCL_MMV_Y - 1) / GGML_SYCL_MMV_Y;
970
- const sycl::range<3> block_nums(1, 1, block_num_y);
971
- const sycl::range<3> block_dims(1, GGML_SYCL_MMV_Y, WARP_SIZE);
972
- {
973
-
974
- stream->submit([&](sycl::handler &cgh) {
975
- cgh.parallel_for(
976
- sycl::nd_range<3>(block_nums * block_dims, block_dims),
977
- [=](sycl::nd_item<3> item_ct1)
978
- [[sycl::reqd_sub_group_size(WARP_SIZE)]] {
979
- mul_mat_vec_q_iq4_nl_q8_1<QK4_NL, QI4_NL, block_iq4_nl, 2>(
980
- vx, vy, dst, ncols, nrows, item_ct1);
981
- });
982
- });
983
- }
984
- }
985
-
986
- static void mul_mat_vec_iq4_xs_q8_1_sycl(const void *vx, const void *vy,
987
- float *dst, const int ncols,
988
- const int nrows,
989
- dpct::queue_ptr stream) {
990
- GGML_ASSERT(ncols % QK_K == 0);
991
- const int block_num_y = (nrows + GGML_SYCL_MMV_Y - 1) / GGML_SYCL_MMV_Y;
992
- const sycl::range<3> block_nums(1, 1, block_num_y);
993
- const sycl::range<3> block_dims(1, GGML_SYCL_MMV_Y, WARP_SIZE);
994
- {
995
-
996
- stream->submit([&](sycl::handler &cgh) {
997
- cgh.parallel_for(
998
- sycl::nd_range<3>(block_nums * block_dims, block_dims),
999
- [=](sycl::nd_item<3> item_ct1)
1000
- [[sycl::reqd_sub_group_size(WARP_SIZE)]] {
1001
- mul_mat_vec_q_iq4_xs_q8_1<QK_K, QI4_XS/4, block_iq4_xs, 1>(
1002
- vx, vy, dst, ncols, nrows, item_ct1);
1003
- });
1004
- });
1005
- }
1006
- }
1007
-
1008
- void ggml_sycl_op_mul_mat_vec_q(ggml_backend_sycl_context & ctx, const ggml_tensor * src0, const ggml_tensor * src1,
1009
- ggml_tensor * dst, const char * src0_dd_i, const float * src1_ddf_i,
1010
- const char * src1_ddq_i, float * dst_dd_i, const int64_t row_low,
1011
- const int64_t row_high, const int64_t src1_ncols, const int64_t src1_padded_col_size,
1012
- const dpct::queue_ptr & stream) {
1013
- const int64_t ne10 = src1->ne[0];
1014
- GGML_ASSERT(ne10 % QK8_1 == 0);
1015
-
1016
- const int64_t ne00 = src0->ne[0];
1017
- const int64_t row_diff = row_high - row_low;
1018
-
1019
- int id;
1020
- SYCL_CHECK(CHECK_TRY_ERROR(id = get_current_device_id()));
1021
- const size_t q8_1_ts = sizeof(block_q8_1);
1022
- const size_t q8_1_bs = QK8_1;
1023
- // the main device has a larger memory buffer to hold the results from all GPUs
1024
- // nrows_dst == nrows of the matrix that the kernel writes into
1025
-
1026
- for (int i = 0; i < src1_ncols; i++) {
1027
- const size_t src1_ddq_i_offset = i * src1_padded_col_size * q8_1_ts / q8_1_bs;
1028
- const char * src1_ddq_i_bs = src1_ddq_i + src1_ddq_i_offset;
1029
- float * dst_dd_i_bs = dst_dd_i + i * dst->ne[0];
1030
- switch (src0->type) {
1031
- case GGML_TYPE_Q4_0:
1032
- if ((ggml_tensor_extra_gpu *) dst->src[0]->extra &&
1033
- ((ggml_tensor_extra_gpu *) dst->src[0]->extra)->optimized_feature.reorder) {
1034
- GGML_SYCL_DEBUG("Calling reorder_mul_mat_vec_q4_0_q8_1_sycl\n");
1035
- reorder_mul_mat_vec_q4_0_q8_1_sycl(src0_dd_i, src1_ddq_i_bs, dst_dd_i_bs, ne00, row_diff, stream);
1036
- } else {
1037
- GGML_SYCL_DEBUG("Calling mul_mat_vec_q4_0_q8_1_sycl\n");
1038
- mul_mat_vec_q4_0_q8_1_sycl(src0_dd_i, src1_ddq_i_bs, dst_dd_i_bs, ne00, row_diff, stream);
1039
- }
1040
- break;
1041
- case GGML_TYPE_Q4_1:
1042
- mul_mat_vec_q4_1_q8_1_sycl(src0_dd_i, src1_ddq_i_bs, dst_dd_i_bs, ne00, row_diff, stream);
1043
- break;
1044
- case GGML_TYPE_Q5_0:
1045
- mul_mat_vec_q5_0_q8_1_sycl(src0_dd_i, src1_ddq_i_bs, dst_dd_i_bs, ne00, row_diff, stream);
1046
- break;
1047
- case GGML_TYPE_Q5_1:
1048
- mul_mat_vec_q5_1_q8_1_sycl(src0_dd_i, src1_ddq_i_bs, dst_dd_i_bs, ne00, row_diff, stream);
1049
- break;
1050
- case GGML_TYPE_Q8_0:
1051
- mul_mat_vec_q8_0_q8_1_sycl(src0_dd_i, src1_ddq_i_bs, dst_dd_i_bs, ne00, row_diff, stream);
1052
- break;
1053
- case GGML_TYPE_Q2_K:
1054
- mul_mat_vec_q2_K_q8_1_sycl(src0_dd_i, src1_ddq_i_bs, dst_dd_i_bs, ne00, row_diff, stream);
1055
- break;
1056
- case GGML_TYPE_Q3_K:
1057
- mul_mat_vec_q3_K_q8_1_sycl(src0_dd_i, src1_ddq_i_bs, dst_dd_i_bs, ne00, row_diff, stream);
1058
- break;
1059
- case GGML_TYPE_Q4_K:
1060
- if ((ggml_tensor_extra_gpu *) dst->src[0]->extra &&
1061
- ((ggml_tensor_extra_gpu *) dst->src[0]->extra)->optimized_feature.reorder) {
1062
- reorder_mul_mat_vec_q4_k_q8_1_sycl(src0_dd_i, src1_ddq_i_bs, dst_dd_i_bs, ne00, row_diff, stream);
1063
- } else {
1064
- mul_mat_vec_q4_K_q8_1_sycl(src0_dd_i, src1_ddq_i_bs, dst_dd_i_bs, ne00, row_diff, stream);
1065
- }
1066
- break;
1067
- case GGML_TYPE_Q5_K:
1068
- mul_mat_vec_q5_K_q8_1_sycl(src0_dd_i, src1_ddq_i_bs, dst_dd_i_bs, ne00, row_diff, stream);
1069
- break;
1070
- case GGML_TYPE_Q6_K:
1071
- mul_mat_vec_q6_K_q8_1_sycl(src0_dd_i, src1_ddq_i_bs, dst_dd_i_bs, ne00, row_diff, stream);
1072
- break;
1073
- case GGML_TYPE_IQ1_S:
1074
- mul_mat_vec_iq1_s_q8_1_sycl(src0_dd_i, src1_ddq_i_bs, dst_dd_i_bs, ne00, row_diff, stream);
1075
- break;
1076
- case GGML_TYPE_IQ1_M:
1077
- mul_mat_vec_iq1_m_q8_1_sycl(src0_dd_i, src1_ddq_i_bs, dst_dd_i_bs, ne00, row_diff, stream);
1078
- break;
1079
- case GGML_TYPE_IQ2_XXS:
1080
- mul_mat_vec_iq2_xxs_q8_1_sycl(src0_dd_i, src1_ddq_i_bs, dst_dd_i_bs, ne00, row_diff, stream);
1081
- break;
1082
- case GGML_TYPE_IQ2_XS:
1083
- mul_mat_vec_iq2_xs_q8_1_sycl(src0_dd_i, src1_ddq_i_bs, dst_dd_i_bs, ne00, row_diff, stream);
1084
- break;
1085
- case GGML_TYPE_IQ2_S:
1086
- mul_mat_vec_iq2_s_q8_1_sycl(src0_dd_i, src1_ddq_i_bs, dst_dd_i_bs, ne00, row_diff, stream);
1087
- break;
1088
- case GGML_TYPE_IQ3_XXS:
1089
- mul_mat_vec_iq3_xxs_q8_1_sycl(src0_dd_i, src1_ddq_i_bs, dst_dd_i_bs, ne00, row_diff, stream);
1090
- break;
1091
- case GGML_TYPE_IQ3_S:
1092
- mul_mat_vec_iq3_s_q8_1_sycl(src0_dd_i, src1_ddq_i_bs, dst_dd_i_bs, ne00, row_diff, stream);
1093
- break;
1094
- case GGML_TYPE_IQ4_NL:
1095
- mul_mat_vec_iq4_nl_q8_1_sycl(src0_dd_i, src1_ddq_i_bs, dst_dd_i_bs, ne00, row_diff, stream);
1096
- break;
1097
- case GGML_TYPE_IQ4_XS:
1098
- mul_mat_vec_iq4_xs_q8_1_sycl(src0_dd_i, src1_ddq_i_bs, dst_dd_i_bs, ne00, row_diff, stream);
1099
- break;
1100
- default:
1101
- GGML_ABORT("fatal error");
1102
- }
1103
- }
1104
- GGML_UNUSED(src1);
1105
- GGML_UNUSED(dst);
1106
- GGML_UNUSED(src1_ddf_i);
1107
- GGML_UNUSED(ctx);
1108
- }