elelem-ggml 0.1.0

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 (1367) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/exe/elelem-ggml +8 -0
  4. data/ext/elelem/ggml/elelem.c +466 -0
  5. data/ext/elelem/ggml/extconf.rb +52 -0
  6. data/lib/elelem/ggml/chat_ml.rb +23 -0
  7. data/lib/elelem/ggml/gguf.rb +82 -0
  8. data/lib/elelem/ggml/provider.rb +63 -0
  9. data/lib/elelem/ggml/tokenizer.rb +95 -0
  10. data/lib/elelem/ggml/version.rb +7 -0
  11. data/lib/elelem/ggml.rb +37 -0
  12. data/vendor/ggml/AUTHORS +335 -0
  13. data/vendor/ggml/CMakeLists.txt +499 -0
  14. data/vendor/ggml/CONTRIBUTING.md +3 -0
  15. data/vendor/ggml/LICENSE +21 -0
  16. data/vendor/ggml/README.md +49 -0
  17. data/vendor/ggml/cmake/FindNCCL.cmake +36 -0
  18. data/vendor/ggml/cmake/GitVars.cmake +22 -0
  19. data/vendor/ggml/cmake/common.cmake +50 -0
  20. data/vendor/ggml/cmake/ggml-config.cmake.in +216 -0
  21. data/vendor/ggml/ggml.pc.in +10 -0
  22. data/vendor/ggml/include/ggml-alloc.h +86 -0
  23. data/vendor/ggml/include/ggml-backend.h +437 -0
  24. data/vendor/ggml/include/ggml-blas.h +25 -0
  25. data/vendor/ggml/include/ggml-cann.h +123 -0
  26. data/vendor/ggml/include/ggml-cpp.h +39 -0
  27. data/vendor/ggml/include/ggml-cpu.h +152 -0
  28. data/vendor/ggml/include/ggml-cuda.h +47 -0
  29. data/vendor/ggml/include/ggml-et.h +28 -0
  30. data/vendor/ggml/include/ggml-hexagon.h +19 -0
  31. data/vendor/ggml/include/ggml-metal.h +61 -0
  32. data/vendor/ggml/include/ggml-opencl.h +26 -0
  33. data/vendor/ggml/include/ggml-openvino.h +37 -0
  34. data/vendor/ggml/include/ggml-opt.h +256 -0
  35. data/vendor/ggml/include/ggml-rpc.h +35 -0
  36. data/vendor/ggml/include/ggml-sycl.h +57 -0
  37. data/vendor/ggml/include/ggml-virtgpu.h +14 -0
  38. data/vendor/ggml/include/ggml-vulkan.h +29 -0
  39. data/vendor/ggml/include/ggml-webgpu.h +19 -0
  40. data/vendor/ggml/include/ggml-zdnn.h +17 -0
  41. data/vendor/ggml/include/ggml-zendnn.h +22 -0
  42. data/vendor/ggml/include/ggml.h +2963 -0
  43. data/vendor/ggml/include/gguf.h +211 -0
  44. data/vendor/ggml/requirements.txt +12 -0
  45. data/vendor/ggml/scripts/gen-authors.sh +9 -0
  46. data/vendor/ggml/scripts/make-release-checks.sh +96 -0
  47. data/vendor/ggml/scripts/make-release-desc.sh +69 -0
  48. data/vendor/ggml/scripts/make-release-summary.txt +33 -0
  49. data/vendor/ggml/scripts/release.sh +195 -0
  50. data/vendor/ggml/scripts/sync-llama-am.sh +167 -0
  51. data/vendor/ggml/scripts/sync-llama.last +1 -0
  52. data/vendor/ggml/scripts/sync-llama.sh +21 -0
  53. data/vendor/ggml/scripts/sync-whisper-am.sh +138 -0
  54. data/vendor/ggml/scripts/sync-whisper.last +1 -0
  55. data/vendor/ggml/scripts/sync-whisper.sh +17 -0
  56. data/vendor/ggml/src/CMakeLists.txt +634 -0
  57. data/vendor/ggml/src/ggml-alloc.c +1249 -0
  58. data/vendor/ggml/src/ggml-backend-dl.cpp +48 -0
  59. data/vendor/ggml/src/ggml-backend-dl.h +45 -0
  60. data/vendor/ggml/src/ggml-backend-impl.h +291 -0
  61. data/vendor/ggml/src/ggml-backend-meta.cpp +2511 -0
  62. data/vendor/ggml/src/ggml-backend-reg.cpp +605 -0
  63. data/vendor/ggml/src/ggml-backend.cpp +2517 -0
  64. data/vendor/ggml/src/ggml-blas/CMakeLists.txt +101 -0
  65. data/vendor/ggml/src/ggml-blas/ggml-blas.cpp +530 -0
  66. data/vendor/ggml/src/ggml-cann/CMakeLists.txt +89 -0
  67. data/vendor/ggml/src/ggml-cann/acl_tensor.cpp +195 -0
  68. data/vendor/ggml/src/ggml-cann/acl_tensor.h +349 -0
  69. data/vendor/ggml/src/ggml-cann/aclnn_ops.cpp +4479 -0
  70. data/vendor/ggml/src/ggml-cann/aclnn_ops.h +1191 -0
  71. data/vendor/ggml/src/ggml-cann/common.h +651 -0
  72. data/vendor/ggml/src/ggml-cann/ggml-cann.cpp +3070 -0
  73. data/vendor/ggml/src/ggml-common.h +1911 -0
  74. data/vendor/ggml/src/ggml-cpu/CMakeLists.txt +685 -0
  75. data/vendor/ggml/src/ggml-cpu/amx/amx.cpp +249 -0
  76. data/vendor/ggml/src/ggml-cpu/amx/amx.h +8 -0
  77. data/vendor/ggml/src/ggml-cpu/amx/common.h +115 -0
  78. data/vendor/ggml/src/ggml-cpu/amx/mmq.cpp +2511 -0
  79. data/vendor/ggml/src/ggml-cpu/amx/mmq.h +10 -0
  80. data/vendor/ggml/src/ggml-cpu/arch/arm/cpu-feats.cpp +41 -0
  81. data/vendor/ggml/src/ggml-cpu/arch/arm/quants.c +4319 -0
  82. data/vendor/ggml/src/ggml-cpu/arch/arm/repack.cpp +5156 -0
  83. data/vendor/ggml/src/ggml-cpu/arch/loongarch/quants.c +2309 -0
  84. data/vendor/ggml/src/ggml-cpu/arch/powerpc/cpu-feats.cpp +82 -0
  85. data/vendor/ggml/src/ggml-cpu/arch/powerpc/quants.c +2304 -0
  86. data/vendor/ggml/src/ggml-cpu/arch/riscv/cpu-feats.cpp +38 -0
  87. data/vendor/ggml/src/ggml-cpu/arch/riscv/quants.c +6596 -0
  88. data/vendor/ggml/src/ggml-cpu/arch/riscv/repack.cpp +1703 -0
  89. data/vendor/ggml/src/ggml-cpu/arch/s390/cpu-feats.cpp +50 -0
  90. data/vendor/ggml/src/ggml-cpu/arch/s390/quants.c +1465 -0
  91. data/vendor/ggml/src/ggml-cpu/arch/wasm/quants.c +1292 -0
  92. data/vendor/ggml/src/ggml-cpu/arch/x86/cpu-feats.cpp +327 -0
  93. data/vendor/ggml/src/ggml-cpu/arch/x86/quants.c +4108 -0
  94. data/vendor/ggml/src/ggml-cpu/arch/x86/repack.cpp +6407 -0
  95. data/vendor/ggml/src/ggml-cpu/arch-fallback.h +353 -0
  96. data/vendor/ggml/src/ggml-cpu/binary-ops.cpp +154 -0
  97. data/vendor/ggml/src/ggml-cpu/binary-ops.h +16 -0
  98. data/vendor/ggml/src/ggml-cpu/cmake/FindSIMD.cmake +100 -0
  99. data/vendor/ggml/src/ggml-cpu/cmake/FindSMTIME.cmake +32 -0
  100. data/vendor/ggml/src/ggml-cpu/common.h +95 -0
  101. data/vendor/ggml/src/ggml-cpu/ggml-cpu-impl.h +539 -0
  102. data/vendor/ggml/src/ggml-cpu/ggml-cpu.c +3936 -0
  103. data/vendor/ggml/src/ggml-cpu/ggml-cpu.cpp +712 -0
  104. data/vendor/ggml/src/ggml-cpu/hbm.cpp +55 -0
  105. data/vendor/ggml/src/ggml-cpu/hbm.h +8 -0
  106. data/vendor/ggml/src/ggml-cpu/iqp.cpp +1253 -0
  107. data/vendor/ggml/src/ggml-cpu/iqp.h +39 -0
  108. data/vendor/ggml/src/ggml-cpu/kleidiai/CMakeLists.txt +14 -0
  109. data/vendor/ggml/src/ggml-cpu/kleidiai/kernels.cpp +1101 -0
  110. data/vendor/ggml/src/ggml-cpu/kleidiai/kernels.h +101 -0
  111. data/vendor/ggml/src/ggml-cpu/kleidiai/kleidiai.cpp +1919 -0
  112. data/vendor/ggml/src/ggml-cpu/kleidiai/kleidiai.h +17 -0
  113. data/vendor/ggml/src/ggml-cpu/llamafile/sgemm.cpp +4164 -0
  114. data/vendor/ggml/src/ggml-cpu/llamafile/sgemm.h +25 -0
  115. data/vendor/ggml/src/ggml-cpu/ops.cpp +12164 -0
  116. data/vendor/ggml/src/ggml-cpu/ops.h +124 -0
  117. data/vendor/ggml/src/ggml-cpu/quants.c +1339 -0
  118. data/vendor/ggml/src/ggml-cpu/quants.h +106 -0
  119. data/vendor/ggml/src/ggml-cpu/repack.cpp +4836 -0
  120. data/vendor/ggml/src/ggml-cpu/repack.h +245 -0
  121. data/vendor/ggml/src/ggml-cpu/simd-gemm.h +226 -0
  122. data/vendor/ggml/src/ggml-cpu/simd-mappings.h +1319 -0
  123. data/vendor/ggml/src/ggml-cpu/spacemit/ime.cpp +1742 -0
  124. data/vendor/ggml/src/ggml-cpu/spacemit/ime.h +21 -0
  125. data/vendor/ggml/src/ggml-cpu/spacemit/ime1_kernels.cpp +1027 -0
  126. data/vendor/ggml/src/ggml-cpu/spacemit/ime2_kernels.cpp +5768 -0
  127. data/vendor/ggml/src/ggml-cpu/spacemit/ime_env.cpp +320 -0
  128. data/vendor/ggml/src/ggml-cpu/spacemit/ime_env.h +55 -0
  129. data/vendor/ggml/src/ggml-cpu/spacemit/ime_kernels.h +189 -0
  130. data/vendor/ggml/src/ggml-cpu/spacemit/repack.cpp +1795 -0
  131. data/vendor/ggml/src/ggml-cpu/spacemit/repack.h +14 -0
  132. data/vendor/ggml/src/ggml-cpu/spacemit/rvv_kernels.cpp +3178 -0
  133. data/vendor/ggml/src/ggml-cpu/spacemit/rvv_kernels.h +95 -0
  134. data/vendor/ggml/src/ggml-cpu/spacemit/spine_barrier.h +34 -0
  135. data/vendor/ggml/src/ggml-cpu/spacemit/spine_mem_pool.cpp +760 -0
  136. data/vendor/ggml/src/ggml-cpu/spacemit/spine_mem_pool.h +32 -0
  137. data/vendor/ggml/src/ggml-cpu/spacemit/spine_tcm.h +409 -0
  138. data/vendor/ggml/src/ggml-cpu/traits.cpp +36 -0
  139. data/vendor/ggml/src/ggml-cpu/traits.h +38 -0
  140. data/vendor/ggml/src/ggml-cpu/unary-ops.cpp +337 -0
  141. data/vendor/ggml/src/ggml-cpu/unary-ops.h +35 -0
  142. data/vendor/ggml/src/ggml-cpu/vec.cpp +613 -0
  143. data/vendor/ggml/src/ggml-cpu/vec.h +1570 -0
  144. data/vendor/ggml/src/ggml-cuda/CMakeLists.txt +267 -0
  145. data/vendor/ggml/src/ggml-cuda/acc.cu +61 -0
  146. data/vendor/ggml/src/ggml-cuda/acc.cuh +5 -0
  147. data/vendor/ggml/src/ggml-cuda/add-id.cu +58 -0
  148. data/vendor/ggml/src/ggml-cuda/add-id.cuh +3 -0
  149. data/vendor/ggml/src/ggml-cuda/allreduce.cu +971 -0
  150. data/vendor/ggml/src/ggml-cuda/allreduce.cuh +29 -0
  151. data/vendor/ggml/src/ggml-cuda/arange.cu +34 -0
  152. data/vendor/ggml/src/ggml-cuda/arange.cuh +5 -0
  153. data/vendor/ggml/src/ggml-cuda/argmax.cu +91 -0
  154. data/vendor/ggml/src/ggml-cuda/argmax.cuh +3 -0
  155. data/vendor/ggml/src/ggml-cuda/argsort.cu +292 -0
  156. data/vendor/ggml/src/ggml-cuda/argsort.cuh +20 -0
  157. data/vendor/ggml/src/ggml-cuda/binbcast.cu +574 -0
  158. data/vendor/ggml/src/ggml-cuda/binbcast.cuh +12 -0
  159. data/vendor/ggml/src/ggml-cuda/clamp.cu +45 -0
  160. data/vendor/ggml/src/ggml-cuda/clamp.cuh +5 -0
  161. data/vendor/ggml/src/ggml-cuda/col2im-1d.cu +81 -0
  162. data/vendor/ggml/src/ggml-cuda/col2im-1d.cuh +3 -0
  163. data/vendor/ggml/src/ggml-cuda/common.cuh +1678 -0
  164. data/vendor/ggml/src/ggml-cuda/concat.cu +242 -0
  165. data/vendor/ggml/src/ggml-cuda/concat.cuh +5 -0
  166. data/vendor/ggml/src/ggml-cuda/conv-transpose-1d.cu +88 -0
  167. data/vendor/ggml/src/ggml-cuda/conv-transpose-1d.cuh +5 -0
  168. data/vendor/ggml/src/ggml-cuda/conv2d-dw.cu +161 -0
  169. data/vendor/ggml/src/ggml-cuda/conv2d-dw.cuh +5 -0
  170. data/vendor/ggml/src/ggml-cuda/conv2d-transpose.cu +115 -0
  171. data/vendor/ggml/src/ggml-cuda/conv2d-transpose.cuh +5 -0
  172. data/vendor/ggml/src/ggml-cuda/conv2d.cu +167 -0
  173. data/vendor/ggml/src/ggml-cuda/conv2d.cuh +5 -0
  174. data/vendor/ggml/src/ggml-cuda/convert.cu +705 -0
  175. data/vendor/ggml/src/ggml-cuda/convert.cuh +66 -0
  176. data/vendor/ggml/src/ggml-cuda/count-equal.cu +64 -0
  177. data/vendor/ggml/src/ggml-cuda/count-equal.cuh +5 -0
  178. data/vendor/ggml/src/ggml-cuda/cp-async.cuh +57 -0
  179. data/vendor/ggml/src/ggml-cuda/cpy-utils.cuh +217 -0
  180. data/vendor/ggml/src/ggml-cuda/cpy.cu +617 -0
  181. data/vendor/ggml/src/ggml-cuda/cpy.cuh +7 -0
  182. data/vendor/ggml/src/ggml-cuda/cross-entropy-loss.cu +177 -0
  183. data/vendor/ggml/src/ggml-cuda/cross-entropy-loss.cuh +7 -0
  184. data/vendor/ggml/src/ggml-cuda/cumsum.cu +307 -0
  185. data/vendor/ggml/src/ggml-cuda/cumsum.cuh +5 -0
  186. data/vendor/ggml/src/ggml-cuda/dequantize.cuh +452 -0
  187. data/vendor/ggml/src/ggml-cuda/diag.cu +77 -0
  188. data/vendor/ggml/src/ggml-cuda/diag.cuh +5 -0
  189. data/vendor/ggml/src/ggml-cuda/diagmask.cu +40 -0
  190. data/vendor/ggml/src/ggml-cuda/diagmask.cuh +5 -0
  191. data/vendor/ggml/src/ggml-cuda/dsv4-hc.cu +294 -0
  192. data/vendor/ggml/src/ggml-cuda/dsv4-hc.cuh +6 -0
  193. data/vendor/ggml/src/ggml-cuda/fattn-common.cuh +1289 -0
  194. data/vendor/ggml/src/ggml-cuda/fattn-mma-f16.cuh +2136 -0
  195. data/vendor/ggml/src/ggml-cuda/fattn-swizzle.cuh +126 -0
  196. data/vendor/ggml/src/ggml-cuda/fattn-tile.cu +60 -0
  197. data/vendor/ggml/src/ggml-cuda/fattn-tile.cuh +1355 -0
  198. data/vendor/ggml/src/ggml-cuda/fattn-vec.cuh +611 -0
  199. data/vendor/ggml/src/ggml-cuda/fattn.cu +722 -0
  200. data/vendor/ggml/src/ggml-cuda/fattn.cuh +7 -0
  201. data/vendor/ggml/src/ggml-cuda/fill.cu +37 -0
  202. data/vendor/ggml/src/ggml-cuda/fill.cuh +3 -0
  203. data/vendor/ggml/src/ggml-cuda/fwht.cu +101 -0
  204. data/vendor/ggml/src/ggml-cuda/fwht.cuh +4 -0
  205. data/vendor/ggml/src/ggml-cuda/gated_delta_net.cu +327 -0
  206. data/vendor/ggml/src/ggml-cuda/gated_delta_net.cuh +14 -0
  207. data/vendor/ggml/src/ggml-cuda/getrows.cu +490 -0
  208. data/vendor/ggml/src/ggml-cuda/getrows.cuh +15 -0
  209. data/vendor/ggml/src/ggml-cuda/ggml-cuda.cu +5781 -0
  210. data/vendor/ggml/src/ggml-cuda/gla.cu +93 -0
  211. data/vendor/ggml/src/ggml-cuda/gla.cuh +3 -0
  212. data/vendor/ggml/src/ggml-cuda/im2col.cu +267 -0
  213. data/vendor/ggml/src/ggml-cuda/im2col.cuh +6 -0
  214. data/vendor/ggml/src/ggml-cuda/lightning-indexer.cu +588 -0
  215. data/vendor/ggml/src/ggml-cuda/lightning-indexer.cuh +4 -0
  216. data/vendor/ggml/src/ggml-cuda/mean.cu +77 -0
  217. data/vendor/ggml/src/ggml-cuda/mean.cuh +3 -0
  218. data/vendor/ggml/src/ggml-cuda/mma.cuh +1456 -0
  219. data/vendor/ggml/src/ggml-cuda/mmf.cu +191 -0
  220. data/vendor/ggml/src/ggml-cuda/mmf.cuh +908 -0
  221. data/vendor/ggml/src/ggml-cuda/mmid.cu +180 -0
  222. data/vendor/ggml/src/ggml-cuda/mmid.cuh +5 -0
  223. data/vendor/ggml/src/ggml-cuda/mmq-config-ampere.cuh +383 -0
  224. data/vendor/ggml/src/ggml-cuda/mmq-config-blackwell.cuh +37 -0
  225. data/vendor/ggml/src/ggml-cuda/mmq-config-cdna.cuh +185 -0
  226. data/vendor/ggml/src/ggml-cuda/mmq-config-pascal-dp4a.cuh +273 -0
  227. data/vendor/ggml/src/ggml-cuda/mmq-config-pascal-older.cuh +273 -0
  228. data/vendor/ggml/src/ggml-cuda/mmq-config-rdna2.cuh +273 -0
  229. data/vendor/ggml/src/ggml-cuda/mmq-config-rdna3-5.cuh +290 -0
  230. data/vendor/ggml/src/ggml-cuda/mmq-config-rdna3.cuh +274 -0
  231. data/vendor/ggml/src/ggml-cuda/mmq-config-rdna4.cuh +290 -0
  232. data/vendor/ggml/src/ggml-cuda/mmq-load-tiles.cuh +1768 -0
  233. data/vendor/ggml/src/ggml-cuda/mmq-vec-dot.cuh +1240 -0
  234. data/vendor/ggml/src/ggml-cuda/mmq.cu +386 -0
  235. data/vendor/ggml/src/ggml-cuda/mmq.cuh +1598 -0
  236. data/vendor/ggml/src/ggml-cuda/mmvf.cu +875 -0
  237. data/vendor/ggml/src/ggml-cuda/mmvf.cuh +14 -0
  238. data/vendor/ggml/src/ggml-cuda/mmvq.cu +1504 -0
  239. data/vendor/ggml/src/ggml-cuda/mmvq.cuh +18 -0
  240. data/vendor/ggml/src/ggml-cuda/moe-weighted-reduction.cu +65 -0
  241. data/vendor/ggml/src/ggml-cuda/moe-weighted-reduction.cuh +7 -0
  242. data/vendor/ggml/src/ggml-cuda/norm.cu +698 -0
  243. data/vendor/ggml/src/ggml-cuda/norm.cuh +18 -0
  244. data/vendor/ggml/src/ggml-cuda/opt-step-adamw.cu +78 -0
  245. data/vendor/ggml/src/ggml-cuda/opt-step-adamw.cuh +5 -0
  246. data/vendor/ggml/src/ggml-cuda/opt-step-sgd.cu +49 -0
  247. data/vendor/ggml/src/ggml-cuda/opt-step-sgd.cuh +5 -0
  248. data/vendor/ggml/src/ggml-cuda/out-prod.cu +125 -0
  249. data/vendor/ggml/src/ggml-cuda/out-prod.cuh +3 -0
  250. data/vendor/ggml/src/ggml-cuda/pad.cu +106 -0
  251. data/vendor/ggml/src/ggml-cuda/pad.cuh +5 -0
  252. data/vendor/ggml/src/ggml-cuda/pad_reflect_1d.cu +91 -0
  253. data/vendor/ggml/src/ggml-cuda/pad_reflect_1d.cuh +5 -0
  254. data/vendor/ggml/src/ggml-cuda/pool1d.cu +85 -0
  255. data/vendor/ggml/src/ggml-cuda/pool1d.cuh +5 -0
  256. data/vendor/ggml/src/ggml-cuda/pool2d.cu +94 -0
  257. data/vendor/ggml/src/ggml-cuda/pool2d.cuh +5 -0
  258. data/vendor/ggml/src/ggml-cuda/quantize.cu +697 -0
  259. data/vendor/ggml/src/ggml-cuda/quantize.cuh +70 -0
  260. data/vendor/ggml/src/ggml-cuda/reduce_rows.cuh +43 -0
  261. data/vendor/ggml/src/ggml-cuda/roll.cu +67 -0
  262. data/vendor/ggml/src/ggml-cuda/roll.cuh +5 -0
  263. data/vendor/ggml/src/ggml-cuda/rope.cu +941 -0
  264. data/vendor/ggml/src/ggml-cuda/rope.cuh +11 -0
  265. data/vendor/ggml/src/ggml-cuda/scale.cu +37 -0
  266. data/vendor/ggml/src/ggml-cuda/scale.cuh +5 -0
  267. data/vendor/ggml/src/ggml-cuda/set-rows.cu +398 -0
  268. data/vendor/ggml/src/ggml-cuda/set-rows.cuh +7 -0
  269. data/vendor/ggml/src/ggml-cuda/set.cu +39 -0
  270. data/vendor/ggml/src/ggml-cuda/set.cuh +7 -0
  271. data/vendor/ggml/src/ggml-cuda/snake.cu +72 -0
  272. data/vendor/ggml/src/ggml-cuda/snake.cuh +8 -0
  273. data/vendor/ggml/src/ggml-cuda/softcap.cu +37 -0
  274. data/vendor/ggml/src/ggml-cuda/softcap.cuh +5 -0
  275. data/vendor/ggml/src/ggml-cuda/softmax.cu +480 -0
  276. data/vendor/ggml/src/ggml-cuda/softmax.cuh +7 -0
  277. data/vendor/ggml/src/ggml-cuda/solve_tri.cu +273 -0
  278. data/vendor/ggml/src/ggml-cuda/solve_tri.cuh +3 -0
  279. data/vendor/ggml/src/ggml-cuda/ssm-conv.cu +206 -0
  280. data/vendor/ggml/src/ggml-cuda/ssm-conv.cuh +3 -0
  281. data/vendor/ggml/src/ggml-cuda/ssm-scan.cu +859 -0
  282. data/vendor/ggml/src/ggml-cuda/ssm-scan.cuh +3 -0
  283. data/vendor/ggml/src/ggml-cuda/sum.cu +41 -0
  284. data/vendor/ggml/src/ggml-cuda/sum.cuh +5 -0
  285. data/vendor/ggml/src/ggml-cuda/sumrows.cu +47 -0
  286. data/vendor/ggml/src/ggml-cuda/sumrows.cuh +4 -0
  287. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_1-ncols2_16.cu +6 -0
  288. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_1-ncols2_32.cu +6 -0
  289. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_1-ncols2_8.cu +12 -0
  290. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_16-ncols2_1.cu +10 -0
  291. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_16-ncols2_2.cu +11 -0
  292. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_16-ncols2_4.cu +12 -0
  293. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_2-ncols2_16.cu +6 -0
  294. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_2-ncols2_32.cu +6 -0
  295. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_2-ncols2_4.cu +12 -0
  296. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_2-ncols2_8.cu +12 -0
  297. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_32-ncols2_1.cu +10 -0
  298. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_32-ncols2_2.cu +11 -0
  299. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_4-ncols2_16.cu +6 -0
  300. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_4-ncols2_2.cu +11 -0
  301. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_4-ncols2_4.cu +12 -0
  302. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_4-ncols2_8.cu +12 -0
  303. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_64-ncols2_1.cu +10 -0
  304. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_8-ncols2_1.cu +10 -0
  305. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_8-ncols2_2.cu +11 -0
  306. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_8-ncols2_4.cu +12 -0
  307. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_8-ncols2_8.cu +12 -0
  308. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-tile-instance-dkq112-dv112.cu +5 -0
  309. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-tile-instance-dkq128-dv128.cu +5 -0
  310. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-tile-instance-dkq192-dv128.cu +5 -0
  311. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-tile-instance-dkq256-dv256.cu +5 -0
  312. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-tile-instance-dkq320-dv256.cu +5 -0
  313. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-tile-instance-dkq40-dv40.cu +5 -0
  314. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-tile-instance-dkq512-dv512.cu +5 -0
  315. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-tile-instance-dkq576-dv512.cu +5 -0
  316. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-tile-instance-dkq64-dv64.cu +5 -0
  317. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-tile-instance-dkq72-dv72.cu +5 -0
  318. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-tile-instance-dkq80-dv80.cu +5 -0
  319. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-tile-instance-dkq96-dv96.cu +5 -0
  320. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-bf16-bf16.cu +7 -0
  321. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-bf16-f16.cu +7 -0
  322. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-bf16-q4_0.cu +7 -0
  323. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-bf16-q4_1.cu +7 -0
  324. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-bf16-q5_0.cu +7 -0
  325. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-bf16-q5_1.cu +7 -0
  326. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-bf16-q8_0.cu +7 -0
  327. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-f16-bf16.cu +7 -0
  328. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-f16-f16.cu +7 -0
  329. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-f16-q4_0.cu +7 -0
  330. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-f16-q4_1.cu +7 -0
  331. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-f16-q5_0.cu +7 -0
  332. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-f16-q5_1.cu +7 -0
  333. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-f16-q8_0.cu +7 -0
  334. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_0-bf16.cu +7 -0
  335. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_0-f16.cu +7 -0
  336. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_0-q4_0.cu +7 -0
  337. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_0-q4_1.cu +7 -0
  338. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_0-q5_0.cu +7 -0
  339. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_0-q5_1.cu +7 -0
  340. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_0-q8_0.cu +7 -0
  341. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_1-bf16.cu +7 -0
  342. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_1-f16.cu +7 -0
  343. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_1-q4_0.cu +7 -0
  344. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_1-q4_1.cu +7 -0
  345. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_1-q5_0.cu +7 -0
  346. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_1-q5_1.cu +7 -0
  347. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_1-q8_0.cu +7 -0
  348. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_0-bf16.cu +7 -0
  349. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_0-f16.cu +7 -0
  350. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_0-q4_0.cu +7 -0
  351. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_0-q4_1.cu +7 -0
  352. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_0-q5_0.cu +7 -0
  353. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_0-q5_1.cu +7 -0
  354. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_0-q8_0.cu +7 -0
  355. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_1-bf16.cu +7 -0
  356. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_1-f16.cu +7 -0
  357. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_1-q4_0.cu +7 -0
  358. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_1-q4_1.cu +7 -0
  359. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_1-q5_0.cu +7 -0
  360. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_1-q5_1.cu +7 -0
  361. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_1-q8_0.cu +7 -0
  362. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q8_0-bf16.cu +7 -0
  363. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q8_0-f16.cu +7 -0
  364. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q8_0-q4_0.cu +7 -0
  365. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q8_0-q4_1.cu +7 -0
  366. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q8_0-q5_0.cu +7 -0
  367. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q8_0-q5_1.cu +7 -0
  368. data/vendor/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q8_0-q8_0.cu +7 -0
  369. data/vendor/ggml/src/ggml-cuda/template-instances/generate_cu_files.py +111 -0
  370. data/vendor/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_1.cu +5 -0
  371. data/vendor/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_10.cu +5 -0
  372. data/vendor/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_11.cu +5 -0
  373. data/vendor/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_12.cu +5 -0
  374. data/vendor/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_13.cu +5 -0
  375. data/vendor/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_14.cu +5 -0
  376. data/vendor/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_15.cu +5 -0
  377. data/vendor/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_16.cu +5 -0
  378. data/vendor/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_2.cu +5 -0
  379. data/vendor/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_3.cu +5 -0
  380. data/vendor/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_4.cu +5 -0
  381. data/vendor/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_5.cu +5 -0
  382. data/vendor/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_6.cu +5 -0
  383. data/vendor/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_7.cu +5 -0
  384. data/vendor/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_8.cu +5 -0
  385. data/vendor/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_9.cu +5 -0
  386. data/vendor/ggml/src/ggml-cuda/template-instances/mmq-instance-iq1_s.cu +5 -0
  387. data/vendor/ggml/src/ggml-cuda/template-instances/mmq-instance-iq2_s.cu +5 -0
  388. data/vendor/ggml/src/ggml-cuda/template-instances/mmq-instance-iq2_xs.cu +5 -0
  389. data/vendor/ggml/src/ggml-cuda/template-instances/mmq-instance-iq2_xxs.cu +5 -0
  390. data/vendor/ggml/src/ggml-cuda/template-instances/mmq-instance-iq3_s.cu +5 -0
  391. data/vendor/ggml/src/ggml-cuda/template-instances/mmq-instance-iq3_xxs.cu +5 -0
  392. data/vendor/ggml/src/ggml-cuda/template-instances/mmq-instance-iq4_nl.cu +5 -0
  393. data/vendor/ggml/src/ggml-cuda/template-instances/mmq-instance-iq4_xs.cu +5 -0
  394. data/vendor/ggml/src/ggml-cuda/template-instances/mmq-instance-mxfp4.cu +5 -0
  395. data/vendor/ggml/src/ggml-cuda/template-instances/mmq-instance-nvfp4.cu +5 -0
  396. data/vendor/ggml/src/ggml-cuda/template-instances/mmq-instance-q1_0.cu +5 -0
  397. data/vendor/ggml/src/ggml-cuda/template-instances/mmq-instance-q2_0.cu +5 -0
  398. data/vendor/ggml/src/ggml-cuda/template-instances/mmq-instance-q2_k.cu +5 -0
  399. data/vendor/ggml/src/ggml-cuda/template-instances/mmq-instance-q3_k.cu +5 -0
  400. data/vendor/ggml/src/ggml-cuda/template-instances/mmq-instance-q4_0.cu +5 -0
  401. data/vendor/ggml/src/ggml-cuda/template-instances/mmq-instance-q4_1.cu +5 -0
  402. data/vendor/ggml/src/ggml-cuda/template-instances/mmq-instance-q4_k.cu +5 -0
  403. data/vendor/ggml/src/ggml-cuda/template-instances/mmq-instance-q5_0.cu +5 -0
  404. data/vendor/ggml/src/ggml-cuda/template-instances/mmq-instance-q5_1.cu +5 -0
  405. data/vendor/ggml/src/ggml-cuda/template-instances/mmq-instance-q5_k.cu +5 -0
  406. data/vendor/ggml/src/ggml-cuda/template-instances/mmq-instance-q6_k.cu +5 -0
  407. data/vendor/ggml/src/ggml-cuda/template-instances/mmq-instance-q8_0.cu +5 -0
  408. data/vendor/ggml/src/ggml-cuda/top-k.cu +275 -0
  409. data/vendor/ggml/src/ggml-cuda/top-k.cuh +3 -0
  410. data/vendor/ggml/src/ggml-cuda/topk-moe.cu +442 -0
  411. data/vendor/ggml/src/ggml-cuda/topk-moe.cuh +31 -0
  412. data/vendor/ggml/src/ggml-cuda/tri.cu +136 -0
  413. data/vendor/ggml/src/ggml-cuda/tri.cuh +5 -0
  414. data/vendor/ggml/src/ggml-cuda/tsembd.cu +47 -0
  415. data/vendor/ggml/src/ggml-cuda/tsembd.cuh +5 -0
  416. data/vendor/ggml/src/ggml-cuda/unary.cu +721 -0
  417. data/vendor/ggml/src/ggml-cuda/unary.cuh +123 -0
  418. data/vendor/ggml/src/ggml-cuda/upscale.cu +293 -0
  419. data/vendor/ggml/src/ggml-cuda/upscale.cuh +5 -0
  420. data/vendor/ggml/src/ggml-cuda/vecdotq.cuh +1371 -0
  421. data/vendor/ggml/src/ggml-cuda/vendors/cuda.h +28 -0
  422. data/vendor/ggml/src/ggml-cuda/vendors/hip.h +301 -0
  423. data/vendor/ggml/src/ggml-cuda/vendors/musa.h +151 -0
  424. data/vendor/ggml/src/ggml-cuda/wkv.cu +253 -0
  425. data/vendor/ggml/src/ggml-cuda/wkv.cuh +7 -0
  426. data/vendor/ggml/src/ggml-et/CMakeLists.txt +246 -0
  427. data/vendor/ggml/src/ggml-et/cmake/embed_one_kernel.cmake +15 -0
  428. data/vendor/ggml/src/ggml-et/cmake/ggml-et-kernels-embed.cpp.in +6 -0
  429. data/vendor/ggml/src/ggml-et/cmake/ggml-et-kernels-embed.hpp.in +12 -0
  430. data/vendor/ggml/src/ggml-et/cmake/ggml-et-uberkernel-kernel-map.cpp.in +18 -0
  431. data/vendor/ggml/src/ggml-et/cmake/ggml-et-uberkernel-kernel-map.h.in +13 -0
  432. data/vendor/ggml/src/ggml-et/et-kernels/CMakeLists.txt +137 -0
  433. data/vendor/ggml/src/ggml-et/et-kernels/scripts/check_unimplemented_instructions.sh +36 -0
  434. data/vendor/ggml/src/ggml-et/et-kernels/src/RunBackend.sh +23 -0
  435. data/vendor/ggml/src/ggml-et/et-kernels/src/block_ops.h +997 -0
  436. data/vendor/ggml/src/ggml-et/et-kernels/src/clamp_f32.c +120 -0
  437. data/vendor/ggml/src/ggml-et/et-kernels/src/concat_f32.c +175 -0
  438. data/vendor/ggml/src/ggml-et/et-kernels/src/cont_f16.c +107 -0
  439. data/vendor/ggml/src/ggml-et/et-kernels/src/cont_f32.c +248 -0
  440. data/vendor/ggml/src/ggml-et/et-kernels/src/conv_2d_f32_me.c +807 -0
  441. data/vendor/ggml/src/ggml-et/et-kernels/src/cpy_f32_f16.c +110 -0
  442. data/vendor/ggml/src/ggml-et/et-kernels/src/crt.S +15 -0
  443. data/vendor/ggml/src/ggml-et/et-kernels/src/cumsum_f32.c +96 -0
  444. data/vendor/ggml/src/ggml-et/et-kernels/src/diag_f32.c +90 -0
  445. data/vendor/ggml/src/ggml-et/et-kernels/src/el_map_f32.c +377 -0
  446. data/vendor/ggml/src/ggml-et/et-kernels/src/fill_f32.c +87 -0
  447. data/vendor/ggml/src/ggml-et/et-kernels/src/flash_attn_ext_f16_me.c +1000 -0
  448. data/vendor/ggml/src/ggml-et/et-kernels/src/flash_attn_ext_f32.c +217 -0
  449. data/vendor/ggml/src/ggml-et/et-kernels/src/gated_delta_net_f32.c +346 -0
  450. data/vendor/ggml/src/ggml-et/et-kernels/src/get_rows_f32.c +612 -0
  451. data/vendor/ggml/src/ggml-et/et-kernels/src/ggml_tensor.h +44 -0
  452. data/vendor/ggml/src/ggml-et/et-kernels/src/glu_f32.c +606 -0
  453. data/vendor/ggml/src/ggml-et/et-kernels/src/group_norm_f32.c +171 -0
  454. data/vendor/ggml/src/ggml-et/et-kernels/src/im2col.c +130 -0
  455. data/vendor/ggml/src/ggml-et/et-kernels/src/l2_norm_f32.c +237 -0
  456. data/vendor/ggml/src/ggml-et/et-kernels/src/linker.ld +85 -0
  457. data/vendor/ggml/src/ggml-et/et-kernels/src/math_fp.h +299 -0
  458. data/vendor/ggml/src/ggml-et/et-kernels/src/mean_f32.c +220 -0
  459. data/vendor/ggml/src/ggml-et/et-kernels/src/memops.c +181 -0
  460. data/vendor/ggml/src/ggml-et/et-kernels/src/mul_mat_Q4_0.c +358 -0
  461. data/vendor/ggml/src/ggml-et/et-kernels/src/mul_mat_Q4_0_matrix_engine.c +368 -0
  462. data/vendor/ggml/src/ggml-et/et-kernels/src/mul_mat_Q8_0.c +413 -0
  463. data/vendor/ggml/src/ggml-et/et-kernels/src/mul_mat_f16.c +142 -0
  464. data/vendor/ggml/src/ggml-et/et-kernels/src/mul_mat_f16_matrix_engine.c +329 -0
  465. data/vendor/ggml/src/ggml-et/et-kernels/src/mul_mat_f32.c +137 -0
  466. data/vendor/ggml/src/ggml-et/et-kernels/src/mul_mat_f32_matrix_engine.c +155 -0
  467. data/vendor/ggml/src/ggml-et/et-kernels/src/mul_mat_id_Q4_0.c +169 -0
  468. data/vendor/ggml/src/ggml-et/et-kernels/src/mul_mat_id_Q8_0.c +160 -0
  469. data/vendor/ggml/src/ggml-et/et-kernels/src/mul_mat_id_f32.c +288 -0
  470. data/vendor/ggml/src/ggml-et/et-kernels/src/norm_f32.c +328 -0
  471. data/vendor/ggml/src/ggml-et/et-kernels/src/pad_f32.c +165 -0
  472. data/vendor/ggml/src/ggml-et/et-kernels/src/platform.h +545 -0
  473. data/vendor/ggml/src/ggml-et/et-kernels/src/quants.h +72 -0
  474. data/vendor/ggml/src/ggml-et/et-kernels/src/repeat_f32.c +118 -0
  475. data/vendor/ggml/src/ggml-et/et-kernels/src/rms_norm_f32.c +270 -0
  476. data/vendor/ggml/src/ggml-et/et-kernels/src/rms_norm_mul_f32.c +290 -0
  477. data/vendor/ggml/src/ggml-et/et-kernels/src/rope_f32.c +656 -0
  478. data/vendor/ggml/src/ggml-et/et-kernels/src/rwkv_wkv6_f32.c +184 -0
  479. data/vendor/ggml/src/ggml-et/et-kernels/src/rwkv_wkv7_f32.c +272 -0
  480. data/vendor/ggml/src/ggml-et/et-kernels/src/scale_f32.c +94 -0
  481. data/vendor/ggml/src/ggml-et/et-kernels/src/set_f32.c +101 -0
  482. data/vendor/ggml/src/ggml-et/et-kernels/src/set_rows_f32.c +394 -0
  483. data/vendor/ggml/src/ggml-et/et-kernels/src/softmax_f32.c +698 -0
  484. data/vendor/ggml/src/ggml-et/et-kernels/src/solve_tri_f32.c +109 -0
  485. data/vendor/ggml/src/ggml-et/et-kernels/src/sqr_f32.c +88 -0
  486. data/vendor/ggml/src/ggml-et/et-kernels/src/ssm_conv_f32.c +129 -0
  487. data/vendor/ggml/src/ggml-et/et-kernels/src/ssm_scan_f32.c +282 -0
  488. data/vendor/ggml/src/ggml-et/et-kernels/src/sum_rows_f32.c +103 -0
  489. data/vendor/ggml/src/ggml-et/et-kernels/src/tensor.h +897 -0
  490. data/vendor/ggml/src/ggml-et/et-kernels/src/tri_f32.c +244 -0
  491. data/vendor/ggml/src/ggml-et/et-kernels/src/uberkernel.c +497 -0
  492. data/vendor/ggml/src/ggml-et/et-kernels/src/unary_f32.c +705 -0
  493. data/vendor/ggml/src/ggml-et/ggml-et-common.h +86 -0
  494. data/vendor/ggml/src/ggml-et/ggml-et-cpu-compare.cpp +502 -0
  495. data/vendor/ggml/src/ggml-et/ggml-et-cpu-compare.h +54 -0
  496. data/vendor/ggml/src/ggml-et/ggml-et-kernels.cpp +508 -0
  497. data/vendor/ggml/src/ggml-et/ggml-et-kernels.h +48 -0
  498. data/vendor/ggml/src/ggml-et/ggml-et-memops.cpp +36 -0
  499. data/vendor/ggml/src/ggml-et/ggml-et-memops.h +18 -0
  500. data/vendor/ggml/src/ggml-et/ggml-et-ops.cpp +2584 -0
  501. data/vendor/ggml/src/ggml-et/ggml-et-ops.h +393 -0
  502. data/vendor/ggml/src/ggml-et/ggml-et-uberkernel-common.h +17 -0
  503. data/vendor/ggml/src/ggml-et/ggml-et.cpp +1880 -0
  504. data/vendor/ggml/src/ggml-feats.h +166 -0
  505. data/vendor/ggml/src/ggml-hexagon/CMakeLists.txt +113 -0
  506. data/vendor/ggml/src/ggml-hexagon/ggml-hexagon.cpp +6523 -0
  507. data/vendor/ggml/src/ggml-hexagon/htp/CMakeLists.txt +58 -0
  508. data/vendor/ggml/src/ggml-hexagon/htp/act-ops.c +585 -0
  509. data/vendor/ggml/src/ggml-hexagon/htp/allreduce-ops.c +398 -0
  510. data/vendor/ggml/src/ggml-hexagon/htp/allreduce-ops.h +40 -0
  511. data/vendor/ggml/src/ggml-hexagon/htp/argsort-ops.c +514 -0
  512. data/vendor/ggml/src/ggml-hexagon/htp/binary-ops.c +873 -0
  513. data/vendor/ggml/src/ggml-hexagon/htp/cmake-toolchain.cmake +155 -0
  514. data/vendor/ggml/src/ggml-hexagon/htp/concat-ops.c +277 -0
  515. data/vendor/ggml/src/ggml-hexagon/htp/cpy-ops.c +354 -0
  516. data/vendor/ggml/src/ggml-hexagon/htp/cumsum-ops.c +265 -0
  517. data/vendor/ggml/src/ggml-hexagon/htp/diag-ops.c +216 -0
  518. data/vendor/ggml/src/ggml-hexagon/htp/dma-queue.c +104 -0
  519. data/vendor/ggml/src/ggml-hexagon/htp/dma-queue.h +408 -0
  520. data/vendor/ggml/src/ggml-hexagon/htp/fill-ops.c +123 -0
  521. data/vendor/ggml/src/ggml-hexagon/htp/flash-attn-ops.c +2479 -0
  522. data/vendor/ggml/src/ggml-hexagon/htp/flash-attn-ops.h +344 -0
  523. data/vendor/ggml/src/ggml-hexagon/htp/gated-delta-net-ops.c +1157 -0
  524. data/vendor/ggml/src/ggml-hexagon/htp/get-rows-ops.c +260 -0
  525. data/vendor/ggml/src/ggml-hexagon/htp/get-rows-ops.h +77 -0
  526. data/vendor/ggml/src/ggml-hexagon/htp/hex-bitmap.h +24 -0
  527. data/vendor/ggml/src/ggml-hexagon/htp/hex-common.h +80 -0
  528. data/vendor/ggml/src/ggml-hexagon/htp/hex-dma.h +2 -0
  529. data/vendor/ggml/src/ggml-hexagon/htp/hex-dump.h +86 -0
  530. data/vendor/ggml/src/ggml-hexagon/htp/hex-fastdiv.h +37 -0
  531. data/vendor/ggml/src/ggml-hexagon/htp/hex-profile.h +64 -0
  532. data/vendor/ggml/src/ggml-hexagon/htp/hex-utils.h +65 -0
  533. data/vendor/ggml/src/ggml-hexagon/htp/hmx-fa-kernels.h +555 -0
  534. data/vendor/ggml/src/ggml-hexagon/htp/hmx-mm-kernels-tiled.h +1378 -0
  535. data/vendor/ggml/src/ggml-hexagon/htp/hmx-queue.c +170 -0
  536. data/vendor/ggml/src/ggml-hexagon/htp/hmx-queue.h +160 -0
  537. data/vendor/ggml/src/ggml-hexagon/htp/hmx-utils.h +222 -0
  538. data/vendor/ggml/src/ggml-hexagon/htp/htp-ctx.h +146 -0
  539. data/vendor/ggml/src/ggml-hexagon/htp/htp-ops.h +242 -0
  540. data/vendor/ggml/src/ggml-hexagon/htp/htp-tensor.c +300 -0
  541. data/vendor/ggml/src/ggml-hexagon/htp/htp-tensor.h +29 -0
  542. data/vendor/ggml/src/ggml-hexagon/htp/htp-vtcm.h +19 -0
  543. data/vendor/ggml/src/ggml-hexagon/htp/htp_iface.idl +23 -0
  544. data/vendor/ggml/src/ggml-hexagon/htp/hvx-arith.h +636 -0
  545. data/vendor/ggml/src/ggml-hexagon/htp/hvx-base.h +292 -0
  546. data/vendor/ggml/src/ggml-hexagon/htp/hvx-copy.h +262 -0
  547. data/vendor/ggml/src/ggml-hexagon/htp/hvx-div.h +291 -0
  548. data/vendor/ggml/src/ggml-hexagon/htp/hvx-dump.h +129 -0
  549. data/vendor/ggml/src/ggml-hexagon/htp/hvx-exp.h +255 -0
  550. data/vendor/ggml/src/ggml-hexagon/htp/hvx-fa-kernels.h +303 -0
  551. data/vendor/ggml/src/ggml-hexagon/htp/hvx-flash-attn.h +47 -0
  552. data/vendor/ggml/src/ggml-hexagon/htp/hvx-floor.h +100 -0
  553. data/vendor/ggml/src/ggml-hexagon/htp/hvx-inverse.h +210 -0
  554. data/vendor/ggml/src/ggml-hexagon/htp/hvx-log.h +118 -0
  555. data/vendor/ggml/src/ggml-hexagon/htp/hvx-mm-kernels-flat.h +1511 -0
  556. data/vendor/ggml/src/ggml-hexagon/htp/hvx-mm-kernels-tiled.h +1200 -0
  557. data/vendor/ggml/src/ggml-hexagon/htp/hvx-norm.h +454 -0
  558. data/vendor/ggml/src/ggml-hexagon/htp/hvx-pow.h +42 -0
  559. data/vendor/ggml/src/ggml-hexagon/htp/hvx-quant.h +165 -0
  560. data/vendor/ggml/src/ggml-hexagon/htp/hvx-reduce.h +336 -0
  561. data/vendor/ggml/src/ggml-hexagon/htp/hvx-repl.h +74 -0
  562. data/vendor/ggml/src/ggml-hexagon/htp/hvx-scale.h +199 -0
  563. data/vendor/ggml/src/ggml-hexagon/htp/hvx-sigmoid.h +181 -0
  564. data/vendor/ggml/src/ggml-hexagon/htp/hvx-sin-cos.h +90 -0
  565. data/vendor/ggml/src/ggml-hexagon/htp/hvx-sqrt.h +189 -0
  566. data/vendor/ggml/src/ggml-hexagon/htp/hvx-types.h +36 -0
  567. data/vendor/ggml/src/ggml-hexagon/htp/hvx-utils.h +24 -0
  568. data/vendor/ggml/src/ggml-hexagon/htp/im2col-ops.c +306 -0
  569. data/vendor/ggml/src/ggml-hexagon/htp/main.c +1245 -0
  570. data/vendor/ggml/src/ggml-hexagon/htp/matmul-ops.c +4078 -0
  571. data/vendor/ggml/src/ggml-hexagon/htp/matmul-ops.h +778 -0
  572. data/vendor/ggml/src/ggml-hexagon/htp/pad-ops.c +547 -0
  573. data/vendor/ggml/src/ggml-hexagon/htp/repeat-ops.c +148 -0
  574. data/vendor/ggml/src/ggml-hexagon/htp/rope-ops.c +733 -0
  575. data/vendor/ggml/src/ggml-hexagon/htp/set-rows-ops.c +230 -0
  576. data/vendor/ggml/src/ggml-hexagon/htp/set-rows-ops.h +74 -0
  577. data/vendor/ggml/src/ggml-hexagon/htp/softmax-ops.c +407 -0
  578. data/vendor/ggml/src/ggml-hexagon/htp/solve-tri-ops.c +267 -0
  579. data/vendor/ggml/src/ggml-hexagon/htp/ssm-conv.c +433 -0
  580. data/vendor/ggml/src/ggml-hexagon/htp/sum-rows-ops.c +128 -0
  581. data/vendor/ggml/src/ggml-hexagon/htp/unary-ops.c +1264 -0
  582. data/vendor/ggml/src/ggml-hexagon/htp/unary-ops.h +176 -0
  583. data/vendor/ggml/src/ggml-hexagon/htp/work-queue.c +244 -0
  584. data/vendor/ggml/src/ggml-hexagon/htp/work-queue.h +38 -0
  585. data/vendor/ggml/src/ggml-hexagon/htp-drv.cpp +425 -0
  586. data/vendor/ggml/src/ggml-hexagon/htp-drv.h +123 -0
  587. data/vendor/ggml/src/ggml-hexagon/htp-opnode.h +372 -0
  588. data/vendor/ggml/src/ggml-hexagon/libdl.h +79 -0
  589. data/vendor/ggml/src/ggml-hexagon/libggml-htp.inf +36 -0
  590. data/vendor/ggml/src/ggml-hip/CMakeLists.txt +153 -0
  591. data/vendor/ggml/src/ggml-impl.h +783 -0
  592. data/vendor/ggml/src/ggml-metal/CMakeLists.txt +240 -0
  593. data/vendor/ggml/src/ggml-metal/ggml-metal-common.cpp +474 -0
  594. data/vendor/ggml/src/ggml-metal/ggml-metal-common.h +56 -0
  595. data/vendor/ggml/src/ggml-metal/ggml-metal-context.h +41 -0
  596. data/vendor/ggml/src/ggml-metal/ggml-metal-context.m +759 -0
  597. data/vendor/ggml/src/ggml-metal/ggml-metal-device.cpp +2330 -0
  598. data/vendor/ggml/src/ggml-metal/ggml-metal-device.h +355 -0
  599. data/vendor/ggml/src/ggml-metal/ggml-metal-device.m +2473 -0
  600. data/vendor/ggml/src/ggml-metal/ggml-metal-impl.h +1345 -0
  601. data/vendor/ggml/src/ggml-metal/ggml-metal-ops.cpp +5610 -0
  602. data/vendor/ggml/src/ggml-metal/ggml-metal-ops.h +106 -0
  603. data/vendor/ggml/src/ggml-metal/ggml-metal-tuning.cpp +3732 -0
  604. data/vendor/ggml/src/ggml-metal/ggml-metal-tuning.h +77 -0
  605. data/vendor/ggml/src/ggml-metal/ggml-metal.cpp +1006 -0
  606. data/vendor/ggml/src/ggml-metal/kernels/argsort.metal +337 -0
  607. data/vendor/ggml/src/ggml-metal/kernels/binbcast.metal +228 -0
  608. data/vendor/ggml/src/ggml-metal/kernels/common.h +126 -0
  609. data/vendor/ggml/src/ggml-metal/kernels/conv.metal +724 -0
  610. data/vendor/ggml/src/ggml-metal/kernels/dequantize.h +735 -0
  611. data/vendor/ggml/src/ggml-metal/kernels/fa.metal +2445 -0
  612. data/vendor/ggml/src/ggml-metal/kernels/gated_delta_net.metal +250 -0
  613. data/vendor/ggml/src/ggml-metal/kernels/misc.metal +595 -0
  614. data/vendor/ggml/src/ggml-metal/kernels/mul_mm.metal +853 -0
  615. data/vendor/ggml/src/ggml-metal/kernels/mul_mv.metal +3225 -0
  616. data/vendor/ggml/src/ggml-metal/kernels/norm.metal +308 -0
  617. data/vendor/ggml/src/ggml-metal/kernels/pool.metal +148 -0
  618. data/vendor/ggml/src/ggml-metal/kernels/quantize.h +262 -0
  619. data/vendor/ggml/src/ggml-metal/kernels/quantize.metal +480 -0
  620. data/vendor/ggml/src/ggml-metal/kernels/reduce.metal +228 -0
  621. data/vendor/ggml/src/ggml-metal/kernels/rope.metal +333 -0
  622. data/vendor/ggml/src/ggml-metal/kernels/softmax.metal +223 -0
  623. data/vendor/ggml/src/ggml-metal/kernels/solve_tri.metal +75 -0
  624. data/vendor/ggml/src/ggml-metal/kernels/ssm.metal +473 -0
  625. data/vendor/ggml/src/ggml-metal/kernels/tri.metal +69 -0
  626. data/vendor/ggml/src/ggml-metal/kernels/unary.metal +400 -0
  627. data/vendor/ggml/src/ggml-metal/kernels/upscale.metal +179 -0
  628. data/vendor/ggml/src/ggml-metal/kernels/wkv.metal +179 -0
  629. data/vendor/ggml/src/ggml-musa/CMakeLists.txt +123 -0
  630. data/vendor/ggml/src/ggml-musa/mudnn.cu +112 -0
  631. data/vendor/ggml/src/ggml-musa/mudnn.cuh +12 -0
  632. data/vendor/ggml/src/ggml-opencl/CMakeLists.txt +246 -0
  633. data/vendor/ggml/src/ggml-opencl/cl-program-cache.cpp +453 -0
  634. data/vendor/ggml/src/ggml-opencl/cl-program-cache.h +75 -0
  635. data/vendor/ggml/src/ggml-opencl/fa_tune.h +92 -0
  636. data/vendor/ggml/src/ggml-opencl/ggml-opencl.cpp +26982 -0
  637. data/vendor/ggml/src/ggml-opencl/kernels/abs.cl +113 -0
  638. data/vendor/ggml/src/ggml-opencl/kernels/add.cl +190 -0
  639. data/vendor/ggml/src/ggml-opencl/kernels/add_id.cl +42 -0
  640. data/vendor/ggml/src/ggml-opencl/kernels/argsort.cl +86 -0
  641. data/vendor/ggml/src/ggml-opencl/kernels/clamp.cl +20 -0
  642. data/vendor/ggml/src/ggml-opencl/kernels/concat.cl +118 -0
  643. data/vendor/ggml/src/ggml-opencl/kernels/conv2d.cl +185 -0
  644. data/vendor/ggml/src/ggml-opencl/kernels/conv2d_f16_f32.cl +176 -0
  645. data/vendor/ggml/src/ggml-opencl/kernels/cpy.cl +288 -0
  646. data/vendor/ggml/src/ggml-opencl/kernels/cumsum.cl +139 -0
  647. data/vendor/ggml/src/ggml-opencl/kernels/cvt.cl +2663 -0
  648. data/vendor/ggml/src/ggml-opencl/kernels/diag.cl +27 -0
  649. data/vendor/ggml/src/ggml-opencl/kernels/diag_mask_inf.cl +58 -0
  650. data/vendor/ggml/src/ggml-opencl/kernels/div.cl +138 -0
  651. data/vendor/ggml/src/ggml-opencl/kernels/embed_kernel.py +26 -0
  652. data/vendor/ggml/src/ggml-opencl/kernels/exp.cl +125 -0
  653. data/vendor/ggml/src/ggml-opencl/kernels/expm1.cl +113 -0
  654. data/vendor/ggml/src/ggml-opencl/kernels/fill.cl +17 -0
  655. data/vendor/ggml/src/ggml-opencl/kernels/flash_attn_f16.cl +421 -0
  656. data/vendor/ggml/src/ggml-opencl/kernels/flash_attn_f32.cl +422 -0
  657. data/vendor/ggml/src/ggml-opencl/kernels/flash_attn_f32_f16.cl +2656 -0
  658. data/vendor/ggml/src/ggml-opencl/kernels/flash_attn_f32_q4_0.cl +2011 -0
  659. data/vendor/ggml/src/ggml-opencl/kernels/flash_attn_f32_q8_0.cl +1840 -0
  660. data/vendor/ggml/src/ggml-opencl/kernels/flash_attn_pre_f16.cl +156 -0
  661. data/vendor/ggml/src/ggml-opencl/kernels/gated_delta_net.cl +249 -0
  662. data/vendor/ggml/src/ggml-opencl/kernels/gelu.cl +89 -0
  663. data/vendor/ggml/src/ggml-opencl/kernels/gemm_moe_mxfp4_f32.cl +162 -0
  664. data/vendor/ggml/src/ggml-opencl/kernels/gemm_moe_mxfp4_f32_ns.cl +376 -0
  665. data/vendor/ggml/src/ggml-opencl/kernels/gemm_moe_mxfp4_q8_1_dp4a.cl +190 -0
  666. data/vendor/ggml/src/ggml-opencl/kernels/gemm_moe_q4_0_f32_ns.cl +324 -0
  667. data/vendor/ggml/src/ggml-opencl/kernels/gemm_moe_q4_0_q8_1_dp4a.cl +169 -0
  668. data/vendor/ggml/src/ggml-opencl/kernels/gemm_moe_q4_1_f32_ns.cl +326 -0
  669. data/vendor/ggml/src/ggml-opencl/kernels/gemm_moe_q4_k_f32_ns.cl +348 -0
  670. data/vendor/ggml/src/ggml-opencl/kernels/gemm_moe_q4_k_q8_1_dp4a.cl +209 -0
  671. data/vendor/ggml/src/ggml-opencl/kernels/gemm_moe_q5_0_f32_ns.cl +328 -0
  672. data/vendor/ggml/src/ggml-opencl/kernels/gemm_moe_q5_1_f32_ns.cl +330 -0
  673. data/vendor/ggml/src/ggml-opencl/kernels/gemm_moe_q5_k_f32_ns.cl +356 -0
  674. data/vendor/ggml/src/ggml-opencl/kernels/gemm_moe_q6_k_f32_ns.cl +335 -0
  675. data/vendor/ggml/src/ggml-opencl/kernels/gemm_moe_q6_k_q8_1_dp4a.cl +200 -0
  676. data/vendor/ggml/src/ggml-opencl/kernels/gemm_moe_q8_0_f32_ns.cl +221 -0
  677. data/vendor/ggml/src/ggml-opencl/kernels/gemm_moe_q8_1_dp4a.cl +226 -0
  678. data/vendor/ggml/src/ggml-opencl/kernels/gemm_noshuffle_iq4_nl_f32.cl +150 -0
  679. data/vendor/ggml/src/ggml-opencl/kernels/gemm_noshuffle_iq4_nl_q8_1_dp4a.cl +143 -0
  680. data/vendor/ggml/src/ggml-opencl/kernels/gemm_noshuffle_q1_0_f32.cl +94 -0
  681. data/vendor/ggml/src/ggml-opencl/kernels/gemm_noshuffle_q4_0_f32.cl +139 -0
  682. data/vendor/ggml/src/ggml-opencl/kernels/gemm_noshuffle_q4_0_q8_1_dp4a.cl +127 -0
  683. data/vendor/ggml/src/ggml-opencl/kernels/gemm_noshuffle_q4_1_f32.cl +132 -0
  684. data/vendor/ggml/src/ggml-opencl/kernels/gemm_noshuffle_q4_k_f32.cl +490 -0
  685. data/vendor/ggml/src/ggml-opencl/kernels/gemm_noshuffle_q4_k_q8_1_dp4a.cl +281 -0
  686. data/vendor/ggml/src/ggml-opencl/kernels/gemm_noshuffle_q5_0_f32.cl +131 -0
  687. data/vendor/ggml/src/ggml-opencl/kernels/gemm_noshuffle_q5_0_q8_1_dp4a.cl +235 -0
  688. data/vendor/ggml/src/ggml-opencl/kernels/gemm_noshuffle_q5_1_f32.cl +134 -0
  689. data/vendor/ggml/src/ggml-opencl/kernels/gemm_noshuffle_q5_k_f32.cl +176 -0
  690. data/vendor/ggml/src/ggml-opencl/kernels/gemm_noshuffle_q5_k_q8_1_dp4a.cl +164 -0
  691. data/vendor/ggml/src/ggml-opencl/kernels/gemm_noshuffle_q6_k_f32.cl +245 -0
  692. data/vendor/ggml/src/ggml-opencl/kernels/gemm_noshuffle_q6_k_f32_tiled.cl +136 -0
  693. data/vendor/ggml/src/ggml-opencl/kernels/gemm_noshuffle_q6_k_q8_1_dp4a.cl +144 -0
  694. data/vendor/ggml/src/ggml-opencl/kernels/gemm_noshuffle_q8_0_f32.cl +129 -0
  695. data/vendor/ggml/src/ggml-opencl/kernels/gemm_noshuffle_q8_0_q8_1_dp4a.cl +212 -0
  696. data/vendor/ggml/src/ggml-opencl/kernels/gemm_xmem_f16_f32_os8.cl +233 -0
  697. data/vendor/ggml/src/ggml-opencl/kernels/gemv_moe_mxfp4_f32.cl +156 -0
  698. data/vendor/ggml/src/ggml-opencl/kernels/gemv_moe_mxfp4_f32_ns.cl +257 -0
  699. data/vendor/ggml/src/ggml-opencl/kernels/gemv_moe_q4_0_f32_ns.cl +120 -0
  700. data/vendor/ggml/src/ggml-opencl/kernels/gemv_moe_q4_1_f32_ns.cl +123 -0
  701. data/vendor/ggml/src/ggml-opencl/kernels/gemv_moe_q4_k_f32_ns.cl +266 -0
  702. data/vendor/ggml/src/ggml-opencl/kernels/gemv_moe_q5_0_f32_ns.cl +123 -0
  703. data/vendor/ggml/src/ggml-opencl/kernels/gemv_moe_q5_1_f32_ns.cl +125 -0
  704. data/vendor/ggml/src/ggml-opencl/kernels/gemv_moe_q5_k_f32_ns.cl +160 -0
  705. data/vendor/ggml/src/ggml-opencl/kernels/gemv_moe_q6_k_f32_ns.cl +141 -0
  706. data/vendor/ggml/src/ggml-opencl/kernels/gemv_noshuffle_iq4_nl_f32.cl +307 -0
  707. data/vendor/ggml/src/ggml-opencl/kernels/gemv_noshuffle_q1_0_f32.cl +125 -0
  708. data/vendor/ggml/src/ggml-opencl/kernels/gemv_noshuffle_q4_0_f32.cl +383 -0
  709. data/vendor/ggml/src/ggml-opencl/kernels/gemv_noshuffle_q4_0_f32_spec.cl +272 -0
  710. data/vendor/ggml/src/ggml-opencl/kernels/gemv_noshuffle_q4_1_f32.cl +384 -0
  711. data/vendor/ggml/src/ggml-opencl/kernels/gemv_noshuffle_q4_k_f32.cl +823 -0
  712. data/vendor/ggml/src/ggml-opencl/kernels/gemv_noshuffle_q4_k_f32_o4.cl +349 -0
  713. data/vendor/ggml/src/ggml-opencl/kernels/gemv_noshuffle_q4_k_f32_tiled.cl +118 -0
  714. data/vendor/ggml/src/ggml-opencl/kernels/gemv_noshuffle_q5_0_f32.cl +296 -0
  715. data/vendor/ggml/src/ggml-opencl/kernels/gemv_noshuffle_q5_1_f32.cl +299 -0
  716. data/vendor/ggml/src/ggml-opencl/kernels/gemv_noshuffle_q5_k_f32.cl +453 -0
  717. data/vendor/ggml/src/ggml-opencl/kernels/gemv_noshuffle_q6_k_f32.cl +409 -0
  718. data/vendor/ggml/src/ggml-opencl/kernels/gemv_noshuffle_q6_k_f32_o4.cl +372 -0
  719. data/vendor/ggml/src/ggml-opencl/kernels/gemv_noshuffle_q6_k_f32_tiled.cl +196 -0
  720. data/vendor/ggml/src/ggml-opencl/kernels/gemv_noshuffle_q8_0_f32.cl +280 -0
  721. data/vendor/ggml/src/ggml-opencl/kernels/get_rows.cl +193 -0
  722. data/vendor/ggml/src/ggml-opencl/kernels/glu.cl +443 -0
  723. data/vendor/ggml/src/ggml-opencl/kernels/group_norm.cl +121 -0
  724. data/vendor/ggml/src/ggml-opencl/kernels/im2col_f16.cl +57 -0
  725. data/vendor/ggml/src/ggml-opencl/kernels/im2col_f32.cl +57 -0
  726. data/vendor/ggml/src/ggml-opencl/kernels/l2_norm.cl +71 -0
  727. data/vendor/ggml/src/ggml-opencl/kernels/mean.cl +140 -0
  728. data/vendor/ggml/src/ggml-opencl/kernels/moe_add_id_glu.cl +76 -0
  729. data/vendor/ggml/src/ggml-opencl/kernels/moe_combine.cl +79 -0
  730. data/vendor/ggml/src/ggml-opencl/kernels/moe_reorder_b.cl +30 -0
  731. data/vendor/ggml/src/ggml-opencl/kernels/moe_reorder_quant_a_q8_1.cl +64 -0
  732. data/vendor/ggml/src/ggml-opencl/kernels/moe_sort_by_expert.cl +155 -0
  733. data/vendor/ggml/src/ggml-opencl/kernels/mul.cl +152 -0
  734. data/vendor/ggml/src/ggml-opencl/kernels/mul_mat_f16_f32.cl +130 -0
  735. data/vendor/ggml/src/ggml-opencl/kernels/mul_mm_f16_f32_kq_kqv.cl +273 -0
  736. data/vendor/ggml/src/ggml-opencl/kernels/mul_mm_f16_f32_l4_lm.cl +146 -0
  737. data/vendor/ggml/src/ggml-opencl/kernels/mul_mm_f32_f32_l4_lm.cl +196 -0
  738. data/vendor/ggml/src/ggml-opencl/kernels/mul_mm_iq4_nl_f32_l4_lm.cl +171 -0
  739. data/vendor/ggml/src/ggml-opencl/kernels/mul_mm_q1_0_f32_l4_lm.cl +156 -0
  740. data/vendor/ggml/src/ggml-opencl/kernels/mul_mm_q4_0_f32_l4_lm.cl +163 -0
  741. data/vendor/ggml/src/ggml-opencl/kernels/mul_mm_q4_1_f32_l4_lm.cl +165 -0
  742. data/vendor/ggml/src/ggml-opencl/kernels/mul_mm_q4_k_f32_l4_lm.cl +189 -0
  743. data/vendor/ggml/src/ggml-opencl/kernels/mul_mm_q5_0_f32_l4_lm.cl +173 -0
  744. data/vendor/ggml/src/ggml-opencl/kernels/mul_mm_q5_1_f32_l4_lm.cl +175 -0
  745. data/vendor/ggml/src/ggml-opencl/kernels/mul_mm_q5_k_f32_l4_lm.cl +202 -0
  746. data/vendor/ggml/src/ggml-opencl/kernels/mul_mm_q6_k_f32_l4_lm.cl +158 -0
  747. data/vendor/ggml/src/ggml-opencl/kernels/mul_mm_q8_0_f32_l4_lm.cl +154 -0
  748. data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_f16_f16.cl +125 -0
  749. data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_f16_f32.cl +125 -0
  750. data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_f16_f32_1row.cl +101 -0
  751. data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_f16_f32_l4.cl +1237 -0
  752. data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_f16_f32_mrow.cl +306 -0
  753. data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_f32_f32.cl +118 -0
  754. data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_id_mxfp4_f32.cl +189 -0
  755. data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_id_mxfp4_f32_flat.cl +176 -0
  756. data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_id_q4_0_f32_8x_flat.cl +283 -0
  757. data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_id_q8_0_f32.cl +140 -0
  758. data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_id_q8_0_f32_flat.cl +222 -0
  759. data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_iq4_nl_f32.cl +164 -0
  760. data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_iq4_nl_f32_flat.cl +202 -0
  761. data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_mxfp4_f32.cl +144 -0
  762. data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_mxfp4_f32_flat.cl +167 -0
  763. data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_q1_0_f32.cl +141 -0
  764. data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_q1_0_f32_flat.cl +190 -0
  765. data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_q4_0_f32.cl +192 -0
  766. data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_q4_0_f32_1d_16x_flat.cl +307 -0
  767. data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_q4_0_f32_1d_8x_flat.cl +265 -0
  768. data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_q4_0_f32_8x_flat.cl +272 -0
  769. data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_q4_0_f32_v.cl +254 -0
  770. data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_q4_1_f32.cl +219 -0
  771. data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_q4_1_f32_flat.cl +229 -0
  772. data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_q4_k_f32.cl +182 -0
  773. data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_q4_k_f32_flat.cl +205 -0
  774. data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_q5_0_f32.cl +241 -0
  775. data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_q5_0_f32_flat.cl +243 -0
  776. data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_q5_1_f32.cl +243 -0
  777. data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_q5_1_f32_flat.cl +247 -0
  778. data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_q5_k_f32.cl +187 -0
  779. data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_q5_k_f32_flat.cl +244 -0
  780. data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_q6_k_f32.cl +194 -0
  781. data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_q6_k_f32_flat.cl +272 -0
  782. data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_q8_0_f32.cl +125 -0
  783. data/vendor/ggml/src/ggml-opencl/kernels/mul_mv_q8_0_f32_flat.cl +202 -0
  784. data/vendor/ggml/src/ggml-opencl/kernels/neg.cl +125 -0
  785. data/vendor/ggml/src/ggml-opencl/kernels/norm.cl +164 -0
  786. data/vendor/ggml/src/ggml-opencl/kernels/pad.cl +39 -0
  787. data/vendor/ggml/src/ggml-opencl/kernels/quant_a_q8_1.cl +42 -0
  788. data/vendor/ggml/src/ggml-opencl/kernels/relu.cl +16 -0
  789. data/vendor/ggml/src/ggml-opencl/kernels/repeat.cl +38 -0
  790. data/vendor/ggml/src/ggml-opencl/kernels/rms_norm.cl +369 -0
  791. data/vendor/ggml/src/ggml-opencl/kernels/rope.cl +759 -0
  792. data/vendor/ggml/src/ggml-opencl/kernels/scale.cl +27 -0
  793. data/vendor/ggml/src/ggml-opencl/kernels/set_rows.cl +708 -0
  794. data/vendor/ggml/src/ggml-opencl/kernels/sigmoid.cl +29 -0
  795. data/vendor/ggml/src/ggml-opencl/kernels/silu.cl +30 -0
  796. data/vendor/ggml/src/ggml-opencl/kernels/softmax_4_f16.cl +108 -0
  797. data/vendor/ggml/src/ggml-opencl/kernels/softmax_4_f32.cl +108 -0
  798. data/vendor/ggml/src/ggml-opencl/kernels/softmax_f16.cl +107 -0
  799. data/vendor/ggml/src/ggml-opencl/kernels/softmax_f32.cl +107 -0
  800. data/vendor/ggml/src/ggml-opencl/kernels/softplus.cl +116 -0
  801. data/vendor/ggml/src/ggml-opencl/kernels/solve_tri.cl +51 -0
  802. data/vendor/ggml/src/ggml-opencl/kernels/sqr.cl +53 -0
  803. data/vendor/ggml/src/ggml-opencl/kernels/sqrt.cl +53 -0
  804. data/vendor/ggml/src/ggml-opencl/kernels/ssm_conv.cl +77 -0
  805. data/vendor/ggml/src/ggml-opencl/kernels/ssm_scan.cl +216 -0
  806. data/vendor/ggml/src/ggml-opencl/kernels/sub.cl +138 -0
  807. data/vendor/ggml/src/ggml-opencl/kernels/sum_rows.cl +140 -0
  808. data/vendor/ggml/src/ggml-opencl/kernels/tanh.cl +109 -0
  809. data/vendor/ggml/src/ggml-opencl/kernels/transpose.cl +143 -0
  810. data/vendor/ggml/src/ggml-opencl/kernels/tri.cl +32 -0
  811. data/vendor/ggml/src/ggml-opencl/kernels/tsembd.cl +48 -0
  812. data/vendor/ggml/src/ggml-opencl/kernels/upscale.cl +120 -0
  813. data/vendor/ggml/src/ggml-opencl/libdl.h +79 -0
  814. data/vendor/ggml/src/ggml-openvino/CMakeLists.txt +22 -0
  815. data/vendor/ggml/src/ggml-openvino/ggml-decoder.cpp +2057 -0
  816. data/vendor/ggml/src/ggml-openvino/ggml-decoder.h +417 -0
  817. data/vendor/ggml/src/ggml-openvino/ggml-openvino-extra.cpp +493 -0
  818. data/vendor/ggml/src/ggml-openvino/ggml-openvino-extra.h +216 -0
  819. data/vendor/ggml/src/ggml-openvino/ggml-openvino.cpp +1566 -0
  820. data/vendor/ggml/src/ggml-openvino/ggml-quants.cpp +1273 -0
  821. data/vendor/ggml/src/ggml-openvino/ggml-quants.h +186 -0
  822. data/vendor/ggml/src/ggml-openvino/model-cache.cpp +272 -0
  823. data/vendor/ggml/src/ggml-openvino/model-cache.h +56 -0
  824. data/vendor/ggml/src/ggml-openvino/openvino/decoder.h +133 -0
  825. data/vendor/ggml/src/ggml-openvino/openvino/frontend.cpp +27 -0
  826. data/vendor/ggml/src/ggml-openvino/openvino/frontend.h +23 -0
  827. data/vendor/ggml/src/ggml-openvino/openvino/input_model.cpp +17 -0
  828. data/vendor/ggml/src/ggml-openvino/openvino/input_model.h +29 -0
  829. data/vendor/ggml/src/ggml-openvino/openvino/node_context.h +171 -0
  830. data/vendor/ggml/src/ggml-openvino/openvino/op/add.cpp +45 -0
  831. data/vendor/ggml/src/ggml-openvino/openvino/op/add_id.cpp +76 -0
  832. data/vendor/ggml/src/ggml-openvino/openvino/op/argsort.cpp +47 -0
  833. data/vendor/ggml/src/ggml-openvino/openvino/op/clamp.cpp +33 -0
  834. data/vendor/ggml/src/ggml-openvino/openvino/op/concat.cpp +48 -0
  835. data/vendor/ggml/src/ggml-openvino/openvino/op/cont.cpp +40 -0
  836. data/vendor/ggml/src/ggml-openvino/openvino/op/cpy.cpp +295 -0
  837. data/vendor/ggml/src/ggml-openvino/openvino/op/cumsum.cpp +29 -0
  838. data/vendor/ggml/src/ggml-openvino/openvino/op/diag.cpp +58 -0
  839. data/vendor/ggml/src/ggml-openvino/openvino/op/div.cpp +146 -0
  840. data/vendor/ggml/src/ggml-openvino/openvino/op/fill.cpp +34 -0
  841. data/vendor/ggml/src/ggml-openvino/openvino/op/flash_attn_ext.cpp +241 -0
  842. data/vendor/ggml/src/ggml-openvino/openvino/op/gated_delta_net.cpp +327 -0
  843. data/vendor/ggml/src/ggml-openvino/openvino/op/gated_delta_net.hpp +65 -0
  844. data/vendor/ggml/src/ggml-openvino/openvino/op/gather_matmul.hpp +43 -0
  845. data/vendor/ggml/src/ggml-openvino/openvino/op/get_rows.cpp +142 -0
  846. data/vendor/ggml/src/ggml-openvino/openvino/op/glu_geglu.cpp +75 -0
  847. data/vendor/ggml/src/ggml-openvino/openvino/op/glu_geglu_quick.cpp +64 -0
  848. data/vendor/ggml/src/ggml-openvino/openvino/op/glu_swiglu.cpp +110 -0
  849. data/vendor/ggml/src/ggml-openvino/openvino/op/im2col.cpp +120 -0
  850. data/vendor/ggml/src/ggml-openvino/openvino/op/l2_norm.cpp +61 -0
  851. data/vendor/ggml/src/ggml-openvino/openvino/op/mul_mat_id.cpp +283 -0
  852. data/vendor/ggml/src/ggml-openvino/openvino/op/mulmat.cpp +100 -0
  853. data/vendor/ggml/src/ggml-openvino/openvino/op/norm.cpp +58 -0
  854. data/vendor/ggml/src/ggml-openvino/openvino/op/pad.cpp +95 -0
  855. data/vendor/ggml/src/ggml-openvino/openvino/op/permute.cpp +147 -0
  856. data/vendor/ggml/src/ggml-openvino/openvino/op/pool_2d.cpp +53 -0
  857. data/vendor/ggml/src/ggml-openvino/openvino/op/repeat.cpp +48 -0
  858. data/vendor/ggml/src/ggml-openvino/openvino/op/reshape.cpp +113 -0
  859. data/vendor/ggml/src/ggml-openvino/openvino/op/rms_norm.cpp +81 -0
  860. data/vendor/ggml/src/ggml-openvino/openvino/op/roll.cpp +36 -0
  861. data/vendor/ggml/src/ggml-openvino/openvino/op/rope.cpp +303 -0
  862. data/vendor/ggml/src/ggml-openvino/openvino/op/scale.cpp +86 -0
  863. data/vendor/ggml/src/ggml-openvino/openvino/op/set.cpp +76 -0
  864. data/vendor/ggml/src/ggml-openvino/openvino/op/set_rows.cpp +95 -0
  865. data/vendor/ggml/src/ggml-openvino/openvino/op/softmax.cpp +166 -0
  866. data/vendor/ggml/src/ggml-openvino/openvino/op/solve_tri.cpp +108 -0
  867. data/vendor/ggml/src/ggml-openvino/openvino/op/sqr.cpp +35 -0
  868. data/vendor/ggml/src/ggml-openvino/openvino/op/ssm_conv.cpp +61 -0
  869. data/vendor/ggml/src/ggml-openvino/openvino/op/sum_rows.cpp +27 -0
  870. data/vendor/ggml/src/ggml-openvino/openvino/op/transpose.cpp +54 -0
  871. data/vendor/ggml/src/ggml-openvino/openvino/op/tri.cpp +82 -0
  872. data/vendor/ggml/src/ggml-openvino/openvino/op/unary_silu.cpp +27 -0
  873. data/vendor/ggml/src/ggml-openvino/openvino/op/unary_softplus.cpp +38 -0
  874. data/vendor/ggml/src/ggml-openvino/openvino/op/view.cpp +245 -0
  875. data/vendor/ggml/src/ggml-openvino/openvino/op_table.cpp +88 -0
  876. data/vendor/ggml/src/ggml-openvino/openvino/op_table.h +67 -0
  877. data/vendor/ggml/src/ggml-openvino/openvino/pass/fuse_to_conv.cpp +212 -0
  878. data/vendor/ggml/src/ggml-openvino/openvino/pass/fuse_to_conv.h +17 -0
  879. data/vendor/ggml/src/ggml-openvino/openvino/pass/fuse_to_sdpa.cpp +60 -0
  880. data/vendor/ggml/src/ggml-openvino/openvino/pass/fuse_to_sdpa.h +17 -0
  881. data/vendor/ggml/src/ggml-openvino/openvino/pass/mark_decompression_convert_constant_folding.h +29 -0
  882. data/vendor/ggml/src/ggml-openvino/openvino/pass/mark_dequantization_subgraph.h +44 -0
  883. data/vendor/ggml/src/ggml-openvino/openvino/pass/squeeze_matmul.cpp +58 -0
  884. data/vendor/ggml/src/ggml-openvino/openvino/pass/squeeze_matmul.h +17 -0
  885. data/vendor/ggml/src/ggml-openvino/openvino/rt_info/weightless_caching_attributes.hpp +41 -0
  886. data/vendor/ggml/src/ggml-openvino/openvino/translate_session.cpp +432 -0
  887. data/vendor/ggml/src/ggml-openvino/openvino/translate_session.h +29 -0
  888. data/vendor/ggml/src/ggml-openvino/openvino/utils.cpp +886 -0
  889. data/vendor/ggml/src/ggml-openvino/openvino/utils.h +88 -0
  890. data/vendor/ggml/src/ggml-openvino/utils.cpp +1496 -0
  891. data/vendor/ggml/src/ggml-openvino/utils.h +195 -0
  892. data/vendor/ggml/src/ggml-opt.cpp +1094 -0
  893. data/vendor/ggml/src/ggml-quants.c +5667 -0
  894. data/vendor/ggml/src/ggml-quants.h +115 -0
  895. data/vendor/ggml/src/ggml-rpc/CMakeLists.txt +49 -0
  896. data/vendor/ggml/src/ggml-rpc/ggml-rpc.cpp +2351 -0
  897. data/vendor/ggml/src/ggml-rpc/transport-apple.cpp +481 -0
  898. data/vendor/ggml/src/ggml-rpc/transport-apple.h +27 -0
  899. data/vendor/ggml/src/ggml-rpc/transport.cpp +739 -0
  900. data/vendor/ggml/src/ggml-rpc/transport.h +38 -0
  901. data/vendor/ggml/src/ggml-sycl/CMakeLists.txt +218 -0
  902. data/vendor/ggml/src/ggml-sycl/add-id.cpp +81 -0
  903. data/vendor/ggml/src/ggml-sycl/add-id.hpp +8 -0
  904. data/vendor/ggml/src/ggml-sycl/backend.hpp +52 -0
  905. data/vendor/ggml/src/ggml-sycl/base.hpp +36 -0
  906. data/vendor/ggml/src/ggml-sycl/binbcast.cpp +650 -0
  907. data/vendor/ggml/src/ggml-sycl/binbcast.hpp +69 -0
  908. data/vendor/ggml/src/ggml-sycl/col2im-1d.cpp +102 -0
  909. data/vendor/ggml/src/ggml-sycl/col2im-1d.hpp +8 -0
  910. data/vendor/ggml/src/ggml-sycl/common.cpp +153 -0
  911. data/vendor/ggml/src/ggml-sycl/common.hpp +1029 -0
  912. data/vendor/ggml/src/ggml-sycl/concat.cpp +509 -0
  913. data/vendor/ggml/src/ggml-sycl/concat.hpp +20 -0
  914. data/vendor/ggml/src/ggml-sycl/conv.cpp +101 -0
  915. data/vendor/ggml/src/ggml-sycl/conv.hpp +20 -0
  916. data/vendor/ggml/src/ggml-sycl/conv2d-dw.cpp +170 -0
  917. data/vendor/ggml/src/ggml-sycl/conv2d-dw.hpp +10 -0
  918. data/vendor/ggml/src/ggml-sycl/conv2d-transpose.cpp +125 -0
  919. data/vendor/ggml/src/ggml-sycl/conv2d-transpose.hpp +10 -0
  920. data/vendor/ggml/src/ggml-sycl/conv2d.cpp +150 -0
  921. data/vendor/ggml/src/ggml-sycl/conv2d.hpp +10 -0
  922. data/vendor/ggml/src/ggml-sycl/conv3d.cpp +224 -0
  923. data/vendor/ggml/src/ggml-sycl/conv3d.hpp +8 -0
  924. data/vendor/ggml/src/ggml-sycl/convert.cpp +877 -0
  925. data/vendor/ggml/src/ggml-sycl/convert.hpp +64 -0
  926. data/vendor/ggml/src/ggml-sycl/count-equal.cpp +79 -0
  927. data/vendor/ggml/src/ggml-sycl/count-equal.hpp +9 -0
  928. data/vendor/ggml/src/ggml-sycl/cpy.cpp +1433 -0
  929. data/vendor/ggml/src/ggml-sycl/cpy.hpp +537 -0
  930. data/vendor/ggml/src/ggml-sycl/cross_entropy_loss.cpp +255 -0
  931. data/vendor/ggml/src/ggml-sycl/cross_entropy_loss.hpp +7 -0
  932. data/vendor/ggml/src/ggml-sycl/cumsum.cpp +148 -0
  933. data/vendor/ggml/src/ggml-sycl/cumsum.hpp +5 -0
  934. data/vendor/ggml/src/ggml-sycl/dequantize.hpp +1681 -0
  935. data/vendor/ggml/src/ggml-sycl/diag.cpp +67 -0
  936. data/vendor/ggml/src/ggml-sycl/diag.hpp +5 -0
  937. data/vendor/ggml/src/ggml-sycl/dmmv.cpp +2227 -0
  938. data/vendor/ggml/src/ggml-sycl/dmmv.hpp +27 -0
  939. data/vendor/ggml/src/ggml-sycl/dpct/helper.hpp +3782 -0
  940. data/vendor/ggml/src/ggml-sycl/dsv4-hc.cpp +280 -0
  941. data/vendor/ggml/src/ggml-sycl/dsv4-hc.hpp +10 -0
  942. data/vendor/ggml/src/ggml-sycl/element_wise.cpp +1432 -0
  943. data/vendor/ggml/src/ggml-sycl/element_wise.hpp +135 -0
  944. data/vendor/ggml/src/ggml-sycl/esimd.hpp +589 -0
  945. data/vendor/ggml/src/ggml-sycl/fattn-buffers.cpp +56 -0
  946. data/vendor/ggml/src/ggml-sycl/fattn-buffers.hpp +63 -0
  947. data/vendor/ggml/src/ggml-sycl/fattn-common.hpp +1185 -0
  948. data/vendor/ggml/src/ggml-sycl/fattn-mkl.cpp +689 -0
  949. data/vendor/ggml/src/ggml-sycl/fattn-onednn.cpp +450 -0
  950. data/vendor/ggml/src/ggml-sycl/fattn-onednn.hpp +18 -0
  951. data/vendor/ggml/src/ggml-sycl/fattn-tile.cpp +59 -0
  952. data/vendor/ggml/src/ggml-sycl/fattn-tile.hpp +1246 -0
  953. data/vendor/ggml/src/ggml-sycl/fattn-vec.hpp +684 -0
  954. data/vendor/ggml/src/ggml-sycl/fattn.cpp +452 -0
  955. data/vendor/ggml/src/ggml-sycl/fattn.hpp +42 -0
  956. data/vendor/ggml/src/ggml-sycl/fill.cpp +55 -0
  957. data/vendor/ggml/src/ggml-sycl/fill.hpp +5 -0
  958. data/vendor/ggml/src/ggml-sycl/fusion.cpp +212 -0
  959. data/vendor/ggml/src/ggml-sycl/fusion.hpp +17 -0
  960. data/vendor/ggml/src/ggml-sycl/fwht.cpp +119 -0
  961. data/vendor/ggml/src/ggml-sycl/fwht.hpp +12 -0
  962. data/vendor/ggml/src/ggml-sycl/gated_delta_net.cpp +366 -0
  963. data/vendor/ggml/src/ggml-sycl/gated_delta_net.hpp +19 -0
  964. data/vendor/ggml/src/ggml-sycl/gemm.hpp +93 -0
  965. data/vendor/ggml/src/ggml-sycl/getrows.cpp +368 -0
  966. data/vendor/ggml/src/ggml-sycl/getrows.hpp +20 -0
  967. data/vendor/ggml/src/ggml-sycl/ggml-sycl.cpp +7028 -0
  968. data/vendor/ggml/src/ggml-sycl/gla.cpp +106 -0
  969. data/vendor/ggml/src/ggml-sycl/gla.hpp +8 -0
  970. data/vendor/ggml/src/ggml-sycl/im2col.cpp +400 -0
  971. data/vendor/ggml/src/ggml-sycl/im2col.hpp +23 -0
  972. data/vendor/ggml/src/ggml-sycl/lightning-indexer.cpp +197 -0
  973. data/vendor/ggml/src/ggml-sycl/lightning-indexer.hpp +8 -0
  974. data/vendor/ggml/src/ggml-sycl/mem.cpp +162 -0
  975. data/vendor/ggml/src/ggml-sycl/mem.hpp +16 -0
  976. data/vendor/ggml/src/ggml-sycl/mmq.cpp +3030 -0
  977. data/vendor/ggml/src/ggml-sycl/mmq.hpp +33 -0
  978. data/vendor/ggml/src/ggml-sycl/mmvq.cpp +3033 -0
  979. data/vendor/ggml/src/ggml-sycl/mmvq.hpp +76 -0
  980. data/vendor/ggml/src/ggml-sycl/norm.cpp +963 -0
  981. data/vendor/ggml/src/ggml-sycl/norm.hpp +32 -0
  982. data/vendor/ggml/src/ggml-sycl/opt-step.cpp +131 -0
  983. data/vendor/ggml/src/ggml-sycl/opt-step.hpp +6 -0
  984. data/vendor/ggml/src/ggml-sycl/outprod.cpp +83 -0
  985. data/vendor/ggml/src/ggml-sycl/outprod.hpp +10 -0
  986. data/vendor/ggml/src/ggml-sycl/pad.cpp +97 -0
  987. data/vendor/ggml/src/ggml-sycl/pad.hpp +24 -0
  988. data/vendor/ggml/src/ggml-sycl/pad_reflect_1d.cpp +100 -0
  989. data/vendor/ggml/src/ggml-sycl/pad_reflect_1d.hpp +10 -0
  990. data/vendor/ggml/src/ggml-sycl/pool.cpp +185 -0
  991. data/vendor/ggml/src/ggml-sycl/pool.hpp +22 -0
  992. data/vendor/ggml/src/ggml-sycl/presets.hpp +79 -0
  993. data/vendor/ggml/src/ggml-sycl/quantize.hpp +133 -0
  994. data/vendor/ggml/src/ggml-sycl/quants.hpp +204 -0
  995. data/vendor/ggml/src/ggml-sycl/repeat_back.cpp +76 -0
  996. data/vendor/ggml/src/ggml-sycl/repeat_back.hpp +8 -0
  997. data/vendor/ggml/src/ggml-sycl/roll.cpp +122 -0
  998. data/vendor/ggml/src/ggml-sycl/roll.hpp +20 -0
  999. data/vendor/ggml/src/ggml-sycl/rope.cpp +651 -0
  1000. data/vendor/ggml/src/ggml-sycl/rope.hpp +26 -0
  1001. data/vendor/ggml/src/ggml-sycl/set.cpp +73 -0
  1002. data/vendor/ggml/src/ggml-sycl/set.hpp +5 -0
  1003. data/vendor/ggml/src/ggml-sycl/set_rows.cpp +577 -0
  1004. data/vendor/ggml/src/ggml-sycl/set_rows.hpp +8 -0
  1005. data/vendor/ggml/src/ggml-sycl/softmax.cpp +425 -0
  1006. data/vendor/ggml/src/ggml-sycl/softmax.hpp +24 -0
  1007. data/vendor/ggml/src/ggml-sycl/solve_tri.cpp +172 -0
  1008. data/vendor/ggml/src/ggml-sycl/solve_tri.hpp +8 -0
  1009. data/vendor/ggml/src/ggml-sycl/ssm_conv.cpp +136 -0
  1010. data/vendor/ggml/src/ggml-sycl/ssm_conv.hpp +5 -0
  1011. data/vendor/ggml/src/ggml-sycl/ssm_scan.cpp +170 -0
  1012. data/vendor/ggml/src/ggml-sycl/ssm_scan.hpp +5 -0
  1013. data/vendor/ggml/src/ggml-sycl/sycl_hw.cpp +67 -0
  1014. data/vendor/ggml/src/ggml-sycl/sycl_hw.hpp +38 -0
  1015. data/vendor/ggml/src/ggml-sycl/template-instances/fattn-tile-instance-dkq112-dv112.cpp +5 -0
  1016. data/vendor/ggml/src/ggml-sycl/template-instances/fattn-tile-instance-dkq128-dv128.cpp +5 -0
  1017. data/vendor/ggml/src/ggml-sycl/template-instances/fattn-tile-instance-dkq256-dv256.cpp +5 -0
  1018. data/vendor/ggml/src/ggml-sycl/template-instances/fattn-tile-instance-dkq40-dv40.cpp +5 -0
  1019. data/vendor/ggml/src/ggml-sycl/template-instances/fattn-tile-instance-dkq512-dv512.cpp +6 -0
  1020. data/vendor/ggml/src/ggml-sycl/template-instances/fattn-tile-instance-dkq576-dv512.cpp +5 -0
  1021. data/vendor/ggml/src/ggml-sycl/template-instances/fattn-tile-instance-dkq64-dv64.cpp +5 -0
  1022. data/vendor/ggml/src/ggml-sycl/template-instances/fattn-tile-instance-dkq72-dv72.cpp +5 -0
  1023. data/vendor/ggml/src/ggml-sycl/template-instances/fattn-tile-instance-dkq80-dv80.cpp +5 -0
  1024. data/vendor/ggml/src/ggml-sycl/template-instances/fattn-tile-instance-dkq96-dv96.cpp +5 -0
  1025. data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-f16-f16.cpp +8 -0
  1026. data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-f16-q4_0.cpp +8 -0
  1027. data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-f16-q4_1.cpp +8 -0
  1028. data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-f16-q5_0.cpp +8 -0
  1029. data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-f16-q5_1.cpp +8 -0
  1030. data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-f16-q8_0.cpp +8 -0
  1031. data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-q4_0-f16.cpp +8 -0
  1032. data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-q4_0-q4_0.cpp +8 -0
  1033. data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-q4_0-q4_1.cpp +8 -0
  1034. data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-q4_0-q5_0.cpp +8 -0
  1035. data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-q4_0-q5_1.cpp +8 -0
  1036. data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-q4_0-q8_0.cpp +8 -0
  1037. data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-q4_1-f16.cpp +8 -0
  1038. data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-q4_1-q4_0.cpp +8 -0
  1039. data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-q4_1-q4_1.cpp +8 -0
  1040. data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-q4_1-q5_0.cpp +8 -0
  1041. data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-q4_1-q5_1.cpp +8 -0
  1042. data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-q4_1-q8_0.cpp +8 -0
  1043. data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-q5_0-f16.cpp +8 -0
  1044. data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-q5_0-q4_0.cpp +8 -0
  1045. data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-q5_0-q4_1.cpp +8 -0
  1046. data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-q5_0-q5_0.cpp +8 -0
  1047. data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-q5_0-q5_1.cpp +8 -0
  1048. data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-q5_0-q8_0.cpp +8 -0
  1049. data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-q5_1-f16.cpp +8 -0
  1050. data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-q5_1-q4_0.cpp +8 -0
  1051. data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-q5_1-q4_1.cpp +8 -0
  1052. data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-q5_1-q5_0.cpp +8 -0
  1053. data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-q5_1-q5_1.cpp +8 -0
  1054. data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-q5_1-q8_0.cpp +8 -0
  1055. data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-q8_0-f16.cpp +8 -0
  1056. data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-q8_0-q4_0.cpp +8 -0
  1057. data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-q8_0-q4_1.cpp +8 -0
  1058. data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-q8_0-q5_0.cpp +8 -0
  1059. data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-q8_0-q5_1.cpp +8 -0
  1060. data/vendor/ggml/src/ggml-sycl/template-instances/fattn-vec-instance-q8_0-q8_0.cpp +8 -0
  1061. data/vendor/ggml/src/ggml-sycl/topk-moe.cpp +620 -0
  1062. data/vendor/ggml/src/ggml-sycl/topk-moe.hpp +12 -0
  1063. data/vendor/ggml/src/ggml-sycl/tsembd.cpp +73 -0
  1064. data/vendor/ggml/src/ggml-sycl/tsembd.hpp +20 -0
  1065. data/vendor/ggml/src/ggml-sycl/type.hpp +112 -0
  1066. data/vendor/ggml/src/ggml-sycl/upscale.cpp +410 -0
  1067. data/vendor/ggml/src/ggml-sycl/upscale.hpp +9 -0
  1068. data/vendor/ggml/src/ggml-sycl/vecdotq.hpp +1726 -0
  1069. data/vendor/ggml/src/ggml-sycl/wkv.cpp +293 -0
  1070. data/vendor/ggml/src/ggml-sycl/wkv.hpp +10 -0
  1071. data/vendor/ggml/src/ggml-threading.cpp +12 -0
  1072. data/vendor/ggml/src/ggml-threading.h +14 -0
  1073. data/vendor/ggml/src/ggml-version.h.in +4 -0
  1074. data/vendor/ggml/src/ggml-virtgpu/CMakeLists.txt +70 -0
  1075. data/vendor/ggml/src/ggml-virtgpu/apir_cs_ggml-rpc-front.cpp +87 -0
  1076. data/vendor/ggml/src/ggml-virtgpu/backend/CMakeLists.txt +21 -0
  1077. data/vendor/ggml/src/ggml-virtgpu/backend/apir_cs_ggml-rpc-back.cpp +115 -0
  1078. data/vendor/ggml/src/ggml-virtgpu/backend/backend-convert.h +13 -0
  1079. data/vendor/ggml/src/ggml-virtgpu/backend/backend-dispatched-backend.cpp +102 -0
  1080. data/vendor/ggml/src/ggml-virtgpu/backend/backend-dispatched-buffer-type.cpp +105 -0
  1081. data/vendor/ggml/src/ggml-virtgpu/backend/backend-dispatched-buffer.cpp +179 -0
  1082. data/vendor/ggml/src/ggml-virtgpu/backend/backend-dispatched-device.cpp +149 -0
  1083. data/vendor/ggml/src/ggml-virtgpu/backend/backend-dispatched.cpp +51 -0
  1084. data/vendor/ggml/src/ggml-virtgpu/backend/backend-dispatched.gen.h +73 -0
  1085. data/vendor/ggml/src/ggml-virtgpu/backend/backend-dispatched.h +27 -0
  1086. data/vendor/ggml/src/ggml-virtgpu/backend/backend-virgl-apir.h +32 -0
  1087. data/vendor/ggml/src/ggml-virtgpu/backend/backend.cpp +144 -0
  1088. data/vendor/ggml/src/ggml-virtgpu/backend/shared/api_remoting.h +95 -0
  1089. data/vendor/ggml/src/ggml-virtgpu/backend/shared/apir_backend.gen.h +94 -0
  1090. data/vendor/ggml/src/ggml-virtgpu/backend/shared/apir_backend.h +50 -0
  1091. data/vendor/ggml/src/ggml-virtgpu/backend/shared/apir_cs.h +378 -0
  1092. data/vendor/ggml/src/ggml-virtgpu/backend/shared/apir_cs_ggml.h +232 -0
  1093. data/vendor/ggml/src/ggml-virtgpu/backend/shared/apir_cs_rpc.h +58 -0
  1094. data/vendor/ggml/src/ggml-virtgpu/ggml-backend-buffer-type.cpp +81 -0
  1095. data/vendor/ggml/src/ggml-virtgpu/ggml-backend-buffer.cpp +123 -0
  1096. data/vendor/ggml/src/ggml-virtgpu/ggml-backend-device.cpp +160 -0
  1097. data/vendor/ggml/src/ggml-virtgpu/ggml-backend-reg.cpp +213 -0
  1098. data/vendor/ggml/src/ggml-virtgpu/ggml-backend.cpp +72 -0
  1099. data/vendor/ggml/src/ggml-virtgpu/ggml-remoting.h +71 -0
  1100. data/vendor/ggml/src/ggml-virtgpu/ggmlremoting_functions.yaml +166 -0
  1101. data/vendor/ggml/src/ggml-virtgpu/include/apir_hw.h +9 -0
  1102. data/vendor/ggml/src/ggml-virtgpu/regenerate_remoting.py +333 -0
  1103. data/vendor/ggml/src/ggml-virtgpu/virtgpu-apir.h +15 -0
  1104. data/vendor/ggml/src/ggml-virtgpu/virtgpu-forward-backend.cpp +58 -0
  1105. data/vendor/ggml/src/ggml-virtgpu/virtgpu-forward-buffer-type.cpp +110 -0
  1106. data/vendor/ggml/src/ggml-virtgpu/virtgpu-forward-buffer.cpp +173 -0
  1107. data/vendor/ggml/src/ggml-virtgpu/virtgpu-forward-device.cpp +194 -0
  1108. data/vendor/ggml/src/ggml-virtgpu/virtgpu-forward-impl.h +36 -0
  1109. data/vendor/ggml/src/ggml-virtgpu/virtgpu-forward.gen.h +54 -0
  1110. data/vendor/ggml/src/ggml-virtgpu/virtgpu-shm.cpp +99 -0
  1111. data/vendor/ggml/src/ggml-virtgpu/virtgpu-shm.h +23 -0
  1112. data/vendor/ggml/src/ggml-virtgpu/virtgpu-utils.cpp +179 -0
  1113. data/vendor/ggml/src/ggml-virtgpu/virtgpu-utils.h +86 -0
  1114. data/vendor/ggml/src/ggml-virtgpu/virtgpu.cpp +545 -0
  1115. data/vendor/ggml/src/ggml-virtgpu/virtgpu.h +115 -0
  1116. data/vendor/ggml/src/ggml-vulkan/CMakeLists.txt +254 -0
  1117. data/vendor/ggml/src/ggml-vulkan/cmake/host-toolchain.cmake.in +15 -0
  1118. data/vendor/ggml/src/ggml-vulkan/ggml-vulkan.cpp +20349 -0
  1119. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/CMakeLists.txt +43 -0
  1120. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/acc.comp +37 -0
  1121. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/add.comp +69 -0
  1122. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/add1.comp +28 -0
  1123. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/add_id.comp +42 -0
  1124. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/arange.comp +20 -0
  1125. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/argmax.comp +60 -0
  1126. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/argsort.comp +86 -0
  1127. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/argsort_large.comp +114 -0
  1128. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/col2im_1d.comp +61 -0
  1129. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/concat.comp +41 -0
  1130. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/contig_copy.comp +53 -0
  1131. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/conv2d_dw.comp +105 -0
  1132. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/conv2d_mm.comp +473 -0
  1133. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/conv3d_mm.comp +424 -0
  1134. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/conv_transpose_1d.comp +98 -0
  1135. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/copy.comp +25 -0
  1136. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/copy_from_quant.comp +51 -0
  1137. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/copy_to_quant.comp +350 -0
  1138. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/copy_transpose.comp +67 -0
  1139. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/copy_transpose_02.comp +61 -0
  1140. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/count_equal.comp +31 -0
  1141. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/count_experts.comp +135 -0
  1142. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/cross_entropy_loss.comp +78 -0
  1143. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/cross_entropy_loss_back.comp +75 -0
  1144. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/cumsum.comp +83 -0
  1145. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/cumsum_multipass1.comp +60 -0
  1146. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/cumsum_multipass2.comp +66 -0
  1147. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/dequant_f32.comp +20 -0
  1148. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/dequant_funcs.glsl +741 -0
  1149. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/dequant_funcs_cm2.glsl +1466 -0
  1150. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/dequant_head.glsl +13 -0
  1151. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/dequant_iq1_m.comp +42 -0
  1152. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/dequant_iq1_s.comp +35 -0
  1153. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/dequant_iq2_s.comp +44 -0
  1154. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/dequant_iq2_xs.comp +43 -0
  1155. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/dequant_iq2_xxs.comp +49 -0
  1156. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/dequant_iq3_s.comp +40 -0
  1157. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/dequant_iq3_xxs.comp +51 -0
  1158. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/dequant_iq4_nl.comp +32 -0
  1159. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/dequant_iq4_xs.comp +34 -0
  1160. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/dequant_mxfp4.comp +32 -0
  1161. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/dequant_nvfp4.comp +32 -0
  1162. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/dequant_q1_0.comp +29 -0
  1163. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/dequant_q2_0.comp +29 -0
  1164. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/dequant_q2_k.comp +34 -0
  1165. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/dequant_q3_k.comp +42 -0
  1166. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/dequant_q4_0.comp +30 -0
  1167. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/dequant_q4_1.comp +32 -0
  1168. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/dequant_q4_k.comp +68 -0
  1169. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/dequant_q5_0.comp +34 -0
  1170. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/dequant_q5_1.comp +35 -0
  1171. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/dequant_q5_k.comp +70 -0
  1172. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/dequant_q6_k.comp +33 -0
  1173. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/dequant_q8_0.comp +42 -0
  1174. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/dequant_tq2_0.comp +31 -0
  1175. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/diag.comp +28 -0
  1176. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/diag_mask_inf.comp +34 -0
  1177. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/div.comp +27 -0
  1178. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/dot_product_funcs.glsl +27 -0
  1179. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/fa_types.glsl +55 -0
  1180. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/feature-tests/bfloat16.comp +7 -0
  1181. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/feature-tests/coopmat.comp +7 -0
  1182. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/feature-tests/coopmat2.comp +7 -0
  1183. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/feature-tests/coopmat2_decode_vector.comp +7 -0
  1184. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/feature-tests/float_e2m1.comp +7 -0
  1185. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/feature-tests/float_e4m3.comp +7 -0
  1186. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/feature-tests/integer_dot.comp +7 -0
  1187. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/fill.comp +19 -0
  1188. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/flash_attn.comp +760 -0
  1189. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/flash_attn_base.glsl +223 -0
  1190. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/flash_attn_cm1.comp +647 -0
  1191. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/flash_attn_cm2.comp +487 -0
  1192. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/flash_attn_dequant.glsl +146 -0
  1193. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/flash_attn_mask_opt.comp +162 -0
  1194. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/flash_attn_mmq_funcs.glsl +203 -0
  1195. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/flash_attn_split_k_reduce.comp +121 -0
  1196. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/fwht.comp +115 -0
  1197. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/gated_delta_net.comp +189 -0
  1198. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/geglu.comp +13 -0
  1199. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/geglu_erf.comp +27 -0
  1200. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/geglu_quick.comp +11 -0
  1201. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/generic_binary_head.glsl +65 -0
  1202. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/generic_head.glsl +11 -0
  1203. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/generic_unary_head.glsl +75 -0
  1204. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/get_rows.comp +42 -0
  1205. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/get_rows_back.comp +25 -0
  1206. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/get_rows_quant.comp +51 -0
  1207. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/gla.comp +82 -0
  1208. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/glu_head.glsl +43 -0
  1209. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/glu_main.glsl +35 -0
  1210. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/group_norm.comp +66 -0
  1211. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/im2col.comp +138 -0
  1212. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/im2col_3d.comp +124 -0
  1213. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/l2_norm.comp +41 -0
  1214. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/lightning_indexer.comp +151 -0
  1215. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/log.comp +17 -0
  1216. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/mul.comp +27 -0
  1217. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/mul_mat_split_k_reduce.comp +48 -0
  1218. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/mul_mat_vec.comp +264 -0
  1219. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/mul_mat_vec_base.glsl +230 -0
  1220. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/mul_mat_vec_iface.glsl +35 -0
  1221. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/mul_mat_vec_iq1_m.comp +132 -0
  1222. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/mul_mat_vec_iq1_s.comp +95 -0
  1223. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/mul_mat_vec_iq2_s.comp +90 -0
  1224. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/mul_mat_vec_iq2_xs.comp +105 -0
  1225. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/mul_mat_vec_iq2_xxs.comp +87 -0
  1226. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/mul_mat_vec_iq3_s.comp +93 -0
  1227. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/mul_mat_vec_iq3_xxs.comp +88 -0
  1228. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/mul_mat_vec_nc.comp +124 -0
  1229. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/mul_mat_vec_p021.comp +156 -0
  1230. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/mul_mat_vec_q2_k.comp +128 -0
  1231. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/mul_mat_vec_q3_k.comp +132 -0
  1232. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/mul_mat_vec_q4_k.comp +134 -0
  1233. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/mul_mat_vec_q5_k.comp +165 -0
  1234. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/mul_mat_vec_q6_k.comp +130 -0
  1235. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/mul_mat_vec_tq2_0.comp +102 -0
  1236. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/mul_mat_vecq.comp +141 -0
  1237. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/mul_mat_vecq_funcs.glsl +564 -0
  1238. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm.comp +475 -0
  1239. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm_cm2.comp +690 -0
  1240. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm_funcs.glsl +670 -0
  1241. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm_id_funcs.glsl +89 -0
  1242. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/mul_mmq.comp +317 -0
  1243. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/mul_mmq_funcs.glsl +488 -0
  1244. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/mul_mmq_shmem_types.glsl +99 -0
  1245. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/multi_add.comp +194 -0
  1246. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/norm.comp +44 -0
  1247. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/opt_step_adamw.comp +42 -0
  1248. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/opt_step_sgd.comp +22 -0
  1249. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/out_prod.comp +59 -0
  1250. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/pad.comp +64 -0
  1251. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/pad_reflect_1d.comp +43 -0
  1252. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/pool1d.comp +65 -0
  1253. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/pool2d.comp +74 -0
  1254. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/quantize_q8_1.comp +127 -0
  1255. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/reglu.comp +9 -0
  1256. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/repeat.comp +26 -0
  1257. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/repeat_back.comp +37 -0
  1258. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/rms_norm.comp +150 -0
  1259. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/rms_norm_back.comp +55 -0
  1260. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/rms_norm_partials.comp +65 -0
  1261. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/roll.comp +46 -0
  1262. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/rope_funcs.glsl +218 -0
  1263. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/rope_head.glsl +19 -0
  1264. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/rope_multi.comp +17 -0
  1265. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/rope_neox.comp +17 -0
  1266. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/rope_norm.comp +17 -0
  1267. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/rope_params.glsl +35 -0
  1268. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/rope_vision.comp +17 -0
  1269. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/scale.comp +24 -0
  1270. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/silu_back.comp +26 -0
  1271. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/snake.comp +49 -0
  1272. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/soft_max.comp +195 -0
  1273. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/soft_max_back.comp +54 -0
  1274. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/soft_max_large1.comp +62 -0
  1275. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/soft_max_large2.comp +79 -0
  1276. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/soft_max_large3.comp +65 -0
  1277. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/soft_max_large_common.glsl +53 -0
  1278. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/solve_tri.comp +81 -0
  1279. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/ssm_conv.comp +60 -0
  1280. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/ssm_scan.comp +134 -0
  1281. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/sub.comp +29 -0
  1282. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/sum_rows.comp +47 -0
  1283. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/sum_rows.glsl +19 -0
  1284. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/swiglu.comp +9 -0
  1285. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/swiglu_clamp.comp +12 -0
  1286. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/swiglu_oai.comp +14 -0
  1287. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/timestep_embedding.comp +42 -0
  1288. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/topk_argsort.comp +118 -0
  1289. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/topk_moe.comp +221 -0
  1290. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/topk_nary_search.comp +246 -0
  1291. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/topk_radix_select.comp +144 -0
  1292. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/tri.comp +42 -0
  1293. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/types.glsl +1938 -0
  1294. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/unary.comp +168 -0
  1295. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/upscale.comp +178 -0
  1296. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/utils.glsl +37 -0
  1297. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/vulkan-shaders-gen.cpp +1367 -0
  1298. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/wkv6.comp +87 -0
  1299. data/vendor/ggml/src/ggml-vulkan/vulkan-shaders/wkv7.comp +91 -0
  1300. data/vendor/ggml/src/ggml-webgpu/CMakeLists.txt +83 -0
  1301. data/vendor/ggml/src/ggml-webgpu/ggml-webgpu-shader-lib.hpp +3457 -0
  1302. data/vendor/ggml/src/ggml-webgpu/ggml-webgpu.cpp +4790 -0
  1303. data/vendor/ggml/src/ggml-webgpu/pre_wgsl.hpp +808 -0
  1304. data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/add_id.wgsl +64 -0
  1305. data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/argmax.wgsl +72 -0
  1306. data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/argsort.wgsl +102 -0
  1307. data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/argsort_merge.wgsl +134 -0
  1308. data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/binary.wgsl +142 -0
  1309. data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/common_decls.tmpl +967 -0
  1310. data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/concat.wgsl +92 -0
  1311. data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/conv2d.wgsl +127 -0
  1312. data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/conv2d_dw.wgsl +100 -0
  1313. data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/cpy.wgsl +84 -0
  1314. data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/cumsum.wgsl +66 -0
  1315. data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/embed_wgsl.py +89 -0
  1316. data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/flash_attn.wgsl +408 -0
  1317. data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/flash_attn_decls.tmpl +134 -0
  1318. data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/flash_attn_staging.tmpl +136 -0
  1319. data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/flash_attn_tile.wgsl +240 -0
  1320. data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/flash_attn_vec_blk.wgsl +101 -0
  1321. data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/flash_attn_vec_reduce.wgsl +84 -0
  1322. data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/flash_attn_vec_split.wgsl +503 -0
  1323. data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/gated_delta_net.wgsl +149 -0
  1324. data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/get_rows.wgsl +794 -0
  1325. data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/glu.wgsl +178 -0
  1326. data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/im2col.wgsl +77 -0
  1327. data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/memset.wgsl +40 -0
  1328. data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/mul_mat_decls.tmpl +1052 -0
  1329. data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/mul_mat_id.wgsl +195 -0
  1330. data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/mul_mat_id_gather.wgsl +52 -0
  1331. data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/mul_mat_id_vec.wgsl +154 -0
  1332. data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/mul_mat_reg_tile.wgsl +159 -0
  1333. data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/mul_mat_subgroup_matrix.wgsl +210 -0
  1334. data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/mul_mat_vec.wgsl +167 -0
  1335. data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/mul_mat_vec_acc.tmpl +1560 -0
  1336. data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/mul_mat_vec_q_acc.tmpl +297 -0
  1337. data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/pad.wgsl +86 -0
  1338. data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/quant_inner_loops.tmpl +21 -0
  1339. data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/quantize_q8.wgsl +178 -0
  1340. data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/repeat.wgsl +70 -0
  1341. data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/rms_norm_mul.wgsl +151 -0
  1342. data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/rope.wgsl +228 -0
  1343. data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/row_norm.wgsl +152 -0
  1344. data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/scale.wgsl +65 -0
  1345. data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/set.wgsl +109 -0
  1346. data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/set_rows.wgsl +108 -0
  1347. data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/set_rows_quant.wgsl +224 -0
  1348. data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/soft_max.wgsl +210 -0
  1349. data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/solve_tri.wgsl +120 -0
  1350. data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/ssm_conv.wgsl +65 -0
  1351. data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/ssm_scan.wgsl +247 -0
  1352. data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/sum_rows.wgsl +55 -0
  1353. data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/unary.wgsl +213 -0
  1354. data/vendor/ggml/src/ggml-webgpu/wgsl-shaders/upscale.wgsl +240 -0
  1355. data/vendor/ggml/src/ggml-zdnn/CMakeLists.txt +36 -0
  1356. data/vendor/ggml/src/ggml-zdnn/common.hpp +59 -0
  1357. data/vendor/ggml/src/ggml-zdnn/ggml-zdnn.cpp +638 -0
  1358. data/vendor/ggml/src/ggml-zdnn/mmf.cpp +80 -0
  1359. data/vendor/ggml/src/ggml-zdnn/mmf.hpp +12 -0
  1360. data/vendor/ggml/src/ggml-zdnn/utils.cpp +79 -0
  1361. data/vendor/ggml/src/ggml-zdnn/utils.hpp +19 -0
  1362. data/vendor/ggml/src/ggml-zendnn/CMakeLists.txt +91 -0
  1363. data/vendor/ggml/src/ggml-zendnn/ggml-zendnn.cpp +838 -0
  1364. data/vendor/ggml/src/ggml.c +8088 -0
  1365. data/vendor/ggml/src/ggml.cpp +26 -0
  1366. data/vendor/ggml/src/gguf.cpp +1706 -0
  1367. metadata +1459 -0
@@ -0,0 +1,1681 @@
1
+ //
2
+ // MIT license
3
+ // Copyright (C) 2024 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_DEQUANTIZE_HPP
14
+ #define GGML_SYCL_DEQUANTIZE_HPP
15
+
16
+ #include "common.hpp"
17
+ #include "convert.hpp"
18
+
19
+ typedef void (*dequantize_kernel_t)(const void * vx, const int64_t ib, const int iqs, dfloat2 & v);
20
+ typedef void (*dequantize_kernel_t_reorder)(const void *d, const int64_t ib, const void *qs,
21
+ const int iqs, dfloat2 &v);
22
+ typedef void (*dequantize_kernel_f32_t)(const void * vx, const int64_t ib, const int iqs, float & v0, float & v1);
23
+
24
+ #if QK_K == 256
25
+ static inline void get_scale_min_k4(int j, const uint8_t * q, uint8_t & d, uint8_t & m);
26
+ #endif
27
+
28
+ static __dpct_inline__ void dequantize_q2_0(const void *vx, const int64_t ib,
29
+ const int iqs, dfloat2 &v) {
30
+ const block_q2_0 * x = (const block_q2_0 *) vx;
31
+
32
+ const dfloat d = x[ib].d;
33
+
34
+ const int byte_idx = iqs / 4;
35
+ const int shift = (iqs % 4) * 2;
36
+ const uint8_t vui = x[ib].qs[byte_idx];
37
+
38
+ v.x() = (vui >> shift) & 3;
39
+ v.y() = (vui >> (shift + 2)) & 3;
40
+
41
+ #ifdef GGML_SYCL_F16
42
+ v.s0() = ((dfloat)v.s0() - 1.0f) * d;
43
+ v.s1() = ((dfloat)v.s1() - 1.0f) * d;
44
+ #else
45
+ v.x() = ((dfloat)v.x() - 1.0f) * d;
46
+ v.y() = ((dfloat)v.y() - 1.0f) * d;
47
+ #endif // GGML_SYCL_F16
48
+ }
49
+
50
+ static __dpct_inline__ void dequantize_q4_0(const void *vx, const int64_t ib,
51
+ const int iqs, dfloat2 &v) {
52
+ const block_q4_0 * x = (const block_q4_0 *) vx;
53
+
54
+ const dfloat d = x[ib].d;
55
+
56
+ const int vui = x[ib].qs[iqs];
57
+
58
+ v.x() = vui & 0xF;
59
+ v.y() = vui >> 4;
60
+
61
+ #ifdef GGML_SYCL_F16
62
+ // v = v - {8.0f, 8.0f};
63
+ // v = v * {d, d};
64
+ v.s0() = (v.s0() - 8.0f) * d;
65
+ v.s1() = (v.s1() - 8.0f) * d;
66
+
67
+ #else
68
+ v.x() = (v.x() - 8.0f) * d;
69
+ v.y() = (v.y() - 8.0f) * d;
70
+ #endif // GGML_SYCL_F16
71
+ }
72
+
73
+ static __dpct_inline__ void dequantize_q4_0_reorder(const void *d_ptr, const int64_t ib, const void *qs,
74
+ const int iqs, dfloat2 &v) {
75
+ // const block_q4_0 * x = (const block_q4_0 *) vx;
76
+
77
+ const dfloat d = (const dfloat)*((const sycl::half*)d_ptr+ib);
78
+
79
+ const int vui = *((const uint8_t *)qs+iqs);
80
+
81
+ v.x() = vui & 0xF;
82
+ v.y() = vui >> 4;
83
+
84
+ #ifdef GGML_SYCL_F16
85
+ // v = v - {8.0f, 8.0f};
86
+ // v = v * {d, d};
87
+ v.s0() = (v.s0() - 8.0f) * d;
88
+ v.s1() = (v.s1() - 8.0f) * d;
89
+
90
+ #else
91
+ v.x() = (v.x() - 8.0f) * d;
92
+ v.y() = (v.y() - 8.0f) * d;
93
+ #endif // GGML_SYCL_F16
94
+ }
95
+
96
+ static __dpct_inline__ void dequantize_q1_0_reorder(const void *d_ptr, const int64_t ib, const void *qs,
97
+ const int iqs, dfloat2 &v) {
98
+ // Q1_0 reorder layout: scale values followed by quantized bits
99
+ const dfloat d = (const dfloat)*((const sycl::half*)d_ptr+ib);
100
+
101
+ const int bit_index_0 = iqs + 0;
102
+ const int bit_index_1 = iqs + 1;
103
+
104
+ const int bit_0 = (*((const uint8_t *)qs + bit_index_0 / 8) >> (bit_index_0 % 8)) & 1;
105
+ const int bit_1 = (*((const uint8_t *)qs + bit_index_1 / 8) >> (bit_index_1 % 8)) & 1;
106
+
107
+ v.x() = (2 * bit_0 - 1) * d;
108
+ v.y() = (2 * bit_1 - 1) * d;
109
+ }
110
+
111
+ static __dpct_inline__ void dequantize_q1_0(const void *vx, const int64_t ib,
112
+ const int iqs, dfloat2 &v) {
113
+ const block_q1_0 * x = (const block_q1_0 *) vx;
114
+ const dfloat d = x[ib].d;
115
+
116
+ const int bit_index_0 = iqs + 0;
117
+ const int bit_index_1 = iqs + 1;
118
+
119
+ const int bit_0 = (x[ib].qs[bit_index_0 / 8] >> (bit_index_0 % 8)) & 1;
120
+ const int bit_1 = (x[ib].qs[bit_index_1 / 8] >> (bit_index_1 % 8)) & 1;
121
+
122
+ v.x() = (2 * bit_0 - 1) * d;
123
+ v.y() = (2 * bit_1 - 1) * d;
124
+ }
125
+
126
+ static __dpct_inline__ void dequantize_q4_1(const void *vx, const int64_t ib,
127
+ const int iqs, dfloat2 &v) {
128
+ const block_q4_1 * x = (const block_q4_1 *) vx;
129
+
130
+ const dfloat d = x[ib].dm[0];
131
+ const dfloat m = x[ib].dm[1];
132
+
133
+ const int vui = x[ib].qs[iqs];
134
+
135
+ v.x() = vui & 0xF;
136
+ v.y() = vui >> 4;
137
+
138
+ #ifdef GGML_SYCL_F16
139
+ // v = v * {d, d};
140
+ // v = v + {m, m};
141
+ v.s0() = sycl::fma(v.s0(), d, m);
142
+ v.s1() = sycl::fma(v.s1(), d, m);
143
+
144
+ #else
145
+ v.x() = sycl::fma(v.x(), d, m);
146
+ v.y() = sycl::fma(v.y(), d, m);
147
+ #endif // GGML_SYCL_F16
148
+ }
149
+
150
+ static __dpct_inline__ void dequantize_q4_K(const void *vx, const int64_t ib,
151
+ const int iqs, dfloat2 &v) {
152
+ #if QK_K == 256
153
+ const block_q4_K * x = (const block_q4_K *) vx;
154
+ const sycl::half2 dm = x[ib].dm;
155
+ const float dall = dm[0];
156
+ const float dmin = dm[1];
157
+
158
+ auto dequantize_one = [&](const int idx) -> dfloat {
159
+ const int il = idx / 64;
160
+ const int in = idx % 64;
161
+ const int is = 2 * il + (in >= 32 ? 1 : 0);
162
+ const int off = in & 31;
163
+ const int qsi = 32 * il + off;
164
+
165
+ uint8_t sc;
166
+ uint8_t m;
167
+ get_scale_min_k4(is, x[ib].scales, sc, m);
168
+
169
+ const uint8_t q = x[ib].qs[qsi];
170
+ const uint8_t qv = (in >= 32) ? (q >> 4) : (q & 0xF);
171
+ return sycl::fma((dfloat) qv, (dfloat) (dall * sc), (dfloat) (-dmin * m));
172
+ };
173
+
174
+ v.x() = dequantize_one(iqs + 0);
175
+ v.y() = dequantize_one(iqs + 1);
176
+ #else
177
+ GGML_ABORT("Q4_K dequantize not supported for QK_K != 256");
178
+ #endif
179
+ }
180
+
181
+ static __dpct_inline__ void dequantize_q4_K_f32(const void *vx, const int64_t ib,
182
+ const int iqs, float &v0, float &v1) {
183
+ #if QK_K == 256
184
+ const block_q4_K * x = (const block_q4_K *) vx;
185
+ const sycl::half2 dm = x[ib].dm;
186
+ const float dall = dm[0];
187
+ const float dmin = dm[1];
188
+
189
+ auto dequantize_one = [&](const int idx) -> float {
190
+ const int il = idx / 64;
191
+ const int in = idx % 64;
192
+ const int is = 2 * il + (in >= 32 ? 1 : 0);
193
+ const int qsi = 32 * il + (in & 31);
194
+
195
+ uint8_t sc;
196
+ uint8_t m;
197
+ get_scale_min_k4(is, x[ib].scales, sc, m);
198
+
199
+ const float d = dall * sc;
200
+ const float mn = dmin * m;
201
+ const uint8_t q = x[ib].qs[qsi];
202
+ const uint8_t qv = (in >= 32) ? (q >> 4) : (q & 0xF);
203
+
204
+ return d * qv - mn;
205
+ };
206
+
207
+ v0 = dequantize_one(iqs + 0);
208
+ v1 = dequantize_one(iqs + 1);
209
+ #else
210
+ GGML_ABORT("Q4_K dequantize not supported for QK_K != 256");
211
+ #endif
212
+ }
213
+
214
+ static __dpct_inline__ void dequantize_q2_K(const void *vx, const int64_t ib,
215
+ const int iqs, dfloat2 &v) {
216
+ #if QK_K == 256
217
+ const block_q2_K * x = (const block_q2_K *) vx;
218
+ const float dall = x[ib].dm[0];
219
+ const float dmin = x[ib].dm[1];
220
+
221
+ auto dequantize_one = [&](const int idx) -> dfloat {
222
+ const int n = idx / 128;
223
+ const int r = idx % 128;
224
+ const int g = r / 32;
225
+ const int l = r % 32;
226
+ const int is = 8 * n + l / 16;
227
+
228
+ const uint8_t q = x[ib].qs[32 * n + l];
229
+ const uint8_t sc = x[ib].scales[is + 2 * g];
230
+ const float d = dall * (sc & 0xF);
231
+ const float m = dmin * (sc >> 4);
232
+
233
+ return (dfloat) d * (dfloat) ((q >> (2 * g)) & 3) - (dfloat) m;
234
+ };
235
+
236
+ v.x() = dequantize_one(iqs + 0);
237
+ v.y() = dequantize_one(iqs + 1);
238
+ #else
239
+ GGML_ABORT("Q2_K dequantize not supported for QK_K != 256");
240
+ #endif
241
+ }
242
+
243
+ static __dpct_inline__ void dequantize_q2_K_f32(const void *vx, const int64_t ib,
244
+ const int iqs, float &v0, float &v1) {
245
+ #if QK_K == 256
246
+ const block_q2_K * x = (const block_q2_K *) vx;
247
+ const float dall = x[ib].dm[0];
248
+ const float dmin = x[ib].dm[1];
249
+
250
+ auto dequantize_one = [&](const int idx) -> float {
251
+ const int n = idx / 128;
252
+ const int r = idx % 128;
253
+ const int g = r / 32;
254
+ const int l = r % 32;
255
+ const int is = 8 * n + l / 16;
256
+
257
+ const uint8_t q = x[ib].qs[32 * n + l];
258
+ const uint8_t sc = x[ib].scales[is + 2 * g];
259
+ const float d = dall * (sc & 0xF);
260
+ const float m = dmin * (sc >> 4);
261
+
262
+ return d * ((q >> (2 * g)) & 3) - m;
263
+ };
264
+
265
+ v0 = dequantize_one(iqs + 0);
266
+ v1 = dequantize_one(iqs + 1);
267
+ #else
268
+ GGML_ABORT("Q2_K dequantize not supported for QK_K != 256");
269
+ #endif
270
+ }
271
+
272
+ static __dpct_inline__ void dequantize_q3_K(const void *vx, const int64_t ib,
273
+ const int iqs, dfloat2 &v) {
274
+ #if QK_K == 256
275
+ const block_q3_K * x = (const block_q3_K *) vx;
276
+ const float d_all = x[ib].d;
277
+
278
+ auto dequantize_one = [&](const int idx) -> dfloat {
279
+ const int n = idx / 128;
280
+ const int r = idx % 128;
281
+ const int j = r / 32;
282
+ const int l = r % 32;
283
+
284
+ const int is0 = l / 16;
285
+ const int is = 8 * n + 2 * j + is0;
286
+ const int shift = 2 * j;
287
+ const uint8_t m = 1 << (4 * n + j);
288
+
289
+ const int8_t us = is < 4 ? (x[ib].scales[is - 0] & 0xF) | (((x[ib].scales[is + 8] >> 0) & 3) << 4) :
290
+ is < 8 ? (x[ib].scales[is - 0] & 0xF) | (((x[ib].scales[is + 4] >> 2) & 3) << 4) :
291
+ is < 12 ? (x[ib].scales[is - 8] >> 4) | (((x[ib].scales[is + 0] >> 4) & 3) << 4) :
292
+ (x[ib].scales[is - 8] >> 4) | (((x[ib].scales[is - 4] >> 6) & 3) << 4);
293
+
294
+ const float dl = d_all * (us - 32);
295
+ const uint8_t q = x[ib].qs[32 * n + l];
296
+ const uint8_t h = x[ib].hmask[l];
297
+ const int8_t qv = ((q >> shift) & 3) - ((h & m) ? 0 : 4);
298
+
299
+ return (dfloat) (dl * qv);
300
+ };
301
+
302
+ v.x() = dequantize_one(iqs + 0);
303
+ v.y() = dequantize_one(iqs + 1);
304
+ #else
305
+ GGML_ABORT("Q3_K dequantize not supported for QK_K != 256");
306
+ #endif
307
+ }
308
+
309
+ static __dpct_inline__ void dequantize_q5_K(const void *vx, const int64_t ib,
310
+ const int iqs, dfloat2 &v) {
311
+ #if QK_K == 256
312
+ const block_q5_K * x = (const block_q5_K *) vx;
313
+ const float dall = x[ib].dm[0];
314
+ const float dmin = x[ib].dm[1];
315
+
316
+ auto dequantize_one = [&](const int idx) -> dfloat {
317
+ const int il = idx / 64;
318
+ const int in = idx % 64;
319
+ const int is = 2 * il + (in >= 32 ? 1 : 0);
320
+ const int ir = (in & 31) / 2;
321
+ const int iq = in & 1;
322
+
323
+ const uint8_t q = x[ib].qs[32 * il + 2 * ir + iq];
324
+ const uint8_t h = x[ib].qh[2 * ir + iq];
325
+ const uint8_t qv = (in >= 32) ? (q >> 4) : (q & 0xF);
326
+
327
+ uint8_t sc;
328
+ uint8_t m;
329
+ get_scale_min_k4(is, x[ib].scales, sc, m);
330
+
331
+ const float d = dall * sc;
332
+ const float mn = dmin * m;
333
+ const uint8_t hm = 1 << (2 * il + (in >= 32 ? 1 : 0));
334
+
335
+ return sycl::fma((dfloat) (qv + ((h & hm) ? 16 : 0)), (dfloat) d, (dfloat) (-mn));
336
+ };
337
+
338
+ v.x() = dequantize_one(iqs + 0);
339
+ v.y() = dequantize_one(iqs + 1);
340
+ #else
341
+ GGML_ABORT("Q5_K dequantize not supported for QK_K != 256");
342
+ #endif
343
+ }
344
+
345
+ static __dpct_inline__ void dequantize_q5_K_f32(const void *vx, const int64_t ib,
346
+ const int iqs, float &v0, float &v1) {
347
+ #if QK_K == 256
348
+ const block_q5_K * x = (const block_q5_K *) vx;
349
+ const float dall = x[ib].dm[0];
350
+ const float dmin = x[ib].dm[1];
351
+
352
+ auto dequantize_one = [&](const int idx) -> float {
353
+ const int il = idx / 64;
354
+ const int in = idx % 64;
355
+ const int is = 2 * il + (in >= 32 ? 1 : 0);
356
+ const int ir = (in & 31) / 2;
357
+ const int iq = in & 1;
358
+
359
+ const uint8_t q = x[ib].qs[32 * il + 2 * ir + iq];
360
+ const uint8_t h = x[ib].qh[2 * ir + iq];
361
+ const uint8_t qv = (in >= 32) ? (q >> 4) : (q & 0xF);
362
+
363
+ uint8_t sc;
364
+ uint8_t m;
365
+ get_scale_min_k4(is, x[ib].scales, sc, m);
366
+
367
+ const float d = dall * sc;
368
+ const float mn = dmin * m;
369
+ const uint8_t hm = 1 << (2 * il + (in >= 32 ? 1 : 0));
370
+
371
+ return (qv + ((h & hm) ? 16 : 0)) * d - mn;
372
+ };
373
+
374
+ v0 = dequantize_one(iqs + 0);
375
+ v1 = dequantize_one(iqs + 1);
376
+ #else
377
+ GGML_ABORT("Q5_K dequantize not supported for QK_K != 256");
378
+ #endif
379
+ }
380
+
381
+ static __dpct_inline__ void dequantize_q6_K(const void *vx, const int64_t ib,
382
+ const int iqs, dfloat2 &v) {
383
+ #if QK_K == 256
384
+ const block_q6_K * x = (const block_q6_K *) vx;
385
+ const float d = x[ib].d;
386
+
387
+ auto dequantize_one = [&](const int idx) -> dfloat {
388
+ const int ip = idx / 128;
389
+ const int in = idx % 128;
390
+ const int il = in & 31;
391
+ const int ig = in / 32;
392
+ const int is = 8 * ip + il / 16;
393
+
394
+ const uint8_t ql0 = x[ib].ql[64 * ip + il];
395
+ const uint8_t ql1 = x[ib].ql[64 * ip + il + 32];
396
+ const uint8_t qh = x[ib].qh[32 * ip + il];
397
+ const int8_t * sc = x[ib].scales + is;
398
+
399
+ uint8_t qv;
400
+ int8_t scale;
401
+ if (ig == 0) {
402
+ qv = (ql0 & 0xF) | (((qh >> 0) & 3) << 4);
403
+ scale = sc[0];
404
+ } else if (ig == 1) {
405
+ qv = (ql1 & 0xF) | (((qh >> 2) & 3) << 4);
406
+ scale = sc[2];
407
+ } else if (ig == 2) {
408
+ qv = (ql0 >> 4) | (((qh >> 4) & 3) << 4);
409
+ scale = sc[4];
410
+ } else {
411
+ qv = (ql1 >> 4) | (((qh >> 6) & 3) << 4);
412
+ scale = sc[6];
413
+ }
414
+
415
+ return (dfloat) (d * scale * ((int8_t) qv - 32));
416
+ };
417
+
418
+ v.x() = dequantize_one(iqs + 0);
419
+ v.y() = dequantize_one(iqs + 1);
420
+ #else
421
+ GGML_ABORT("Q6_K dequantize not supported for QK_K != 256");
422
+ #endif
423
+ }
424
+
425
+ static __dpct_inline__ void dequantize_mxfp4(const void *vx, const int64_t ib,
426
+ const int iqs, dfloat2 &v) {
427
+ const block_mxfp4 * x = (const block_mxfp4 *) vx;
428
+ const float d = ggml_sycl_e8m0_to_fp32(x[ib].e);
429
+ const uint8_t q = x[ib].qs[iqs];
430
+
431
+ v.x() = d * kvalues_mxfp4[q & 0xF] * 0.5f;
432
+ v.y() = d * kvalues_mxfp4[q >> 4] * 0.5f;
433
+ }
434
+
435
+ static __dpct_inline__ void dequantize_nvfp4(const void *vx, const int64_t ib,
436
+ const int iqs, dfloat2 &v) {
437
+ const block_nvfp4 & xb = ((const block_nvfp4 *) vx)[ib];
438
+
439
+ auto dequantize_one = [&](const int idx) -> dfloat {
440
+ const int sub = idx / QK_NVFP4_SUB;
441
+ const int j = idx % QK_NVFP4_SUB;
442
+ const int jh = j % (QK_NVFP4_SUB / 2);
443
+
444
+ const float d = ggml_sycl_ue4m3_to_fp32(xb.d[sub]);
445
+ const uint8_t q = xb.qs[sub * (QK_NVFP4_SUB / 2) + jh];
446
+ const uint8_t qv = (j < (QK_NVFP4_SUB / 2)) ? (q & 0x0F) : (q >> 4);
447
+
448
+ return d * kvalues_mxfp4[qv];
449
+ };
450
+
451
+ v.x() = dequantize_one(iqs + 0);
452
+ v.y() = dequantize_one(iqs + 1);
453
+ }
454
+
455
+ static __dpct_inline__ void dequantize_iq2_xxs(const void *vx, const int64_t ib,
456
+ const int iqs, dfloat2 &v) {
457
+ #if QK_K == 256
458
+ const block_iq2_xxs * x = (const block_iq2_xxs *) vx;
459
+
460
+ auto dequantize_one = [&](const int idx) -> dfloat {
461
+ const int ib8 = idx / 32;
462
+ const int r = idx % 32;
463
+ const int il = r / 8;
464
+ const int j = r % 8;
465
+
466
+ const uint16_t * q2 = x[ib].qs + 4 * ib8;
467
+ const uint8_t * aux8 = (const uint8_t *) q2;
468
+ const uint8_t * grid = (const uint8_t *) (iq2xxs_grid + aux8[il]);
469
+ const uint32_t aux32 = q2[2] | (q2[3] << 16);
470
+ const float d = (float) x[ib].d * (0.5f + (aux32 >> 28)) * 0.25f;
471
+ const uint8_t signs = ksigns_iq2xs[(aux32 >> (7 * il)) & 127];
472
+
473
+ return d * grid[j] * ((signs & kmask_iq2xs[j]) ? -1.f : 1.f);
474
+ };
475
+
476
+ v.x() = dequantize_one(iqs + 0);
477
+ v.y() = dequantize_one(iqs + 1);
478
+ #else
479
+ GGML_ABORT("IQ2_XXS dequantize not supported for QK_K != 256");
480
+ #endif
481
+ }
482
+
483
+ static __dpct_inline__ void dequantize_iq2_xs(const void *vx, const int64_t ib,
484
+ const int iqs, dfloat2 &v) {
485
+ #if QK_K == 256
486
+ const block_iq2_xs * x = (const block_iq2_xs *) vx;
487
+
488
+ auto dequantize_one = [&](const int idx) -> dfloat {
489
+ const int ib8 = idx / 32;
490
+ const int r = idx % 32;
491
+ const int il = r / 8;
492
+ const int j = r % 8;
493
+
494
+ const uint16_t * q2 = x[ib].qs + 4 * ib8;
495
+ const uint8_t * grid = (const uint8_t *) (iq2xs_grid + (q2[il] & 511));
496
+ const float d = (float) x[ib].d * (0.5f + ((x[ib].scales[ib8] >> (4 * (il / 2))) & 0xf)) * 0.25f;
497
+ const uint8_t signs = ksigns_iq2xs[q2[il] >> 9];
498
+
499
+ return d * grid[j] * ((signs & kmask_iq2xs[j]) ? -1.f : 1.f);
500
+ };
501
+
502
+ v.x() = dequantize_one(iqs + 0);
503
+ v.y() = dequantize_one(iqs + 1);
504
+ #else
505
+ GGML_ABORT("IQ2_XS dequantize not supported for QK_K != 256");
506
+ #endif
507
+ }
508
+
509
+ static __dpct_inline__ void dequantize_iq2_s(const void *vx, const int64_t ib,
510
+ const int iqs, dfloat2 &v) {
511
+ #if QK_K == 256
512
+ const block_iq2_s * x = (const block_iq2_s *) vx;
513
+
514
+ auto dequantize_one = [&](const int idx) -> dfloat {
515
+ const int ib8 = idx / 32;
516
+ const int r = idx % 32;
517
+ const int il = r / 8;
518
+ const int j = r % 8;
519
+
520
+ const uint16_t grid_id = x[ib].qs[4 * ib8 + il] | ((x[ib].qh[ib8] << (8 - 2 * il)) & 0x300);
521
+ const uint8_t * grid = (const uint8_t *) (iq2s_grid + grid_id);
522
+ const float d = (float) x[ib].d * (0.5f + ((x[ib].scales[ib8] >> (4 * (il / 2))) & 0xf)) * 0.25f;
523
+ const uint8_t signs = x[ib].qs[QK_K / 8 + 4 * ib8 + il];
524
+
525
+ return d * grid[j] * ((signs & kmask_iq2xs[j]) ? -1.f : 1.f);
526
+ };
527
+
528
+ v.x() = dequantize_one(iqs + 0);
529
+ v.y() = dequantize_one(iqs + 1);
530
+ #else
531
+ GGML_ABORT("IQ2_S dequantize not supported for QK_K != 256");
532
+ #endif
533
+ }
534
+
535
+ static __dpct_inline__ void dequantize_iq3_xxs(const void *vx, const int64_t ib,
536
+ const int iqs, dfloat2 &v) {
537
+ #if QK_K == 256
538
+ const block_iq3_xxs * x = (const block_iq3_xxs *) vx;
539
+
540
+ auto dequantize_one = [&](const int idx) -> dfloat {
541
+ const int ib8 = idx / 32;
542
+ const int r = idx % 32;
543
+ const int il = r / 8;
544
+ const int j = r % 8;
545
+
546
+ const uint8_t * q3 = x[ib].qs + 8 * ib8;
547
+ const uint16_t * gas = (const uint16_t *) (x[ib].qs + QK_K / 4) + 2 * ib8;
548
+ const uint8_t * grid1 = (const uint8_t *) (iq3xxs_grid + q3[2 * il + 0]);
549
+ const uint8_t * grid2 = (const uint8_t *) (iq3xxs_grid + q3[2 * il + 1]);
550
+ const uint32_t aux32 = gas[0] | (gas[1] << 16);
551
+ const float d = (float) x[ib].d * (0.5f + (aux32 >> 28)) * 0.5f;
552
+ const uint8_t signs = ksigns_iq2xs[(aux32 >> (7 * il)) & 127];
553
+
554
+ if (j < 4) {
555
+ return d * grid1[j] * ((signs & kmask_iq2xs[j + 0]) ? -1.f : 1.f);
556
+ }
557
+ return d * grid2[j - 4] * ((signs & kmask_iq2xs[j + 0]) ? -1.f : 1.f);
558
+ };
559
+
560
+ v.x() = dequantize_one(iqs + 0);
561
+ v.y() = dequantize_one(iqs + 1);
562
+ #else
563
+ GGML_ABORT("IQ3_XXS dequantize not supported for QK_K != 256");
564
+ #endif
565
+ }
566
+
567
+ static __dpct_inline__ void dequantize_iq3_s(const void *vx, const int64_t ib,
568
+ const int iqs, dfloat2 &v) {
569
+ #if QK_K == 256
570
+ const block_iq3_s * x = (const block_iq3_s *) vx;
571
+
572
+ auto dequantize_one = [&](const int idx) -> dfloat {
573
+ const int ib8 = idx / 32;
574
+ const int r = idx % 32;
575
+ const int il = r / 8;
576
+ const int j = r % 8;
577
+
578
+ const uint8_t * qs = x[ib].qs + 8 * ib8;
579
+ const uint16_t grid1_id = qs[2 * il + 0] | ((x[ib].qh[ib8] << (8 - 2 * il)) & 256);
580
+ const uint16_t grid2_id = qs[2 * il + 1] | ((x[ib].qh[ib8] << (7 - 2 * il)) & 256);
581
+ const uint8_t * grid1 = (const uint8_t *) (iq3s_grid + grid1_id);
582
+ const uint8_t * grid2 = (const uint8_t *) (iq3s_grid + grid2_id);
583
+ const float d = (float) x[ib].d * (1 + 2 * ((x[ib].scales[ib8 / 2] >> (4 * (ib8 % 2))) & 0xf));
584
+ const uint8_t signs = x[ib].signs[4 * ib8 + il];
585
+
586
+ if (j < 4) {
587
+ return d * grid1[j] * ((signs & kmask_iq2xs[j + 0]) ? -1.f : 1.f);
588
+ }
589
+ return d * grid2[j - 4] * ((signs & kmask_iq2xs[j + 0]) ? -1.f : 1.f);
590
+ };
591
+
592
+ v.x() = dequantize_one(iqs + 0);
593
+ v.y() = dequantize_one(iqs + 1);
594
+ #else
595
+ GGML_ABORT("IQ3_S dequantize not supported for QK_K != 256");
596
+ #endif
597
+ }
598
+
599
+ static __dpct_inline__ void dequantize_iq1_s(const void *vx, const int64_t ib,
600
+ const int iqs, dfloat2 &v) {
601
+ #if QK_K == 256
602
+ const block_iq1_s * x = (const block_iq1_s *) vx;
603
+
604
+ auto dequantize_one = [&](const int idx) -> dfloat {
605
+ const int ib8 = idx / 32;
606
+ const int r = idx % 32;
607
+ const int il = r / 8;
608
+ const int j = r % 8;
609
+
610
+ const float delta = (x[ib].qh[ib8] & 0x8000) ? (-1.f - IQ1S_DELTA) : (-1.f + IQ1S_DELTA);
611
+ const float d = (float) x[ib].d * (2 * ((x[ib].qh[ib8] >> 12) & 7) + 1);
612
+ const uint16_t grid_id = x[ib].qs[4 * ib8 + il] | (((x[ib].qh[ib8] >> (3 * il)) & 7) << 8);
613
+ const uint32_t g = iq1s_grid_gpu[grid_id];
614
+ const int8_t qv = (j < 4) ? ((g >> (8 * j)) & 0x0F) : ((g >> (8 * (j - 4) + 4)) & 0x0F);
615
+
616
+ return d * (qv + delta);
617
+ };
618
+
619
+ v.x() = dequantize_one(iqs + 0);
620
+ v.y() = dequantize_one(iqs + 1);
621
+ #else
622
+ GGML_ABORT("IQ1_S dequantize not supported for QK_K != 256");
623
+ #endif
624
+ }
625
+
626
+ static __dpct_inline__ void dequantize_iq1_m(const void *vx, const int64_t ib,
627
+ const int iqs, dfloat2 &v) {
628
+ #if QK_K == 256
629
+ const block_iq1_m * x = (const block_iq1_m *) vx;
630
+
631
+ auto dequantize_one = [&](const int idx) -> dfloat {
632
+ const int ib8 = idx / 32;
633
+ const int r = idx % 32;
634
+ const int il = r / 8;
635
+ const int j = r % 8;
636
+
637
+ const uint16_t * sc = (const uint16_t *) x[ib].scales;
638
+ iq1m_scale_t scale;
639
+ scale.u16 = (sc[0] >> 12) | ((sc[1] >> 8) & 0x00f0) | ((sc[2] >> 4) & 0x0f00) | (sc[3] & 0xf000);
640
+
641
+ const int ib16 = 2 * ib8 + il / 2;
642
+ const float d = (float) scale.f16 * (2 * ((sc[ib16 / 4] >> (3 * (ib16 % 4))) & 0x7) + 1);
643
+
644
+ const uint8_t qh = x[ib].qh[2 * ib8 + il / 2];
645
+ const float delta = (qh & (0x08 << (4 * (il % 2)))) ? (-1.f - IQ1M_DELTA) : (-1.f + IQ1M_DELTA);
646
+
647
+ const uint16_t grid_id = x[ib].qs[4 * ib8 + il] | (((qh >> (4 * (il % 2))) & 7) << 8);
648
+ const uint32_t g = iq1s_grid_gpu[grid_id];
649
+ const int8_t qv = (j < 4) ? ((g >> (8 * j)) & 0x0F) : ((g >> (8 * (j - 4) + 4)) & 0x0F);
650
+
651
+ return d * (qv + delta);
652
+ };
653
+
654
+ v.x() = dequantize_one(iqs + 0);
655
+ v.y() = dequantize_one(iqs + 1);
656
+ #else
657
+ GGML_ABORT("IQ1_M dequantize not supported for QK_K != 256");
658
+ #endif
659
+ }
660
+
661
+ static __dpct_inline__ void dequantize_iq4_nl(const void *vx, const int64_t ib,
662
+ const int iqs, dfloat2 &v) {
663
+ const block_iq4_nl * x = (const block_iq4_nl *) vx;
664
+ const float d = (float) x[ib].d;
665
+
666
+ auto dequantize_one = [&](const int idx) -> dfloat {
667
+ if (idx < 16) {
668
+ return d * kvalues_iq4nl[x[ib].qs[idx] & 0xF];
669
+ }
670
+ return d * kvalues_iq4nl[x[ib].qs[idx - 16] >> 4];
671
+ };
672
+
673
+ v.x() = dequantize_one(iqs + 0);
674
+ v.y() = dequantize_one(iqs + 1);
675
+ }
676
+
677
+ static __dpct_inline__ void dequantize_iq4_xs(const void *vx, const int64_t ib,
678
+ const int iqs, dfloat2 &v) {
679
+ #if QK_K == 256
680
+ const block_iq4_xs * x = (const block_iq4_xs *) vx;
681
+
682
+ auto dequantize_one = [&](const int idx) -> dfloat {
683
+ const int ib8 = idx / 32;
684
+ const int r = idx % 32;
685
+ const int byte_idx = (r < 16) ? r : (r - 16);
686
+ const uint8_t q = x[ib].qs[16 * ib8 + byte_idx];
687
+ const uint8_t qv = (r < 16) ? (q & 0x0F) : (q >> 4);
688
+
689
+ const float d = (float) x[ib].d * ((((x[ib].scales_l[ib8 / 2] >> (4 * (ib8 % 2))) & 0xf) |
690
+ (((x[ib].scales_h >> (2 * ib8)) & 3) << 4)) - 32);
691
+ return d * kvalues_iq4nl[qv];
692
+ };
693
+
694
+ v.x() = dequantize_one(iqs + 0);
695
+ v.y() = dequantize_one(iqs + 1);
696
+ #else
697
+ GGML_ABORT("IQ4_XS dequantize not supported for QK_K != 256");
698
+ #endif
699
+ }
700
+
701
+ static __dpct_inline__ void dequantize_q5_0(const void *vx, const int64_t ib,
702
+ const int iqs, dfloat2 &v) {
703
+ const block_q5_0 * x = (const block_q5_0 *) vx;
704
+
705
+ const dfloat d = x[ib].d;
706
+
707
+ uint32_t qh;
708
+ memcpy(&qh, x[ib].qh, sizeof(qh));
709
+
710
+ const int xh_0 = ((qh >> (iqs + 0)) << 4) & 0x10;
711
+ const int xh_1 = ((qh >> (iqs + 12)) ) & 0x10;
712
+
713
+ v.x() = ((x[ib].qs[iqs] & 0xf) | xh_0);
714
+ v.y() = ((x[ib].qs[iqs] >> 4) | xh_1);
715
+
716
+ #ifdef GGML_SYCL_F16
717
+ // v = v - {16.0f, 16.0f};
718
+ // v = v * {d, d};
719
+ v.s0() = (v.s0() - 16.0f) * d;
720
+ v.s1() = (v.s1() - 16.0f) * d;
721
+
722
+ #else
723
+ v.x() = (v.x() - 16.0f) * d;
724
+ v.y() = (v.y() - 16.0f) * d;
725
+ #endif // GGML_SYCL_F16
726
+ }
727
+
728
+ static __dpct_inline__ void dequantize_q5_1(const void *vx, const int64_t ib,
729
+ const int iqs, dfloat2 &v) {
730
+ const block_q5_1 * x = (const block_q5_1 *) vx;
731
+
732
+ const dfloat d = x[ib].dm[0];
733
+ const dfloat m = x[ib].dm[1];
734
+
735
+ uint32_t qh;
736
+ memcpy(&qh, x[ib].qh, sizeof(qh));
737
+
738
+ const int xh_0 = ((qh >> (iqs + 0)) << 4) & 0x10;
739
+ const int xh_1 = ((qh >> (iqs + 12)) ) & 0x10;
740
+
741
+ v.x() = ((x[ib].qs[iqs] & 0xf) | xh_0);
742
+ v.y() = ((x[ib].qs[iqs] >> 4) | xh_1);
743
+
744
+ #ifdef GGML_SYCL_F16
745
+ // v = v * {d, d};
746
+ // v = v + {m, m};
747
+ v.s0() = sycl::fma(v.s0(), d, m);
748
+ v.s1() = sycl::fma(v.s1(), d, m);
749
+ #else
750
+ v.x() = sycl::fma(v.x(), d, m);
751
+ v.y() = sycl::fma(v.y(), d, m);
752
+ #endif // GGML_SYCL_F16
753
+ }
754
+
755
+ static __dpct_inline__ void dequantize_q8_0_reorder(const void *d_ptr, const int64_t ib, const void *qs,
756
+ const int iqs, dfloat2 &v) {
757
+ const dfloat d = (const dfloat)*((const sycl::half*)d_ptr + ib);
758
+
759
+ v.x() = ((const int8_t *)qs)[iqs + 0];
760
+ v.y() = ((const int8_t *)qs)[iqs + 1];
761
+
762
+ #ifdef GGML_SYCL_F16
763
+ v.s0() *= d;
764
+ v.s1() *= d;
765
+ #else
766
+ v.x() *= d;
767
+ v.y() *= d;
768
+ #endif // GGML_SYCL_F16
769
+ }
770
+
771
+ static __dpct_inline__ void dequantize_q8_0(const void *vx, const int64_t ib,
772
+ const int iqs, dfloat2 &v) {
773
+ const block_q8_0 * x = (const block_q8_0 *) vx;
774
+
775
+ const dfloat d = x[ib].d;
776
+
777
+ v.x() = x[ib].qs[iqs + 0];
778
+ v.y() = x[ib].qs[iqs + 1];
779
+
780
+ #ifdef GGML_SYCL_F16
781
+ // v = v * {d, d};
782
+ v.s0() *= d;
783
+ v.s1() *= d;
784
+ #else
785
+ v.x() *= d;
786
+ v.y() *= d;
787
+ #endif // GGML_SYCL_F16
788
+ }
789
+
790
+ template<typename dst_t>
791
+ static void dequantize_block_q4_0(const void * __restrict__ vx, dst_t * __restrict__ yy, int64_t nb32,
792
+ const sycl::nd_item<3> &item_ct1) {
793
+
794
+ const int64_t i = item_ct1.get_group(2);
795
+
796
+ // assume 32 threads
797
+ const int64_t tid = item_ct1.get_local_id(2);
798
+ const int64_t il = tid/8;
799
+ const int64_t ir = tid%8;
800
+ const int64_t ib = 8*i + ir;
801
+ if (ib >= nb32) {
802
+ return;
803
+ }
804
+
805
+ dst_t * y = yy + 256*i + 32*ir + 4*il;
806
+
807
+ const block_q4_0 * x = (const block_q4_0 *)vx + ib;
808
+ const float d = sycl::vec<sycl::half, 1>(x->d)
809
+ .convert<float, sycl::rounding_mode::automatic>()[0];
810
+ const float dm = -8*d;
811
+
812
+ const uint8_t * q = x->qs + 4*il;
813
+
814
+ for (int l = 0; l < 4; ++l) {
815
+ y[l+ 0] = d * (q[l] & 0xF) + dm;
816
+ y[l+16] = d * (q[l] >> 4) + dm;
817
+ }
818
+ }
819
+
820
+ template<typename dst_t>
821
+ static void dequantize_block_q4_0_reorder(const void * __restrict__ vx, dst_t * __restrict__ yy, int64_t nb32,
822
+ const sycl::nd_item<3> &item_ct1) {
823
+
824
+ const int64_t i = item_ct1.get_group(2);
825
+ auto k=nb32;
826
+ // assume 32 threads
827
+ const int64_t tid = item_ct1.get_local_id(2);
828
+ const int lane_ib = i * WARP_SIZE + tid;
829
+
830
+ if (lane_ib >= k / QK4_0) {
831
+ return;
832
+ }
833
+
834
+ dst_t * y_ptr = yy + lane_ib * QK4_0;
835
+
836
+ auto qs = (const uint8_t*)vx + lane_ib * QK4_0 / 2;
837
+ auto s_ptr = (const sycl::half*)((const uint8_t*)vx + k / 2) + lane_ib;
838
+
839
+ const float d = float(*s_ptr);
840
+
841
+ #pragma unroll
842
+ for (int l = 0; l < QK4_0 / 2; ++l) {
843
+ int vq = qs[l];
844
+ y_ptr[l + 0] = d * ((vq & 0xF) - 8);
845
+ y_ptr[l + 16] = d * ((vq >> 4) - 8);
846
+ }
847
+
848
+ }
849
+
850
+ // Dequantize Q8_0 from reorder layout: [all qs (k bytes)][all d values]
851
+ // Each thread handles one block of QK8_0 elements.
852
+ template<typename dst_t>
853
+ static void dequantize_block_q8_0_reorder(const void * __restrict__ vx, dst_t * __restrict__ yy, int64_t k,
854
+ const sycl::nd_item<3> &item_ct1) {
855
+
856
+ const int64_t i = item_ct1.get_group(2);
857
+ const int64_t tid = item_ct1.get_local_id(2);
858
+ const int lane_ib = i * WARP_SIZE + tid;
859
+
860
+ if (lane_ib >= k / QK8_0) {
861
+ return;
862
+ }
863
+
864
+ dst_t * y_ptr = yy + lane_ib * QK8_0;
865
+
866
+ auto qs = (const int8_t*)vx + lane_ib * QK8_0;
867
+ auto s_ptr = (const sycl::half*)((const uint8_t*)vx + k) + lane_ib;
868
+
869
+ const float d = float(*s_ptr);
870
+
871
+ #pragma unroll
872
+ for (int l = 0; l < QK8_0; ++l) {
873
+ y_ptr[l] = d * qs[l];
874
+ }
875
+
876
+ }
877
+
878
+ template<typename dst_t>
879
+ static void dequantize_block_q4_1(const void * __restrict__ vx, dst_t * __restrict__ yy, int64_t nb32,
880
+ const sycl::nd_item<3> &item_ct1) {
881
+
882
+ const int64_t i = item_ct1.get_group(2);
883
+
884
+ // assume 32 threads
885
+ const int64_t tid = item_ct1.get_local_id(2);
886
+ const int64_t il = tid/8;
887
+ const int64_t ir = tid%8;
888
+ const int64_t ib = 8*i + ir;
889
+ if (ib >= nb32) {
890
+ return;
891
+ }
892
+
893
+ dst_t * y = yy + 256*i + 32*ir + 4*il;
894
+
895
+ const block_q4_1 * x = (const block_q4_1 *)vx + ib;
896
+ const sycl::float2 d =
897
+ x->dm.convert<float, sycl::rounding_mode::automatic>();
898
+
899
+ const uint8_t * q = x->qs + 4*il;
900
+
901
+ for (int l = 0; l < 4; ++l) {
902
+ y[l + 0] = d.x() * (q[l] & 0xF) + d.y();
903
+ y[l + 16] = d.x() * (q[l] >> 4) + d.y();
904
+ }
905
+ }
906
+
907
+
908
+ //================================== k-quants
909
+
910
+ template<typename dst_t>
911
+ static void dequantize_block_q2_K(const void * __restrict__ vx, dst_t * __restrict__ yy,
912
+ const sycl::nd_item<3> &item_ct1) {
913
+
914
+ const int64_t i = item_ct1.get_group(2);
915
+ const block_q2_K * x = (const block_q2_K *) vx;
916
+
917
+ const int64_t tid = item_ct1.get_local_id(2);
918
+ #if QK_K == 256
919
+ const int64_t n = tid/32;
920
+ const int64_t l = tid - 32*n;
921
+ const int64_t is = 8*n + l/16;
922
+
923
+ const uint8_t q = x[i].qs[32*n + l];
924
+ dst_t * y = yy + i*QK_K + 128*n;
925
+
926
+ float dall = x[i].dm[0];
927
+ float dmin = x[i].dm[1];
928
+ y[l+ 0] = dall * (x[i].scales[is+0] & 0xF) * ((q >> 0) & 3) - dmin * (x[i].scales[is+0] >> 4);
929
+ y[l+32] = dall * (x[i].scales[is+2] & 0xF) * ((q >> 2) & 3) - dmin * (x[i].scales[is+2] >> 4);
930
+ y[l+64] = dall * (x[i].scales[is+4] & 0xF) * ((q >> 4) & 3) - dmin * (x[i].scales[is+4] >> 4);
931
+ y[l+96] = dall * (x[i].scales[is+6] & 0xF) * ((q >> 6) & 3) - dmin * (x[i].scales[is+6] >> 4);
932
+ #else
933
+ const int64_t is = tid/16; // 0 or 1
934
+ const int64_t il = tid%16; // 0...15
935
+ const uint8_t q = x[i].qs[il] >> (2*is);
936
+ dst_t * y = yy + i*QK_K + 16*is + il;
937
+
938
+ float dall = x[i].dm[0];
939
+ float dmin = x[i].dm[1];
940
+ y[ 0] = dall * (x[i].scales[is+0] & 0xF) * ((q >> 0) & 3) - dmin * (x[i].scales[is+0] >> 4);
941
+ y[32] = dall * (x[i].scales[is+2] & 0xF) * ((q >> 4) & 3) - dmin * (x[i].scales[is+2] >> 4);
942
+ #endif
943
+
944
+ }
945
+
946
+ template<typename dst_t>
947
+ static void dequantize_block_q2_K_reorder(const void * __restrict__ vx, dst_t * __restrict__ yy,
948
+ const sycl::nd_item<3> & item_ct1, int64_t n_blocks) {
949
+ #if QK_K == 256
950
+ const int64_t i = item_ct1.get_group(2);
951
+ if (i >= n_blocks) {
952
+ return;
953
+ }
954
+
955
+ const uint8_t * base = static_cast<const uint8_t *>(vx);
956
+ const size_t qs_offset = i * (QK_K / 4);
957
+ const size_t scales_offset = n_blocks * (QK_K / 4) + i * (QK_K / 16);
958
+ const size_t dm_offset = n_blocks * (QK_K / 4) + n_blocks * (QK_K / 16) + i * sizeof(ggml_half2);
959
+
960
+ const uint8_t * qs = base + qs_offset;
961
+ const uint8_t * scales = base + scales_offset;
962
+ const ggml_half2 * dm = reinterpret_cast<const ggml_half2 *>(base + dm_offset);
963
+
964
+ const int64_t tid = item_ct1.get_local_id(2);
965
+ const int64_t n = tid / 32;
966
+ const int64_t l = tid - 32 * n;
967
+ const int64_t is = 8 * n + l / 16;
968
+
969
+ const uint8_t q = qs[32 * n + l];
970
+ dst_t * y = yy + i * QK_K + 128 * n;
971
+
972
+ const float dall = (*dm)[0];
973
+ const float dmin = (*dm)[1];
974
+ y[l+ 0] = dall * (scales[is+0] & 0xF) * ((q >> 0) & 3) - dmin * (scales[is+0] >> 4);
975
+ y[l+32] = dall * (scales[is+2] & 0xF) * ((q >> 2) & 3) - dmin * (scales[is+2] >> 4);
976
+ y[l+64] = dall * (scales[is+4] & 0xF) * ((q >> 4) & 3) - dmin * (scales[is+4] >> 4);
977
+ y[l+96] = dall * (scales[is+6] & 0xF) * ((q >> 6) & 3) - dmin * (scales[is+6] >> 4);
978
+ #else
979
+ GGML_UNUSED(vx);
980
+ GGML_UNUSED(yy);
981
+ GGML_UNUSED(item_ct1);
982
+ GGML_UNUSED(n_blocks);
983
+ GGML_ABORT("Q2_K reorder dequantize not supported for QK_K != 256");
984
+ #endif
985
+ }
986
+
987
+ template<typename dst_t>
988
+ static void dequantize_block_q3_K(const void * __restrict__ vx, dst_t * __restrict__ yy,
989
+ const sycl::nd_item<3> &item_ct1) {
990
+
991
+ const int64_t i = item_ct1.get_group(2);
992
+ const block_q3_K * x = (const block_q3_K *) vx;
993
+
994
+ #if QK_K == 256
995
+ const int64_t r = item_ct1.get_local_id(2) / 4;
996
+ const int64_t tid = r/2;
997
+ const int64_t is0 = r%2;
998
+ const int64_t l0 = 16 * is0 + 4 * (item_ct1.get_local_id(2) % 4);
999
+ const int64_t n = tid / 4;
1000
+ const int64_t j = tid - 4*n;
1001
+
1002
+ uint8_t m = 1 << (4*n + j);
1003
+ int64_t is = 8*n + 2*j + is0;
1004
+ int shift = 2*j;
1005
+
1006
+ int8_t us = is < 4 ? (x[i].scales[is-0] & 0xF) | (((x[i].scales[is+8] >> 0) & 3) << 4) :
1007
+ is < 8 ? (x[i].scales[is-0] & 0xF) | (((x[i].scales[is+4] >> 2) & 3) << 4) :
1008
+ is < 12 ? (x[i].scales[is-8] >> 4) | (((x[i].scales[is+0] >> 4) & 3) << 4) :
1009
+ (x[i].scales[is-8] >> 4) | (((x[i].scales[is-4] >> 6) & 3) << 4);
1010
+ float d_all = x[i].d;
1011
+ float dl = d_all * (us - 32);
1012
+
1013
+ dst_t * y = yy + i*QK_K + 128*n + 32*j;
1014
+ const uint8_t * q = x[i].qs + 32*n;
1015
+ const uint8_t * hm = x[i].hmask;
1016
+
1017
+ for (int l = l0; l < l0+4; ++l) y[l] = dl * ((int8_t)((q[l] >> shift) & 3) - ((hm[l] & m) ? 0 : 4));
1018
+ #else
1019
+ const int64_t tid = item_ct1.get_local_id(2);
1020
+ const int64_t is = tid/16; // 0 or 1
1021
+ const int64_t il = tid%16; // 0...15
1022
+ const int64_t im = il/8; // 0...1
1023
+ const int64_t in = il%8; // 0...7
1024
+
1025
+ dst_t * y = yy + i*QK_K + 16*is + il;
1026
+
1027
+ const uint8_t q = x[i].qs[il] >> (2*is);
1028
+ const uint8_t h = x[i].hmask[in] >> (2*is + im);
1029
+ const float d = (float)x[i].d;
1030
+
1031
+ if (is == 0) {
1032
+ y[ 0] = d * ((x[i].scales[0] & 0xF) - 8) * ((int8_t)((q >> 0) & 3) - ((h >> 0) & 1 ? 0 : 4));
1033
+ y[32] = d * ((x[i].scales[1] & 0xF) - 8) * ((int8_t)((q >> 4) & 3) - ((h >> 4) & 1 ? 0 : 4));
1034
+ } else {
1035
+ y[ 0] = d * ((x[i].scales[0] >> 4) - 8) * ((int8_t)((q >> 0) & 3) - ((h >> 0) & 1 ? 0 : 4));
1036
+ y[32] = d * ((x[i].scales[1] >> 4) - 8) * ((int8_t)((q >> 4) & 3) - ((h >> 4) & 1 ? 0 : 4));
1037
+ }
1038
+ #endif
1039
+
1040
+ }
1041
+
1042
+ template<typename dst_t>
1043
+ static void dequantize_block_q3_K_reorder(const void * __restrict__ vx, dst_t * __restrict__ yy,
1044
+ const sycl::nd_item<3> & item_ct1, int64_t n_blocks) {
1045
+ #if QK_K == 256
1046
+ const int64_t i = item_ct1.get_group(2);
1047
+ if (i >= n_blocks) {
1048
+ return;
1049
+ }
1050
+
1051
+ const uint8_t * base = static_cast<const uint8_t *>(vx);
1052
+ const size_t qs_offset = i * (QK_K / 4);
1053
+ const size_t hmask_offset = n_blocks * (QK_K / 4) + i * (QK_K / 8);
1054
+ const size_t scales_offset = n_blocks * (QK_K / 4) + n_blocks * (QK_K / 8) + i * 12;
1055
+ const size_t d_offset = n_blocks * (QK_K / 4) + n_blocks * (QK_K / 8) + n_blocks * 12 +
1056
+ i * sizeof(ggml_half);
1057
+
1058
+ const uint8_t * qs = base + qs_offset;
1059
+ const uint8_t * hmask = base + hmask_offset;
1060
+ const uint8_t * scales = base + scales_offset;
1061
+ const float d_all = static_cast<float>(*reinterpret_cast<const ggml_half *>(base + d_offset));
1062
+
1063
+ const int64_t r = item_ct1.get_local_id(2) / 4;
1064
+ const int64_t tid = r / 2;
1065
+ const int64_t is0 = r % 2;
1066
+ const int64_t l0 = 16 * is0 + 4 * (item_ct1.get_local_id(2) % 4);
1067
+ const int64_t n = tid / 4;
1068
+ const int64_t j = tid - 4 * n;
1069
+ const int64_t is = 8 * n + 2 * j + is0;
1070
+ const int shift = 2 * j;
1071
+ uint8_t m = 1 << (4 * n + j);
1072
+
1073
+ uint8_t us = is < 4
1074
+ ? (scales[is - 0] & 0xF) | (((scales[is + 8] >> 0) & 3) << 4)
1075
+ : is < 8
1076
+ ? (scales[is - 0] & 0xF) | (((scales[is + 4] >> 2) & 3) << 4)
1077
+ : is < 12
1078
+ ? (scales[is - 8] >> 4) | (((scales[is + 0] >> 4) & 3) << 4)
1079
+ : (scales[is - 8] >> 4) | (((scales[is - 4] >> 6) & 3) << 4);
1080
+
1081
+ const float dl = d_all * (us - 32);
1082
+
1083
+ dst_t * y = yy + i * QK_K + 128 * n + 32 * j;
1084
+ const uint8_t * q = qs + 32 * n;
1085
+ const uint8_t * hm = hmask;
1086
+
1087
+ for (int l = l0; l < l0 + 4; ++l) {
1088
+ y[l] = dl * ((int8_t) ((q[l] >> shift) & 3) - ((hm[l] & m) ? 0 : 4));
1089
+ }
1090
+ #else
1091
+ GGML_UNUSED(vx);
1092
+ GGML_UNUSED(yy);
1093
+ GGML_UNUSED(item_ct1);
1094
+ GGML_UNUSED(n_blocks);
1095
+ GGML_ABORT("Q3_K reorder dequantize not supported for QK_K != 256");
1096
+ #endif
1097
+ }
1098
+
1099
+ #if QK_K == 256
1100
+ static inline void get_scale_min_k4(int j, const uint8_t * q, uint8_t & d, uint8_t & m) {
1101
+ if (j < 4) {
1102
+ d = q[j] & 63;
1103
+ m = q[j + 4] & 63;
1104
+ } else {
1105
+ d = (q[j+4] & 0xF) | ((q[j-4] >> 6) << 4);
1106
+ m = (q[j+4] >> 4) | ((q[j-0] >> 6) << 4);
1107
+ }
1108
+ }
1109
+ #endif
1110
+
1111
+ template <typename dst_t>
1112
+ inline void dequantize_q4_K_common(dst_t * __restrict__ y, const uint8_t * __restrict__ qs_ptr, const float dall,
1113
+ const float dmin, uint8_t * __restrict__ scales_local, int il, int ir) {
1114
+ const int is = 2 * il;
1115
+ constexpr int n = 4;
1116
+
1117
+ uint8_t sc, m;
1118
+ get_scale_min_k4(is + 0, scales_local, sc, m);
1119
+ const float d1 = dall * sc;
1120
+ const float m1 = dmin * m;
1121
+
1122
+ get_scale_min_k4(is + 1, scales_local, sc, m);
1123
+ const float d2 = dall * sc;
1124
+ const float m2 = dmin * m;
1125
+
1126
+ sycl::vec<uint8_t, n> q_vec = vec_aligned_load<uint8_t, n>(qs_ptr + 32 * il + n * ir);
1127
+ for (int l = 0; l < n; ++l) {
1128
+ y[l + 0] = d1 * (q_vec[l] & 0xF) - m1;
1129
+ y[l + 32] = d2 * (q_vec[l] >> 4) - m2;
1130
+ }
1131
+ }
1132
+
1133
+ template<typename dst_t>
1134
+ static void dequantize_block_q4_K(const void * __restrict__ vx, dst_t * __restrict__ yy,
1135
+ uint8_t* scales_local, const sycl::nd_item<3> &item_ct1) {
1136
+ const block_q4_K * x = (const block_q4_K *) vx;
1137
+
1138
+ const int64_t i = item_ct1.get_group(2);
1139
+
1140
+ #if QK_K == 256
1141
+ const int64_t tid = item_ct1.get_local_id(2);
1142
+ const int64_t il = tid / 8;
1143
+ const int64_t ir = tid % 8;
1144
+
1145
+ dst_t * y = yy + i * QK_K + 64 * il + 4 * ir;
1146
+
1147
+ const sycl::half2 dm = x[i].dm;
1148
+ const float dall = dm[0];
1149
+ const float dmin = dm[1];
1150
+
1151
+ if (tid < 12) {
1152
+ scales_local[tid] = x[i].scales[tid];
1153
+ }
1154
+
1155
+ item_ct1.barrier(sycl::access::fence_space::local_space);
1156
+ dequantize_q4_K_common(y, x[i].qs, dall, dmin, scales_local, il, ir);
1157
+ #else
1158
+ const int64_t tid = item_ct1.get_local_id(2);
1159
+ const uint8_t * q = x[i].qs;
1160
+ dst_t * y = yy + i*QK_K;
1161
+ const float d = (float)x[i].dm[0];
1162
+ const float m = (float)x[i].dm[1];
1163
+ y[tid+ 0] = d * (x[i].scales[0] & 0xF) * (q[tid] & 0xF) - m * (x[i].scales[0] >> 4);
1164
+ y[tid+32] = d * (x[i].scales[1] & 0xF) * (q[tid] >> 4) - m * (x[i].scales[1] >> 4);
1165
+ #endif
1166
+ }
1167
+
1168
+ template <typename dst_t>
1169
+ static void dequantize_block_q4_K_reorder(const void * __restrict__ vx, dst_t * __restrict__ yy, uint8_t * scales_local,
1170
+ const sycl::nd_item<1> & item_ct1, int64_t nb) {
1171
+ const int64_t i = item_ct1.get_group(0); // block index
1172
+ const int64_t tid = item_ct1.get_local_id(0); // thread index within block
1173
+ const int64_t il = tid / 8;
1174
+ const int64_t ir = tid % 8;
1175
+
1176
+ dst_t * y = yy + i * QK_K + 64 * il + 4 * ir;
1177
+
1178
+ const uint8_t * base = static_cast<const uint8_t *>(vx);
1179
+ const size_t qs_offset = i * (QK_K / 2);
1180
+ const size_t scales_offset = nb * (QK_K / 2) + i * K_SCALE_SIZE;
1181
+ const size_t dm_offset = nb * (QK_K / 2) + nb * K_SCALE_SIZE + i * sizeof(ggml_half2);
1182
+
1183
+ const uint8_t * qs_ptr = base + qs_offset;
1184
+ const uint8_t * scales_ptr = base + scales_offset;
1185
+ ggml_half2 dm_values = *reinterpret_cast<const ggml_half2 *>(base + dm_offset);
1186
+
1187
+ const float dall = dm_values.x();
1188
+ const float dmin = dm_values.y();
1189
+
1190
+ if (tid < 12) {
1191
+ scales_local[tid] = scales_ptr[tid];
1192
+ }
1193
+
1194
+ item_ct1.barrier(sycl::access::fence_space::local_space);
1195
+ dequantize_q4_K_common(y, qs_ptr, dall, dmin, scales_local, il, ir);
1196
+ }
1197
+
1198
+ template<typename dst_t>
1199
+ static void dequantize_block_q5_K(const void * __restrict__ vx, dst_t * __restrict__ yy,
1200
+ const sycl::nd_item<3> &item_ct1) {
1201
+ const block_q5_K * x = (const block_q5_K *) vx;
1202
+
1203
+ const int64_t i = item_ct1.get_group(2);
1204
+
1205
+ #if QK_K == 256
1206
+ // assume 64 threads - this is very slightly better than the one below
1207
+ const int64_t tid = item_ct1.get_local_id(2);
1208
+ const int64_t il = tid/16; // il is in 0...3
1209
+ const int64_t ir = tid%16; // ir is in 0...15
1210
+ const int64_t is = 2*il; // is is in 0...6
1211
+
1212
+ dst_t * y = yy + i*QK_K + 64*il + 2*ir;
1213
+
1214
+ const float dall = x[i].dm[0];
1215
+ const float dmin = x[i].dm[1];
1216
+
1217
+ const uint8_t * ql = x[i].qs + 32*il + 2*ir;
1218
+ const uint8_t * qh = x[i].qh + 2*ir;
1219
+
1220
+ uint8_t sc, m;
1221
+ get_scale_min_k4(is + 0, x[i].scales, sc, m);
1222
+ const float d1 = dall * sc; const float m1 = dmin * m;
1223
+ get_scale_min_k4(is + 1, x[i].scales, sc, m);
1224
+ const float d2 = dall * sc; const float m2 = dmin * m;
1225
+
1226
+ uint8_t hm = 1 << (2*il);
1227
+ y[ 0] = d1 * ((ql[ 0] & 0xF) + (qh[ 0] & hm ? 16 : 0)) - m1;
1228
+ y[ 1] = d1 * ((ql[ 1] & 0xF) + (qh[ 1] & hm ? 16 : 0)) - m1;
1229
+ hm <<= 1;
1230
+ y[32] = d2 * ((ql[ 0] >> 4) + (qh[ 0] & hm ? 16 : 0)) - m2;
1231
+ y[33] = d2 * ((ql[ 1] >> 4) + (qh[ 1] & hm ? 16 : 0)) - m2;
1232
+ #else
1233
+ const int64_t tid = item_ct1.get_local_id(2);
1234
+ const uint8_t q = x[i].qs[tid];
1235
+ const int64_t im = tid/8; // 0...3
1236
+ const int64_t in = tid%8; // 0...7
1237
+ const int64_t is = tid/16; // 0 or 1
1238
+ const uint8_t h = x[i].qh[in] >> im;
1239
+ const float d = x[i].d;
1240
+ dst_t * y = yy + i*QK_K + tid;
1241
+ y[ 0] = d * x[i].scales[is+0] * ((q & 0xF) - ((h >> 0) & 1 ? 0 : 16));
1242
+ y[32] = d * x[i].scales[is+2] * ((q >> 4) - ((h >> 4) & 1 ? 0 : 16));
1243
+ #endif
1244
+ }
1245
+
1246
+ template <typename dst_t>
1247
+ static void dequantize_block_q5_K_reorder(const void * __restrict__ vx, dst_t * __restrict__ yy,
1248
+ uint8_t * scales_local, const sycl::nd_item<3> & item_ct1, int64_t n_blocks) {
1249
+ const int64_t ib = item_ct1.get_group(2);
1250
+
1251
+ #if QK_K == 256
1252
+ // assume 64 threads
1253
+ const int64_t tid = item_ct1.get_local_id(2);
1254
+ const int64_t il = tid / 16; // 0...3
1255
+ const int64_t ir = tid % 16; // 0...15
1256
+ const int64_t is = 2 * il;
1257
+
1258
+ dst_t * y = yy + ib * QK_K + 64 * il + 2 * ir;
1259
+
1260
+ const uint8_t * base = static_cast<const uint8_t *>(vx);
1261
+
1262
+ // Reordered layout: [qs (QK_K/2 per block)] [qh (QK_K/8 per block)] [scales (K_SCALE_SIZE per block)] [dm (half2 per block)]
1263
+ const size_t qs_offset = ib * (QK_K / 2);
1264
+ const size_t qh_offset = n_blocks * (QK_K / 2) + ib * (QK_K / 8);
1265
+ const size_t scales_offset = n_blocks * (QK_K / 2) + n_blocks * (QK_K / 8) + ib * K_SCALE_SIZE;
1266
+ const size_t dm_offset = n_blocks * (QK_K / 2) + n_blocks * (QK_K / 8) + n_blocks * K_SCALE_SIZE + ib * sizeof(ggml_half2);
1267
+
1268
+ const uint8_t * qs_ptr = base + qs_offset;
1269
+ const uint8_t * qh_ptr = base + qh_offset;
1270
+ const uint8_t * scales_ptr = base + scales_offset;
1271
+ const ggml_half2 dm_values = *reinterpret_cast<const ggml_half2 *>(base + dm_offset);
1272
+
1273
+ const float dall = dm_values.x();
1274
+ const float dmin = dm_values.y();
1275
+
1276
+ const uint8_t * ql = qs_ptr + 32 * il + 2 * ir;
1277
+ const uint8_t * qh = qh_ptr + 2 * ir;
1278
+
1279
+ if (tid < K_SCALE_SIZE) {
1280
+ scales_local[tid] = scales_ptr[tid];
1281
+ }
1282
+
1283
+ item_ct1.barrier(sycl::access::fence_space::local_space);
1284
+
1285
+ uint8_t sc, m;
1286
+ get_scale_min_k4(is + 0, scales_local, sc, m);
1287
+ const float d1 = dall * sc; const float m1 = dmin * m;
1288
+ get_scale_min_k4(is + 1, scales_local, sc, m);
1289
+ const float d2 = dall * sc; const float m2 = dmin * m;
1290
+
1291
+ uint8_t hm = 1 << (2 * il);
1292
+ y[ 0] = d1 * ((ql[ 0] & 0xF) + (qh[ 0] & hm ? 16 : 0)) - m1;
1293
+ y[ 1] = d1 * ((ql[ 1] & 0xF) + (qh[ 1] & hm ? 16 : 0)) - m1;
1294
+ hm <<= 1;
1295
+ y[32] = d2 * ((ql[ 0] >> 4) + (qh[ 0] & hm ? 16 : 0)) - m2;
1296
+ y[33] = d2 * ((ql[ 1] >> 4) + (qh[ 1] & hm ? 16 : 0)) - m2;
1297
+ #else
1298
+ GGML_UNUSED(ib); GGML_UNUSED(tid); GGML_UNUSED(yy); GGML_UNUSED(scales_local); GGML_UNUSED(n_blocks);
1299
+ GGML_ABORT("Q5_K reorder dequantize not supported for QK_K != 256");
1300
+ #endif
1301
+ }
1302
+
1303
+ template<typename dst_t>
1304
+ static void dequantize_block_q6_K(const void * __restrict__ vx, dst_t * __restrict__ yy,
1305
+ const sycl::nd_item<3> &item_ct1) {
1306
+ const block_q6_K * x = (const block_q6_K *) vx;
1307
+
1308
+ const int64_t i = item_ct1.get_group(2);
1309
+ #if QK_K == 256
1310
+
1311
+ // assume 64 threads - this is very slightly better than the one below
1312
+ const int64_t tid = item_ct1.get_local_id(2);
1313
+ const int64_t ip = tid/32; // ip is 0 or 1
1314
+ const int64_t il = tid - 32*ip; // 0...32
1315
+ const int64_t is = 8*ip + il/16;
1316
+
1317
+ dst_t * y = yy + i*QK_K + 128*ip + il;
1318
+
1319
+ const float d = x[i].d;
1320
+
1321
+ const uint8_t * ql = x[i].ql + 64*ip + il;
1322
+ const uint8_t qh = x[i].qh[32*ip + il];
1323
+ const int8_t * sc = x[i].scales + is;
1324
+
1325
+ y[ 0] = d * sc[0] * ((int8_t)((ql[ 0] & 0xF) | (((qh >> 0) & 3) << 4)) - 32);
1326
+ y[32] = d * sc[2] * ((int8_t)((ql[32] & 0xF) | (((qh >> 2) & 3) << 4)) - 32);
1327
+ y[64] = d * sc[4] * ((int8_t)((ql[ 0] >> 4) | (((qh >> 4) & 3) << 4)) - 32);
1328
+ y[96] = d * sc[6] * ((int8_t)((ql[32] >> 4) | (((qh >> 6) & 3) << 4)) - 32);
1329
+ #else
1330
+
1331
+ // assume 32 threads
1332
+ const int64_t tid = item_ct1.get_local_id(2);
1333
+ const int64_t ip = tid/16; // 0 or 1
1334
+ const int64_t il = tid - 16*ip; // 0...15
1335
+
1336
+ dst_t * y = yy + i*QK_K + 16*ip + il;
1337
+
1338
+ const float d = x[i].d;
1339
+
1340
+ const uint8_t ql = x[i].ql[16*ip + il];
1341
+ const uint8_t qh = x[i].qh[il] >> (2*ip);
1342
+ const int8_t * sc = x[i].scales;
1343
+
1344
+ y[ 0] = d * sc[ip+0] * ((int8_t)((ql & 0xF) | (((qh >> 0) & 3) << 4)) - 32);
1345
+ y[32] = d * sc[ip+2] * ((int8_t)((ql >> 4) | (((qh >> 4) & 3) << 4)) - 32);
1346
+ #endif
1347
+ }
1348
+
1349
+ template <typename dst_t>
1350
+ static void dequantize_block_q6_K_reorder(const void * __restrict__ vx, dst_t * __restrict__ yy,
1351
+ const sycl::nd_item<3> & item_ct1, int64_t n_blocks) {
1352
+ const int64_t ib = item_ct1.get_group(2);
1353
+
1354
+ const int64_t tid = item_ct1.get_local_id(2);
1355
+ const int64_t ip = tid / 32; // ip is 0 or 1
1356
+ const int64_t il = tid - 32 * ip; // 0...32
1357
+ const int64_t is = 8 * ip + il / 16;
1358
+
1359
+ const uint8_t * base_ptr = static_cast<const uint8_t *>(vx);
1360
+ const auto ql_offset = ib * (QK_K / 2);
1361
+ const auto qh_offset = (QK_K / 2) * n_blocks + (QK_K / 4) * ib;
1362
+ const auto base_scales_offset = (QK_K / 2) * n_blocks + (QK_K / 4) * n_blocks + (QK_K / 16) * ib;
1363
+ const auto base_d_offset = ((QK_K / 2) + (QK_K / 4) + (QK_K / 16)) * n_blocks;
1364
+ const uint8_t * ql_ptr = base_ptr + ql_offset;
1365
+ const uint8_t * qh_ptr = base_ptr + qh_offset;
1366
+ const uint8_t * scales_ptr = base_ptr + base_scales_offset;
1367
+ const ggml_half * d = (const ggml_half *) (base_ptr + base_d_offset) + ib;
1368
+
1369
+ dst_t * y = yy + ib * QK_K + 128 * ip + il;
1370
+
1371
+ const uint8_t * ql = ql_ptr + 64 * ip + il;
1372
+ const uint8_t qh = *(qh_ptr + 32 * ip + il);
1373
+ const int8_t * sc = reinterpret_cast<const int8_t *>(scales_ptr + is);
1374
+
1375
+ y[0] = *d * sc[0] * ((int8_t) ((ql[0] & 0xF) | (((qh >> 0) & 3) << 4)) - 32);
1376
+ y[32] = *d * sc[2] * ((int8_t) ((ql[32] & 0xF) | (((qh >> 2) & 3) << 4)) - 32);
1377
+ y[64] = *d * sc[4] * ((int8_t) ((ql[0] >> 4) | (((qh >> 4) & 3) << 4)) - 32);
1378
+ y[96] = *d * sc[6] * ((int8_t) ((ql[32] >> 4) | (((qh >> 6) & 3) << 4)) - 32);
1379
+ }
1380
+
1381
+ template<typename dst_t>
1382
+ static void dequantize_block_iq2_xxs(const void * __restrict__ vx, dst_t * __restrict__ yy,
1383
+ const sycl::nd_item<3> &item_ct1,
1384
+ const uint64_t *iq2xxs_grid_ptr,
1385
+ const uint8_t *ksigns_iq2xs_ptr,
1386
+ const uint8_t *kmask_iq2xs_ptr) {
1387
+
1388
+ const int64_t i = item_ct1.get_group(2);
1389
+ const block_iq2_xxs * x = (const block_iq2_xxs *) vx;
1390
+
1391
+ const int64_t tid = item_ct1.get_local_id(2);
1392
+ #if QK_K == 256
1393
+ const int64_t il = tid/8; // 0...3
1394
+ const int64_t ib = tid%8; // 0...7
1395
+ dst_t * y = yy + i*QK_K + 32*ib + 8*il;
1396
+ const uint16_t * q2 = x[i].qs + 4*ib;
1397
+ const uint8_t * aux8 = (const uint8_t *)q2;
1398
+ const uint8_t * grid = (const uint8_t *)(iq2xxs_grid_ptr + aux8[il]);
1399
+ const uint32_t aux32 = q2[2] | (q2[3] << 16);
1400
+ const float d = (float)x[i].d * (0.5f + (aux32 >> 28)) * 0.25f;
1401
+ const uint8_t signs = ksigns_iq2xs_ptr[(aux32 >> 7*il) & 127];
1402
+ for (int j = 0; j < 8; ++j) y[j] = d * grid[j] * (signs & kmask_iq2xs_ptr[j] ? -1.f : 1.f);
1403
+ #else
1404
+ assert(false);
1405
+ #endif
1406
+
1407
+ }
1408
+
1409
+ template<typename dst_t>
1410
+ static void dequantize_block_iq2_xs(const void * __restrict__ vx, dst_t * __restrict__ yy,
1411
+ const sycl::nd_item<3> &item_ct1,
1412
+ const uint64_t *iq2xs_grid,
1413
+ const uint8_t *ksigns_iq2xs,
1414
+ const uint8_t *kmask_iq2xs) {
1415
+
1416
+ const int64_t i = item_ct1.get_group(2);
1417
+ const block_iq2_xs * x = (const block_iq2_xs *) vx;
1418
+
1419
+ const int64_t tid = item_ct1.get_local_id(2);
1420
+ #if QK_K == 256
1421
+ const int64_t il = tid/8; // 0...3
1422
+ const int64_t ib = tid%8; // 0...7
1423
+ dst_t * y = yy + i*QK_K + 32*ib + 8*il;
1424
+ const uint16_t * q2 = x[i].qs + 4*ib;
1425
+ const uint8_t * grid = (const uint8_t *)(iq2xs_grid + (q2[il] & 511));
1426
+ const float d = (float)x[i].d * (0.5f + ((x[i].scales[ib] >> 4*(il/2)) & 0xf)) * 0.25f;
1427
+ const uint8_t signs = ksigns_iq2xs[q2[il] >> 9];
1428
+ for (int j = 0; j < 8; ++j) y[j] = d * grid[j] * (signs & kmask_iq2xs[j] ? -1.f : 1.f);
1429
+ #else
1430
+ assert(false);
1431
+ #endif
1432
+
1433
+ }
1434
+
1435
+ template <typename dst_t>
1436
+ __dpct_inline__ static void
1437
+ dequantize_block_iq2_s(const void *__restrict__ vx, dst_t *__restrict__ yy,
1438
+ const sycl::nd_item<3> &item_ct1) {
1439
+
1440
+ const int64_t i = item_ct1.get_group(2);
1441
+ const block_iq2_s * x = (const block_iq2_s *) vx;
1442
+
1443
+ const int64_t tid = item_ct1.get_local_id(2);
1444
+ #if QK_K == 256
1445
+ const int64_t il = tid/8; // 0...3
1446
+ const int64_t ib = tid%8; // 0...7
1447
+ dst_t * y = yy + i*QK_K + 32*ib + 8*il;
1448
+ const uint8_t * grid = (const uint8_t *)(iq2s_grid + (x[i].qs[4*ib+il] | ((x[i].qh[ib] << (8-2*il)) & 0x300)));
1449
+ const float d = (float)x[i].d * (0.5f + ((x[i].scales[ib] >> 4*(il/2)) & 0xf)) * 0.25f;
1450
+ const uint8_t signs = x[i].qs[QK_K/8+4*ib+il];
1451
+ #pragma unroll
1452
+ for (int j = 0; j < 8; ++j)
1453
+ y[j] = d * grid[j] * (signs & kmask_iq2xs[j] ? -1.f : 1.f);
1454
+ #else
1455
+ assert(false);
1456
+
1457
+ #endif
1458
+
1459
+ }
1460
+
1461
+ template<typename dst_t>
1462
+ static void dequantize_block_iq3_xxs(const void * __restrict__ vx, dst_t * __restrict__ yy,
1463
+ const sycl::nd_item<3> &item_ct1,
1464
+ const uint32_t *iq3xxs_grid,
1465
+ const uint8_t *ksigns_iq2xs,
1466
+ const uint8_t *kmask_iq2xs) {
1467
+
1468
+ const int64_t i = item_ct1.get_group(2);
1469
+ const block_iq3_xxs * x = (const block_iq3_xxs *) vx;
1470
+
1471
+ const int64_t tid = item_ct1.get_local_id(2);
1472
+ #if QK_K == 256
1473
+ const int64_t il = tid/8; // 0...3
1474
+ const int64_t ib = tid%8; // 0...7
1475
+ dst_t * y = yy + i*QK_K + 32*ib + 8*il;
1476
+ const uint8_t * q3 = x[i].qs + 8*ib;
1477
+ const uint16_t * gas = (const uint16_t *)(x[i].qs + QK_K/4) + 2*ib;
1478
+ const uint8_t * grid1 = (const uint8_t *)(iq3xxs_grid + q3[2*il+0]);
1479
+ const uint8_t * grid2 = (const uint8_t *)(iq3xxs_grid + q3[2*il+1]);
1480
+ const uint32_t aux32 = gas[0] | (gas[1] << 16);
1481
+ const float d = (float)x[i].d * (0.5f + (aux32 >> 28)) * 0.5f;
1482
+ const uint8_t signs = ksigns_iq2xs[(aux32 >> 7*il) & 127];
1483
+ for (int j = 0; j < 4; ++j) {
1484
+ y[j+0] = d * grid1[j] * (signs & kmask_iq2xs[j+0] ? -1.f : 1.f);
1485
+ y[j+4] = d * grid2[j] * (signs & kmask_iq2xs[j+4] ? -1.f : 1.f);
1486
+ }
1487
+ #else
1488
+ assert(false);
1489
+ #endif
1490
+
1491
+ }
1492
+
1493
+ template <typename dst_t>
1494
+ __dpct_inline__ static void
1495
+ dequantize_block_iq3_s(const void *__restrict__ vx, dst_t *__restrict__ yy,
1496
+ const sycl::nd_item<3> &item_ct1,
1497
+ const uint8_t *kmask_iq2xs, const uint32_t *iq3s_grid) {
1498
+
1499
+ const int64_t i = item_ct1.get_group(2);
1500
+ const block_iq3_s * x = (const block_iq3_s *) vx;
1501
+
1502
+ const int64_t tid = item_ct1.get_local_id(2);
1503
+ #if QK_K == 256
1504
+ const int64_t il = tid/8; // 0...3
1505
+ const int64_t ib = tid%8; // 0...7
1506
+ dst_t * y = yy + i*QK_K + 32*ib + 8*il;
1507
+ const uint8_t * qs = x[i].qs + 8*ib;
1508
+ const uint8_t * grid1 = (const uint8_t *)(iq3s_grid + (qs[2*il+0] | ((x[i].qh[ib] << (8-2*il)) & 256)));
1509
+ const uint8_t * grid2 = (const uint8_t *)(iq3s_grid + (qs[2*il+1] | ((x[i].qh[ib] << (7-2*il)) & 256)));
1510
+ const float d = (float)x[i].d * (1 + 2*((x[i].scales[ib/2] >> 4*(ib%2)) & 0xf));
1511
+ const uint8_t signs = x[i].signs[4*ib + il];
1512
+ #pragma unroll
1513
+ for (int j = 0; j < 4; ++j) {
1514
+ y[j+0] = d * grid1[j] * (signs & kmask_iq2xs[j+0] ? -1.f : 1.f);
1515
+ y[j+4] = d * grid2[j] * (signs & kmask_iq2xs[j+4] ? -1.f : 1.f);
1516
+ }
1517
+ #else
1518
+ assert(false);
1519
+ #endif
1520
+
1521
+ }
1522
+
1523
+ template <typename dst_t>
1524
+ __dpct_inline__ static void
1525
+ dequantize_block_iq1_s(const void *__restrict__ vx, dst_t *__restrict__ yy,
1526
+ const sycl::nd_item<3> &item_ct1,
1527
+ const uint32_t *iq1s_grid_gpu) {
1528
+
1529
+ const int64_t i = item_ct1.get_group(2);
1530
+ const block_iq1_s * x = (const block_iq1_s *) vx;
1531
+
1532
+ const int64_t tid = item_ct1.get_local_id(2);
1533
+ #if QK_K == 256
1534
+ const int64_t il = tid/8; // 0...3
1535
+ const int64_t ib = tid%8; // 0...7
1536
+ dst_t * y = yy + i*QK_K + 32*ib + 8*il;
1537
+ const float delta = x[i].qh[ib] & 0x8000 ? -1 - IQ1S_DELTA : -1 + IQ1S_DELTA;
1538
+ const float d = (float)x[i].d * (2*((x[i].qh[ib] >> 12) & 7) + 1);
1539
+ uint32_t grid32[2]; const int8_t * q = (const int8_t *)grid32;
1540
+ grid32[0] = iq1s_grid_gpu[x[i].qs[4*ib+il] | (((x[i].qh[ib] >> 3*il) & 7) << 8)];
1541
+ grid32[1] = (grid32[0] >> 4) & 0x0f0f0f0f;
1542
+ grid32[0] &= 0x0f0f0f0f;
1543
+ #pragma unroll
1544
+ for (int j = 0; j < 8; ++j) {
1545
+ y[j] = d * (q[j] + delta);
1546
+ }
1547
+ #else
1548
+ assert(false);
1549
+ #endif
1550
+
1551
+ }
1552
+
1553
+ template <typename dst_t>
1554
+ __dpct_inline__ static void
1555
+ dequantize_block_iq1_m(const void *__restrict__ vx, dst_t *__restrict__ yy,
1556
+ const sycl::nd_item<3> &item_ct1,
1557
+ const uint32_t *iq1s_grid_gpu) {
1558
+
1559
+ const int64_t i = item_ct1.get_group(2);
1560
+ const block_iq1_m * x = (const block_iq1_m *) vx;
1561
+
1562
+ const int64_t tid = item_ct1.get_local_id(2);
1563
+ #if QK_K == 256
1564
+ const int64_t il = tid/8; // 0...3
1565
+ const int64_t ib = tid%8; // 0...7
1566
+ dst_t * y = yy + i*QK_K + 32*ib + 8*il;
1567
+ const uint16_t * sc = (const uint16_t *)x[i].scales;
1568
+ iq1m_scale_t scale;
1569
+ scale.u16 = (sc[0] >> 12) | ((sc[1] >> 8) & 0x00f0) | ((sc[2] >> 4) & 0x0f00) | (sc[3] & 0xf000);
1570
+ const int ib16 = 2*ib + il/2; // sc[ib16/4] >> 3*(ib16%4) -> sc[ib/2] >> 3*((2*ib+il/2)%4);
1571
+ const float d = (float)scale.f16 * (2*((sc[ib16/4] >> 3*(ib16%4)) & 0x7) + 1);
1572
+ const float delta = x[i].qh[2*ib+il/2] & (0x08 << 4*(il%2)) ? -1 - IQ1M_DELTA : -1 + IQ1M_DELTA;
1573
+ uint32_t grid32[2]; const int8_t * q = (const int8_t *)grid32;
1574
+ grid32[0] = iq1s_grid_gpu[x[i].qs[4*ib+il] | (((x[i].qh[2*ib+il/2] >> 4*(il%2)) & 7) << 8)];
1575
+ grid32[1] = (grid32[0] >> 4) & 0x0f0f0f0f;
1576
+ grid32[0] &= 0x0f0f0f0f;
1577
+ #pragma unroll
1578
+ for (int j = 0; j < 8; ++j) {
1579
+ y[j] = d * (q[j] + delta);
1580
+ }
1581
+ #else
1582
+ assert(false);
1583
+ #endif
1584
+
1585
+ }
1586
+
1587
+ template <typename dst_t>
1588
+ __dpct_inline__ static void
1589
+ dequantize_block_iq4_nl(const void *__restrict__ vx, dst_t *__restrict__ yy,
1590
+ const sycl::nd_item<3> &item_ct1) {
1591
+
1592
+ const int64_t i = item_ct1.get_group(2);
1593
+ const block_iq4_nl * x = (const block_iq4_nl *) vx + i*(QK_K/QK4_NL);
1594
+
1595
+ const int64_t tid = item_ct1.get_local_id(2);
1596
+ const int64_t il = tid/8; // 0...3
1597
+ const int64_t ib = tid%8; // 0...7
1598
+ dst_t * y = yy + i*QK_K + 32*ib + 4*il;
1599
+ const uint8_t * q4 = x[ib].qs + 4*il;
1600
+ const float d = (float)x[ib].d;
1601
+ #pragma unroll
1602
+ for (int j = 0; j < 4; ++j) {
1603
+ y[j+ 0] = d * kvalues_iq4nl[q4[j] & 0xf];
1604
+ y[j+16] = d * kvalues_iq4nl[q4[j] >> 4];
1605
+ }
1606
+
1607
+ }
1608
+
1609
+
1610
+ template <typename dst_t>
1611
+ __dpct_inline__ static void
1612
+ dequantize_block_iq4_xs(const void *__restrict__ vx, dst_t *__restrict__ yy,
1613
+ const sycl::nd_item<3> &item_ct1) {
1614
+ const int64_t i = item_ct1.get_group(2);
1615
+ const block_iq4_xs * x = (const block_iq4_xs *)vx;
1616
+
1617
+ const int64_t tid = item_ct1.get_local_id(2);
1618
+ const int64_t il = tid/8; // 0...3
1619
+ const int64_t ib = tid%8; // 0...7
1620
+ dst_t * y = yy + i*QK_K + 32*ib + 4*il;
1621
+ const uint8_t * q4 = x[i].qs + 16*ib + 4*il;
1622
+ const float d = (float)x[i].d * ((((x[i].scales_l[ib/2] >> 4*(ib%2)) & 0xf) | (((x[i].scales_h >> 2*ib) & 3) << 4)) - 32);
1623
+ #pragma unroll
1624
+ for (int j = 0; j < 4; ++j) {
1625
+ y[j+ 0] = d * kvalues_iq4nl[q4[j] & 0xf];
1626
+ y[j+16] = d * kvalues_iq4nl[q4[j] >> 4];
1627
+ }
1628
+ }
1629
+
1630
+ template<typename dst_t>
1631
+ static void dequantize_block_mxfp4(const void * __restrict__ vx, dst_t * __restrict__ yy,
1632
+ const sycl::nd_item<3> &item_ct1) {
1633
+ // auto item_ct1 = sycl::ext::oneapi::this_work_item::get_nd_item<3>();
1634
+ const int64_t i = item_ct1.get_group(2);
1635
+ const block_mxfp4 * x = (const block_mxfp4 *) vx + i*(QK_K/QK_MXFP4);
1636
+
1637
+ const int64_t tid = item_ct1.get_local_id(2);
1638
+ const int64_t il = tid/8; // 0...3
1639
+ const int64_t ib = tid%8; // 0...7
1640
+ dst_t * y = yy + i*QK_K + 32*ib + 4*il;
1641
+ const uint8_t * q4 = x[ib].qs + 4*il;
1642
+ const float d = ggml_sycl_e8m0_to_fp32(x[ib].e);
1643
+ for (int j = 0; j < 4; ++j) {
1644
+ y[j+ 0] = d * kvalues_mxfp4[q4[j] & 0xf]*0.5f;
1645
+ y[j+16] = d * kvalues_mxfp4[q4[j] >> 4]*0.5f;
1646
+ }
1647
+ }
1648
+
1649
+
1650
+ template <typename dst_t>
1651
+ static void dequantize_block_nvfp4(
1652
+ const void * __restrict__ vx,
1653
+ dst_t * __restrict__ yy,
1654
+ const int64_t ne) {
1655
+ auto item_ct1 = sycl::ext::oneapi::this_work_item::get_nd_item<3>();
1656
+ const int64_t i = item_ct1.get_group(2);
1657
+ const int tid = item_ct1.get_local_id(2);
1658
+
1659
+ const int64_t base = i * QK_NVFP4;
1660
+ if (base >= ne) {
1661
+ return;
1662
+ }
1663
+
1664
+ const block_nvfp4 * x = (const block_nvfp4 *) vx;
1665
+ const block_nvfp4 & xb = x[i];
1666
+
1667
+ const int sub = tid / (QK_NVFP4_SUB / 2);
1668
+ const int j = tid % (QK_NVFP4_SUB / 2);
1669
+
1670
+ const float d = ggml_sycl_ue4m3_to_fp32(xb.d[sub]);
1671
+ const uint8_t q = xb.qs[sub * (QK_NVFP4_SUB / 2) + j];
1672
+
1673
+ const int64_t y0 = base + sub * QK_NVFP4_SUB + j;
1674
+ const int64_t y1 = y0 + QK_NVFP4_SUB / 2;
1675
+
1676
+ yy[y0] = ggml_sycl_cast<dst_t>(d * kvalues_mxfp4[q & 0x0F]);
1677
+ yy[y1] = ggml_sycl_cast<dst_t>(d * kvalues_mxfp4[q >> 4]);
1678
+ }
1679
+
1680
+
1681
+ #endif // GGML_SYCL_DEQUANTIZE_HPP