cohere-transcribe 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 (480) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +21 -0
  3. data/LICENSE.txt +201 -0
  4. data/NOTICE +5 -0
  5. data/README.md +265 -0
  6. data/THIRD_PARTY_NOTICES.md +67 -0
  7. data/exe/cohere-transcribe +8 -0
  8. data/exe/cohere-transcribe-doctor +8 -0
  9. data/ext/cohere_transcribe_native/CMakeLists.txt +262 -0
  10. data/ext/cohere_transcribe_native/README.md +26 -0
  11. data/ext/cohere_transcribe_native/audio_abi.cpp +1416 -0
  12. data/ext/cohere_transcribe_native/audio_exports.macos +5 -0
  13. data/ext/cohere_transcribe_native/audio_exports.map +10 -0
  14. data/ext/cohere_transcribe_native/cohere_abi.cpp +1209 -0
  15. data/ext/cohere_transcribe_native/exports.macos +40 -0
  16. data/ext/cohere_transcribe_native/exports.map +45 -0
  17. data/ext/cohere_transcribe_native/extconf.rb +89 -0
  18. data/ext/cohere_transcribe_native/test/abi_smoke.rb +232 -0
  19. data/ext/cohere_transcribe_native/test/audio_matrix_smoke.cpp +121 -0
  20. data/ext/cohere_transcribe_native/test/audio_reliability_smoke.cpp +198 -0
  21. data/ext/cohere_transcribe_native/test/native_abi_reliability_smoke.cpp +186 -0
  22. data/ext/cohere_transcribe_native/test/native_batch_projection_probe.rb +81 -0
  23. data/ext/cohere_transcribe_native/test/native_cancellation_smoke.cpp +194 -0
  24. data/lib/cohere/transcribe/alignment/ATTRIBUTION.md +23 -0
  25. data/lib/cohere/transcribe/alignment/LICENSE.ctc-forced-aligner +407 -0
  26. data/lib/cohere/transcribe/alignment/LICENSE.torchaudio +25 -0
  27. data/lib/cohere/transcribe/alignment/LICENSE.uroman +26 -0
  28. data/lib/cohere/transcribe/alignment/aligner.rb +476 -0
  29. data/lib/cohere/transcribe/alignment/ctc.rb +224 -0
  30. data/lib/cohere/transcribe/alignment/text.rb +237 -0
  31. data/lib/cohere/transcribe/alignment/uroman_data.rb +4950 -0
  32. data/lib/cohere/transcribe/api.rb +173 -0
  33. data/lib/cohere/transcribe/asr/batching.rb +472 -0
  34. data/lib/cohere/transcribe/asr/failure_policy.rb +112 -0
  35. data/lib/cohere/transcribe/asr/native.rb +676 -0
  36. data/lib/cohere/transcribe/audio/ATTRIBUTION.md +8 -0
  37. data/lib/cohere/transcribe/audio/LICENSE.auditok +21 -0
  38. data/lib/cohere/transcribe/audio/decoder.rb +315 -0
  39. data/lib/cohere/transcribe/audio/ffmpeg_native.rb +248 -0
  40. data/lib/cohere/transcribe/audio/segmentation.rb +260 -0
  41. data/lib/cohere/transcribe/cli.rb +727 -0
  42. data/lib/cohere/transcribe/configuration.rb +282 -0
  43. data/lib/cohere/transcribe/constants.rb +14 -0
  44. data/lib/cohere/transcribe/dense_converter.rb +548 -0
  45. data/lib/cohere/transcribe/doctor.rb +576 -0
  46. data/lib/cohere/transcribe/errors.rb +57 -0
  47. data/lib/cohere/transcribe/gguf_writer.rb +268 -0
  48. data/lib/cohere/transcribe/hub.rb +436 -0
  49. data/lib/cohere/transcribe/input.rb +110 -0
  50. data/lib/cohere/transcribe/licenses/crispasr.txt +21 -0
  51. data/lib/cohere/transcribe/loader.rb +128 -0
  52. data/lib/cohere/transcribe/model_identity.rb +440 -0
  53. data/lib/cohere/transcribe/output/publication.rb +1118 -0
  54. data/lib/cohere/transcribe/output/rendering.rb +105 -0
  55. data/lib/cohere/transcribe/output/timing.rb +86 -0
  56. data/lib/cohere/transcribe/python_text.rb +70 -0
  57. data/lib/cohere/transcribe/pytorch_checkpoint.rb +1180 -0
  58. data/lib/cohere/transcribe/runtime/engine.rb +1676 -0
  59. data/lib/cohere/transcribe/runtime/model_provider.rb +390 -0
  60. data/lib/cohere/transcribe/runtime/precision.rb +57 -0
  61. data/lib/cohere/transcribe/runtime/preparation.rb +215 -0
  62. data/lib/cohere/transcribe/runtime/resources.rb +165 -0
  63. data/lib/cohere/transcribe/runtime/word_pipeline.rb +364 -0
  64. data/lib/cohere/transcribe/safetensors.rb +579 -0
  65. data/lib/cohere/transcribe/state/checkpoint.rb +224 -0
  66. data/lib/cohere/transcribe/state/contracts.rb +141 -0
  67. data/lib/cohere/transcribe/state/io.rb +727 -0
  68. data/lib/cohere/transcribe/state/locking.rb +211 -0
  69. data/lib/cohere/transcribe/state/manifest.rb +155 -0
  70. data/lib/cohere/transcribe/state.rb +7 -0
  71. data/lib/cohere/transcribe/types.rb +535 -0
  72. data/lib/cohere/transcribe/vad/ATTRIBUTION.md +14 -0
  73. data/lib/cohere/transcribe/vad/LICENSE.faster-whisper +21 -0
  74. data/lib/cohere/transcribe/vad/LICENSE.silero-vad +21 -0
  75. data/lib/cohere/transcribe/vad/silero.rb +344 -0
  76. data/lib/cohere/transcribe/vad/silero_vad_v6.onnx +0 -0
  77. data/lib/cohere/transcribe/vad/timestamps.rb +219 -0
  78. data/lib/cohere/transcribe/version.rb +7 -0
  79. data/lib/cohere/transcribe.rb +26 -0
  80. data/sig/cohere/transcribe.rbs +250 -0
  81. data/vendor/crispasr/AUTHORS +510 -0
  82. data/vendor/crispasr/LICENSE +21 -0
  83. data/vendor/crispasr/UPSTREAM.md +9 -0
  84. data/vendor/crispasr/VERSION +1 -0
  85. data/vendor/crispasr/ggml/AUTHORS +335 -0
  86. data/vendor/crispasr/ggml/CMakeLists.txt +512 -0
  87. data/vendor/crispasr/ggml/LICENSE +21 -0
  88. data/vendor/crispasr/ggml/README.md +49 -0
  89. data/vendor/crispasr/ggml/cmake/FindNCCL.cmake +36 -0
  90. data/vendor/crispasr/ggml/cmake/GitVars.cmake +22 -0
  91. data/vendor/crispasr/ggml/cmake/common.cmake +50 -0
  92. data/vendor/crispasr/ggml/cmake/ggml-config.cmake.in +191 -0
  93. data/vendor/crispasr/ggml/ggml.pc.in +10 -0
  94. data/vendor/crispasr/ggml/include/ggml-alloc.h +85 -0
  95. data/vendor/crispasr/ggml/include/ggml-backend.h +431 -0
  96. data/vendor/crispasr/ggml/include/ggml-blas.h +25 -0
  97. data/vendor/crispasr/ggml/include/ggml-cann.h +123 -0
  98. data/vendor/crispasr/ggml/include/ggml-cpp.h +39 -0
  99. data/vendor/crispasr/ggml/include/ggml-cpu.h +151 -0
  100. data/vendor/crispasr/ggml/include/ggml-cuda.h +50 -0
  101. data/vendor/crispasr/ggml/include/ggml-hexagon.h +19 -0
  102. data/vendor/crispasr/ggml/include/ggml-metal.h +61 -0
  103. data/vendor/crispasr/ggml/include/ggml-opencl.h +26 -0
  104. data/vendor/crispasr/ggml/include/ggml-openvino.h +37 -0
  105. data/vendor/crispasr/ggml/include/ggml-opt.h +256 -0
  106. data/vendor/crispasr/ggml/include/ggml-rpc.h +35 -0
  107. data/vendor/crispasr/ggml/include/ggml-sycl.h +49 -0
  108. data/vendor/crispasr/ggml/include/ggml-virtgpu.h +14 -0
  109. data/vendor/crispasr/ggml/include/ggml-vulkan.h +29 -0
  110. data/vendor/crispasr/ggml/include/ggml-webgpu.h +19 -0
  111. data/vendor/crispasr/ggml/include/ggml-zdnn.h +17 -0
  112. data/vendor/crispasr/ggml/include/ggml-zendnn.h +22 -0
  113. data/vendor/crispasr/ggml/include/ggml.h +2887 -0
  114. data/vendor/crispasr/ggml/include/gguf.h +204 -0
  115. data/vendor/crispasr/ggml/src/CMakeLists.txt +493 -0
  116. data/vendor/crispasr/ggml/src/ggml-alloc.c +1323 -0
  117. data/vendor/crispasr/ggml/src/ggml-backend-dl.cpp +48 -0
  118. data/vendor/crispasr/ggml/src/ggml-backend-dl.h +44 -0
  119. data/vendor/crispasr/ggml/src/ggml-backend-impl.h +275 -0
  120. data/vendor/crispasr/ggml/src/ggml-backend-meta.cpp +2145 -0
  121. data/vendor/crispasr/ggml/src/ggml-backend-reg.cpp +586 -0
  122. data/vendor/crispasr/ggml/src/ggml-backend.cpp +2437 -0
  123. data/vendor/crispasr/ggml/src/ggml-common.h +1900 -0
  124. data/vendor/crispasr/ggml/src/ggml-cpu/CMakeLists.txt +718 -0
  125. data/vendor/crispasr/ggml/src/ggml-cpu/amx/amx.cpp +249 -0
  126. data/vendor/crispasr/ggml/src/ggml-cpu/amx/amx.h +8 -0
  127. data/vendor/crispasr/ggml/src/ggml-cpu/amx/common.h +115 -0
  128. data/vendor/crispasr/ggml/src/ggml-cpu/amx/mmq.cpp +2512 -0
  129. data/vendor/crispasr/ggml/src/ggml-cpu/amx/mmq.h +10 -0
  130. data/vendor/crispasr/ggml/src/ggml-cpu/arch/arm/cpu-feats.cpp +98 -0
  131. data/vendor/crispasr/ggml/src/ggml-cpu/arch/arm/quants.c +4244 -0
  132. data/vendor/crispasr/ggml/src/ggml-cpu/arch/arm/repack.cpp +5156 -0
  133. data/vendor/crispasr/ggml/src/ggml-cpu/arch/loongarch/quants.c +2158 -0
  134. data/vendor/crispasr/ggml/src/ggml-cpu/arch/powerpc/cpu-feats.cpp +82 -0
  135. data/vendor/crispasr/ggml/src/ggml-cpu/arch/powerpc/quants.c +2304 -0
  136. data/vendor/crispasr/ggml/src/ggml-cpu/arch/riscv/cpu-feats.cpp +38 -0
  137. data/vendor/crispasr/ggml/src/ggml-cpu/arch/riscv/quants.c +4455 -0
  138. data/vendor/crispasr/ggml/src/ggml-cpu/arch/riscv/repack.cpp +1703 -0
  139. data/vendor/crispasr/ggml/src/ggml-cpu/arch/s390/cpu-feats.cpp +50 -0
  140. data/vendor/crispasr/ggml/src/ggml-cpu/arch/s390/quants.c +1465 -0
  141. data/vendor/crispasr/ggml/src/ggml-cpu/arch/wasm/quants.c +1220 -0
  142. data/vendor/crispasr/ggml/src/ggml-cpu/arch/x86/cpu-feats.cpp +327 -0
  143. data/vendor/crispasr/ggml/src/ggml-cpu/arch/x86/quants.c +3970 -0
  144. data/vendor/crispasr/ggml/src/ggml-cpu/arch/x86/repack.cpp +6407 -0
  145. data/vendor/crispasr/ggml/src/ggml-cpu/arch-fallback.h +349 -0
  146. data/vendor/crispasr/ggml/src/ggml-cpu/binary-ops.cpp +154 -0
  147. data/vendor/crispasr/ggml/src/ggml-cpu/binary-ops.h +16 -0
  148. data/vendor/crispasr/ggml/src/ggml-cpu/cmake/FindSIMD.cmake +100 -0
  149. data/vendor/crispasr/ggml/src/ggml-cpu/common.h +95 -0
  150. data/vendor/crispasr/ggml/src/ggml-cpu/ggml-cpu-impl.h +539 -0
  151. data/vendor/crispasr/ggml/src/ggml-cpu/ggml-cpu.c +3791 -0
  152. data/vendor/crispasr/ggml/src/ggml-cpu/ggml-cpu.cpp +703 -0
  153. data/vendor/crispasr/ggml/src/ggml-cpu/hbm.cpp +55 -0
  154. data/vendor/crispasr/ggml/src/ggml-cpu/hbm.h +8 -0
  155. data/vendor/crispasr/ggml/src/ggml-cpu/kleidiai/kernels.cpp +939 -0
  156. data/vendor/crispasr/ggml/src/ggml-cpu/kleidiai/kernels.h +90 -0
  157. data/vendor/crispasr/ggml/src/ggml-cpu/kleidiai/kleidiai.cpp +1513 -0
  158. data/vendor/crispasr/ggml/src/ggml-cpu/kleidiai/kleidiai.h +17 -0
  159. data/vendor/crispasr/ggml/src/ggml-cpu/llamafile/sgemm.cpp +4051 -0
  160. data/vendor/crispasr/ggml/src/ggml-cpu/llamafile/sgemm.h +25 -0
  161. data/vendor/crispasr/ggml/src/ggml-cpu/ops.cpp +11662 -0
  162. data/vendor/crispasr/ggml/src/ggml-cpu/ops.h +121 -0
  163. data/vendor/crispasr/ggml/src/ggml-cpu/quants.c +1288 -0
  164. data/vendor/crispasr/ggml/src/ggml-cpu/quants.h +103 -0
  165. data/vendor/crispasr/ggml/src/ggml-cpu/repack.cpp +4836 -0
  166. data/vendor/crispasr/ggml/src/ggml-cpu/repack.h +245 -0
  167. data/vendor/crispasr/ggml/src/ggml-cpu/simd-gemm.h +226 -0
  168. data/vendor/crispasr/ggml/src/ggml-cpu/simd-mappings.h +1329 -0
  169. data/vendor/crispasr/ggml/src/ggml-cpu/spacemit/ime.cpp +1025 -0
  170. data/vendor/crispasr/ggml/src/ggml-cpu/spacemit/ime.h +13 -0
  171. data/vendor/crispasr/ggml/src/ggml-cpu/spacemit/ime1_kernels.cpp +3196 -0
  172. data/vendor/crispasr/ggml/src/ggml-cpu/spacemit/ime_kernels.h +26 -0
  173. data/vendor/crispasr/ggml/src/ggml-cpu/traits.cpp +36 -0
  174. data/vendor/crispasr/ggml/src/ggml-cpu/traits.h +38 -0
  175. data/vendor/crispasr/ggml/src/ggml-cpu/unary-ops.cpp +336 -0
  176. data/vendor/crispasr/ggml/src/ggml-cpu/unary-ops.h +35 -0
  177. data/vendor/crispasr/ggml/src/ggml-cpu/vec.cpp +681 -0
  178. data/vendor/crispasr/ggml/src/ggml-cpu/vec.h +1606 -0
  179. data/vendor/crispasr/ggml/src/ggml-cuda/CMakeLists.txt +272 -0
  180. data/vendor/crispasr/ggml/src/ggml-cuda/acc.cu +61 -0
  181. data/vendor/crispasr/ggml/src/ggml-cuda/acc.cuh +5 -0
  182. data/vendor/crispasr/ggml/src/ggml-cuda/add-id.cu +58 -0
  183. data/vendor/crispasr/ggml/src/ggml-cuda/add-id.cuh +3 -0
  184. data/vendor/crispasr/ggml/src/ggml-cuda/arange.cu +34 -0
  185. data/vendor/crispasr/ggml/src/ggml-cuda/arange.cuh +5 -0
  186. data/vendor/crispasr/ggml/src/ggml-cuda/argmax.cu +91 -0
  187. data/vendor/crispasr/ggml/src/ggml-cuda/argmax.cuh +3 -0
  188. data/vendor/crispasr/ggml/src/ggml-cuda/argsort.cu +265 -0
  189. data/vendor/crispasr/ggml/src/ggml-cuda/argsort.cuh +19 -0
  190. data/vendor/crispasr/ggml/src/ggml-cuda/binbcast.cu +534 -0
  191. data/vendor/crispasr/ggml/src/ggml-cuda/binbcast.cuh +12 -0
  192. data/vendor/crispasr/ggml/src/ggml-cuda/clamp.cu +45 -0
  193. data/vendor/crispasr/ggml/src/ggml-cuda/clamp.cuh +5 -0
  194. data/vendor/crispasr/ggml/src/ggml-cuda/col2im-1d.cu +81 -0
  195. data/vendor/crispasr/ggml/src/ggml-cuda/col2im-1d.cuh +3 -0
  196. data/vendor/crispasr/ggml/src/ggml-cuda/common.cuh +1489 -0
  197. data/vendor/crispasr/ggml/src/ggml-cuda/concat.cu +204 -0
  198. data/vendor/crispasr/ggml/src/ggml-cuda/concat.cuh +5 -0
  199. data/vendor/crispasr/ggml/src/ggml-cuda/conv-transpose-1d.cu +97 -0
  200. data/vendor/crispasr/ggml/src/ggml-cuda/conv-transpose-1d.cuh +5 -0
  201. data/vendor/crispasr/ggml/src/ggml-cuda/conv2d-dw.cu +161 -0
  202. data/vendor/crispasr/ggml/src/ggml-cuda/conv2d-dw.cuh +5 -0
  203. data/vendor/crispasr/ggml/src/ggml-cuda/conv2d-transpose.cu +115 -0
  204. data/vendor/crispasr/ggml/src/ggml-cuda/conv2d-transpose.cuh +5 -0
  205. data/vendor/crispasr/ggml/src/ggml-cuda/conv2d.cu +166 -0
  206. data/vendor/crispasr/ggml/src/ggml-cuda/conv2d.cuh +5 -0
  207. data/vendor/crispasr/ggml/src/ggml-cuda/convert.cu +892 -0
  208. data/vendor/crispasr/ggml/src/ggml-cuda/convert.cuh +66 -0
  209. data/vendor/crispasr/ggml/src/ggml-cuda/count-equal.cu +64 -0
  210. data/vendor/crispasr/ggml/src/ggml-cuda/count-equal.cuh +5 -0
  211. data/vendor/crispasr/ggml/src/ggml-cuda/cp-async.cuh +57 -0
  212. data/vendor/crispasr/ggml/src/ggml-cuda/cpy-utils.cuh +217 -0
  213. data/vendor/crispasr/ggml/src/ggml-cuda/cpy.cu +581 -0
  214. data/vendor/crispasr/ggml/src/ggml-cuda/cpy.cuh +7 -0
  215. data/vendor/crispasr/ggml/src/ggml-cuda/cross-entropy-loss.cu +177 -0
  216. data/vendor/crispasr/ggml/src/ggml-cuda/cross-entropy-loss.cuh +7 -0
  217. data/vendor/crispasr/ggml/src/ggml-cuda/cumsum.cu +307 -0
  218. data/vendor/crispasr/ggml/src/ggml-cuda/cumsum.cuh +5 -0
  219. data/vendor/crispasr/ggml/src/ggml-cuda/dequantize.cuh +99 -0
  220. data/vendor/crispasr/ggml/src/ggml-cuda/diag.cu +77 -0
  221. data/vendor/crispasr/ggml/src/ggml-cuda/diag.cuh +5 -0
  222. data/vendor/crispasr/ggml/src/ggml-cuda/diagmask.cu +40 -0
  223. data/vendor/crispasr/ggml/src/ggml-cuda/diagmask.cuh +5 -0
  224. data/vendor/crispasr/ggml/src/ggml-cuda/fattn-common.cuh +1212 -0
  225. data/vendor/crispasr/ggml/src/ggml-cuda/fattn-mma-f16.cuh +1860 -0
  226. data/vendor/crispasr/ggml/src/ggml-cuda/fattn-tile.cu +57 -0
  227. data/vendor/crispasr/ggml/src/ggml-cuda/fattn-tile.cuh +1309 -0
  228. data/vendor/crispasr/ggml/src/ggml-cuda/fattn-vec.cuh +600 -0
  229. data/vendor/crispasr/ggml/src/ggml-cuda/fattn-wmma-f16.cu +696 -0
  230. data/vendor/crispasr/ggml/src/ggml-cuda/fattn-wmma-f16.cuh +51 -0
  231. data/vendor/crispasr/ggml/src/ggml-cuda/fattn.cu +620 -0
  232. data/vendor/crispasr/ggml/src/ggml-cuda/fattn.cuh +5 -0
  233. data/vendor/crispasr/ggml/src/ggml-cuda/fill.cu +37 -0
  234. data/vendor/crispasr/ggml/src/ggml-cuda/fill.cuh +3 -0
  235. data/vendor/crispasr/ggml/src/ggml-cuda/gated_delta_net.cu +273 -0
  236. data/vendor/crispasr/ggml/src/ggml-cuda/gated_delta_net.cuh +4 -0
  237. data/vendor/crispasr/ggml/src/ggml-cuda/getrows.cu +332 -0
  238. data/vendor/crispasr/ggml/src/ggml-cuda/getrows.cuh +15 -0
  239. data/vendor/crispasr/ggml/src/ggml-cuda/ggml-cuda.cu +5580 -0
  240. data/vendor/crispasr/ggml/src/ggml-cuda/gla.cu +93 -0
  241. data/vendor/crispasr/ggml/src/ggml-cuda/gla.cuh +3 -0
  242. data/vendor/crispasr/ggml/src/ggml-cuda/im2col.cu +274 -0
  243. data/vendor/crispasr/ggml/src/ggml-cuda/im2col.cuh +6 -0
  244. data/vendor/crispasr/ggml/src/ggml-cuda/mean.cu +75 -0
  245. data/vendor/crispasr/ggml/src/ggml-cuda/mean.cuh +3 -0
  246. data/vendor/crispasr/ggml/src/ggml-cuda/mma.cuh +1333 -0
  247. data/vendor/crispasr/ggml/src/ggml-cuda/mmf.cu +191 -0
  248. data/vendor/crispasr/ggml/src/ggml-cuda/mmf.cuh +908 -0
  249. data/vendor/crispasr/ggml/src/ggml-cuda/mmid.cu +164 -0
  250. data/vendor/crispasr/ggml/src/ggml-cuda/mmid.cuh +5 -0
  251. data/vendor/crispasr/ggml/src/ggml-cuda/mmq.cu +372 -0
  252. data/vendor/crispasr/ggml/src/ggml-cuda/mmq.cuh +4175 -0
  253. data/vendor/crispasr/ggml/src/ggml-cuda/mmvf.cu +862 -0
  254. data/vendor/crispasr/ggml/src/ggml-cuda/mmvf.cuh +14 -0
  255. data/vendor/crispasr/ggml/src/ggml-cuda/mmvq.cu +1161 -0
  256. data/vendor/crispasr/ggml/src/ggml-cuda/mmvq.cuh +16 -0
  257. data/vendor/crispasr/ggml/src/ggml-cuda/norm.cu +756 -0
  258. data/vendor/crispasr/ggml/src/ggml-cuda/norm.cuh +20 -0
  259. data/vendor/crispasr/ggml/src/ggml-cuda/opt-step-adamw.cu +78 -0
  260. data/vendor/crispasr/ggml/src/ggml-cuda/opt-step-adamw.cuh +5 -0
  261. data/vendor/crispasr/ggml/src/ggml-cuda/opt-step-sgd.cu +49 -0
  262. data/vendor/crispasr/ggml/src/ggml-cuda/opt-step-sgd.cuh +5 -0
  263. data/vendor/crispasr/ggml/src/ggml-cuda/out-prod.cu +68 -0
  264. data/vendor/crispasr/ggml/src/ggml-cuda/out-prod.cuh +3 -0
  265. data/vendor/crispasr/ggml/src/ggml-cuda/pad.cu +106 -0
  266. data/vendor/crispasr/ggml/src/ggml-cuda/pad.cuh +5 -0
  267. data/vendor/crispasr/ggml/src/ggml-cuda/pad_reflect_1d.cu +91 -0
  268. data/vendor/crispasr/ggml/src/ggml-cuda/pad_reflect_1d.cuh +5 -0
  269. data/vendor/crispasr/ggml/src/ggml-cuda/pool2d.cu +94 -0
  270. data/vendor/crispasr/ggml/src/ggml-cuda/pool2d.cuh +5 -0
  271. data/vendor/crispasr/ggml/src/ggml-cuda/quantize.cu +443 -0
  272. data/vendor/crispasr/ggml/src/ggml-cuda/quantize.cuh +41 -0
  273. data/vendor/crispasr/ggml/src/ggml-cuda/reduce_rows.cuh +39 -0
  274. data/vendor/crispasr/ggml/src/ggml-cuda/roll.cu +67 -0
  275. data/vendor/crispasr/ggml/src/ggml-cuda/roll.cuh +5 -0
  276. data/vendor/crispasr/ggml/src/ggml-cuda/rope.cu +665 -0
  277. data/vendor/crispasr/ggml/src/ggml-cuda/rope.cuh +9 -0
  278. data/vendor/crispasr/ggml/src/ggml-cuda/scale.cu +34 -0
  279. data/vendor/crispasr/ggml/src/ggml-cuda/scale.cuh +5 -0
  280. data/vendor/crispasr/ggml/src/ggml-cuda/set-rows.cu +330 -0
  281. data/vendor/crispasr/ggml/src/ggml-cuda/set-rows.cuh +7 -0
  282. data/vendor/crispasr/ggml/src/ggml-cuda/set.cu +39 -0
  283. data/vendor/crispasr/ggml/src/ggml-cuda/set.cuh +7 -0
  284. data/vendor/crispasr/ggml/src/ggml-cuda/softcap.cu +34 -0
  285. data/vendor/crispasr/ggml/src/ggml-cuda/softcap.cuh +5 -0
  286. data/vendor/crispasr/ggml/src/ggml-cuda/softmax.cu +472 -0
  287. data/vendor/crispasr/ggml/src/ggml-cuda/softmax.cuh +7 -0
  288. data/vendor/crispasr/ggml/src/ggml-cuda/solve_tri.cu +275 -0
  289. data/vendor/crispasr/ggml/src/ggml-cuda/solve_tri.cuh +3 -0
  290. data/vendor/crispasr/ggml/src/ggml-cuda/ssm-conv.cu +197 -0
  291. data/vendor/crispasr/ggml/src/ggml-cuda/ssm-conv.cuh +3 -0
  292. data/vendor/crispasr/ggml/src/ggml-cuda/ssm-scan.cu +342 -0
  293. data/vendor/crispasr/ggml/src/ggml-cuda/ssm-scan.cuh +3 -0
  294. data/vendor/crispasr/ggml/src/ggml-cuda/sum.cu +41 -0
  295. data/vendor/crispasr/ggml/src/ggml-cuda/sum.cuh +5 -0
  296. data/vendor/crispasr/ggml/src/ggml-cuda/sumrows.cu +43 -0
  297. data/vendor/crispasr/ggml/src/ggml-cuda/sumrows.cuh +4 -0
  298. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_1-ncols2_16.cu +5 -0
  299. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_1-ncols2_32.cu +6 -0
  300. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_1-ncols2_8.cu +11 -0
  301. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_16-ncols2_1.cu +10 -0
  302. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_16-ncols2_2.cu +10 -0
  303. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_16-ncols2_4.cu +12 -0
  304. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_2-ncols2_16.cu +5 -0
  305. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_2-ncols2_32.cu +6 -0
  306. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_2-ncols2_4.cu +12 -0
  307. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_2-ncols2_8.cu +11 -0
  308. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_32-ncols2_1.cu +10 -0
  309. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_32-ncols2_2.cu +10 -0
  310. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_4-ncols2_16.cu +5 -0
  311. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_4-ncols2_2.cu +10 -0
  312. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_4-ncols2_4.cu +12 -0
  313. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_4-ncols2_8.cu +11 -0
  314. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_64-ncols2_1.cu +10 -0
  315. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_8-ncols2_1.cu +10 -0
  316. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_8-ncols2_2.cu +10 -0
  317. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_8-ncols2_4.cu +12 -0
  318. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_8-ncols2_8.cu +11 -0
  319. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-tile-instance-dkq112-dv112.cu +5 -0
  320. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-tile-instance-dkq128-dv128.cu +5 -0
  321. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-tile-instance-dkq256-dv256.cu +5 -0
  322. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-tile-instance-dkq320-dv256.cu +5 -0
  323. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-tile-instance-dkq40-dv40.cu +5 -0
  324. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-tile-instance-dkq512-dv512.cu +5 -0
  325. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-tile-instance-dkq576-dv512.cu +5 -0
  326. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-tile-instance-dkq64-dv64.cu +5 -0
  327. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-tile-instance-dkq72-dv72.cu +5 -0
  328. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-tile-instance-dkq80-dv80.cu +5 -0
  329. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-tile-instance-dkq96-dv96.cu +5 -0
  330. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-bf16-bf16.cu +7 -0
  331. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-bf16-f16.cu +7 -0
  332. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-bf16-q4_0.cu +7 -0
  333. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-bf16-q4_1.cu +7 -0
  334. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-bf16-q5_0.cu +7 -0
  335. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-bf16-q5_1.cu +7 -0
  336. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-bf16-q8_0.cu +7 -0
  337. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-f16-bf16.cu +7 -0
  338. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-f16-f16.cu +7 -0
  339. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-f16-q4_0.cu +7 -0
  340. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-f16-q4_1.cu +7 -0
  341. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-f16-q5_0.cu +7 -0
  342. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-f16-q5_1.cu +7 -0
  343. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-f16-q8_0.cu +7 -0
  344. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_0-bf16.cu +7 -0
  345. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_0-f16.cu +7 -0
  346. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_0-q4_0.cu +7 -0
  347. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_0-q4_1.cu +7 -0
  348. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_0-q5_0.cu +7 -0
  349. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_0-q5_1.cu +7 -0
  350. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_0-q8_0.cu +7 -0
  351. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_1-bf16.cu +7 -0
  352. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_1-f16.cu +7 -0
  353. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_1-q4_0.cu +7 -0
  354. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_1-q4_1.cu +7 -0
  355. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_1-q5_0.cu +7 -0
  356. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_1-q5_1.cu +7 -0
  357. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_1-q8_0.cu +7 -0
  358. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_0-bf16.cu +7 -0
  359. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_0-f16.cu +7 -0
  360. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_0-q4_0.cu +7 -0
  361. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_0-q4_1.cu +7 -0
  362. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_0-q5_0.cu +7 -0
  363. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_0-q5_1.cu +7 -0
  364. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_0-q8_0.cu +7 -0
  365. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_1-bf16.cu +7 -0
  366. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_1-f16.cu +7 -0
  367. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_1-q4_0.cu +7 -0
  368. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_1-q4_1.cu +7 -0
  369. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_1-q5_0.cu +7 -0
  370. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_1-q5_1.cu +7 -0
  371. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_1-q8_0.cu +7 -0
  372. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q8_0-bf16.cu +7 -0
  373. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q8_0-f16.cu +7 -0
  374. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q8_0-q4_0.cu +7 -0
  375. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q8_0-q4_1.cu +7 -0
  376. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q8_0-q5_0.cu +7 -0
  377. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q8_0-q5_1.cu +7 -0
  378. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q8_0-q8_0.cu +7 -0
  379. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_1.cu +5 -0
  380. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_10.cu +5 -0
  381. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_11.cu +5 -0
  382. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_12.cu +5 -0
  383. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_13.cu +5 -0
  384. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_14.cu +5 -0
  385. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_15.cu +5 -0
  386. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_16.cu +5 -0
  387. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_2.cu +5 -0
  388. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_3.cu +5 -0
  389. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_4.cu +5 -0
  390. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_5.cu +5 -0
  391. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_6.cu +5 -0
  392. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_7.cu +5 -0
  393. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_8.cu +5 -0
  394. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_9.cu +5 -0
  395. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmq-instance-iq1_s.cu +5 -0
  396. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmq-instance-iq2_s.cu +5 -0
  397. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmq-instance-iq2_xs.cu +5 -0
  398. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmq-instance-iq2_xxs.cu +5 -0
  399. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmq-instance-iq3_s.cu +5 -0
  400. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmq-instance-iq3_xxs.cu +5 -0
  401. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmq-instance-iq4_nl.cu +5 -0
  402. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmq-instance-iq4_xs.cu +5 -0
  403. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmq-instance-mxfp4.cu +5 -0
  404. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmq-instance-nvfp4.cu +5 -0
  405. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmq-instance-q1_0.cu +5 -0
  406. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmq-instance-q2_k.cu +5 -0
  407. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmq-instance-q3_k.cu +5 -0
  408. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmq-instance-q4_0.cu +5 -0
  409. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmq-instance-q4_1.cu +5 -0
  410. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmq-instance-q4_k.cu +5 -0
  411. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmq-instance-q5_0.cu +5 -0
  412. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmq-instance-q5_1.cu +5 -0
  413. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmq-instance-q5_k.cu +5 -0
  414. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmq-instance-q6_k.cu +5 -0
  415. data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmq-instance-q8_0.cu +5 -0
  416. data/vendor/crispasr/ggml/src/ggml-cuda/top-k.cu +95 -0
  417. data/vendor/crispasr/ggml/src/ggml-cuda/top-k.cuh +3 -0
  418. data/vendor/crispasr/ggml/src/ggml-cuda/topk-moe.cu +415 -0
  419. data/vendor/crispasr/ggml/src/ggml-cuda/topk-moe.cuh +27 -0
  420. data/vendor/crispasr/ggml/src/ggml-cuda/tri.cu +136 -0
  421. data/vendor/crispasr/ggml/src/ggml-cuda/tri.cuh +5 -0
  422. data/vendor/crispasr/ggml/src/ggml-cuda/tsembd.cu +47 -0
  423. data/vendor/crispasr/ggml/src/ggml-cuda/tsembd.cuh +5 -0
  424. data/vendor/crispasr/ggml/src/ggml-cuda/unary.cu +644 -0
  425. data/vendor/crispasr/ggml/src/ggml-cuda/unary.cuh +116 -0
  426. data/vendor/crispasr/ggml/src/ggml-cuda/upscale.cu +293 -0
  427. data/vendor/crispasr/ggml/src/ggml-cuda/upscale.cuh +5 -0
  428. data/vendor/crispasr/ggml/src/ggml-cuda/vecdotq.cuh +1317 -0
  429. data/vendor/crispasr/ggml/src/ggml-cuda/vendors/cuda.h +28 -0
  430. data/vendor/crispasr/ggml/src/ggml-cuda/vendors/hip.h +306 -0
  431. data/vendor/crispasr/ggml/src/ggml-cuda/vendors/musa.h +148 -0
  432. data/vendor/crispasr/ggml/src/ggml-cuda/wkv.cu +199 -0
  433. data/vendor/crispasr/ggml/src/ggml-cuda/wkv.cuh +7 -0
  434. data/vendor/crispasr/ggml/src/ggml-impl.h +783 -0
  435. data/vendor/crispasr/ggml/src/ggml-metal/CMakeLists.txt +124 -0
  436. data/vendor/crispasr/ggml/src/ggml-metal/ggml-metal-common.cpp +457 -0
  437. data/vendor/crispasr/ggml/src/ggml-metal/ggml-metal-common.h +52 -0
  438. data/vendor/crispasr/ggml/src/ggml-metal/ggml-metal-context.h +41 -0
  439. data/vendor/crispasr/ggml/src/ggml-metal/ggml-metal-context.m +778 -0
  440. data/vendor/crispasr/ggml/src/ggml-metal/ggml-metal-device.cpp +2117 -0
  441. data/vendor/crispasr/ggml/src/ggml-metal/ggml-metal-device.h +299 -0
  442. data/vendor/crispasr/ggml/src/ggml-metal/ggml-metal-device.m +2093 -0
  443. data/vendor/crispasr/ggml/src/ggml-metal/ggml-metal-impl.h +1267 -0
  444. data/vendor/crispasr/ggml/src/ggml-metal/ggml-metal-ops.cpp +5023 -0
  445. data/vendor/crispasr/ggml/src/ggml-metal/ggml-metal-ops.h +111 -0
  446. data/vendor/crispasr/ggml/src/ggml-metal/ggml-metal.cpp +954 -0
  447. data/vendor/crispasr/ggml/src/ggml-metal/ggml-metal.metal +11756 -0
  448. data/vendor/crispasr/ggml/src/ggml-opt.cpp +1094 -0
  449. data/vendor/crispasr/ggml/src/ggml-quants.c +5491 -0
  450. data/vendor/crispasr/ggml/src/ggml-quants.h +112 -0
  451. data/vendor/crispasr/ggml/src/ggml-threading.cpp +12 -0
  452. data/vendor/crispasr/ggml/src/ggml-threading.h +14 -0
  453. data/vendor/crispasr/ggml/src/ggml.c +7925 -0
  454. data/vendor/crispasr/ggml/src/ggml.cpp +26 -0
  455. data/vendor/crispasr/ggml/src/gguf.cpp +1556 -0
  456. data/vendor/crispasr/src/cohere-arch.h +137 -0
  457. data/vendor/crispasr/src/cohere.cpp +5642 -0
  458. data/vendor/crispasr/src/cohere.h +327 -0
  459. data/vendor/crispasr/src/cohere_batch_planner.h +82 -0
  460. data/vendor/crispasr/src/cohere_chunking.h +64 -0
  461. data/vendor/crispasr/src/cohere_decoder_batch_layout.h +60 -0
  462. data/vendor/crispasr/src/cohere_encoder_padded_layout.h +27 -0
  463. data/vendor/crispasr/src/cohere_frontend.cpp +189 -0
  464. data/vendor/crispasr/src/cohere_frontend.h +31 -0
  465. data/vendor/crispasr/src/cohere_ragged_controller.h +149 -0
  466. data/vendor/crispasr/src/cohere_token_renderer.h +181 -0
  467. data/vendor/crispasr/src/core/attention.h +924 -0
  468. data/vendor/crispasr/src/core/audio_chunking.h +97 -0
  469. data/vendor/crispasr/src/core/beam_decode.h +486 -0
  470. data/vendor/crispasr/src/core/cpu_ops.h +135 -0
  471. data/vendor/crispasr/src/core/gguf_loader.cpp +1021 -0
  472. data/vendor/crispasr/src/core/gguf_loader.h +216 -0
  473. data/vendor/crispasr/src/core/gpu_backend_pref.h +119 -0
  474. data/vendor/crispasr/src/core/mel.cpp +519 -0
  475. data/vendor/crispasr/src/core/mel.h +265 -0
  476. data/vendor/crispasr/src/core/ngram_loop_fix.h +173 -0
  477. data/vendor/crispasr/src/core/repetition_loop_guard.h +54 -0
  478. data/vendor/crispasr/src/crispasr_imatrix.cpp +255 -0
  479. data/vendor/crispasr/src/crispasr_imatrix.h +38 -0
  480. metadata +596 -0
@@ -0,0 +1,1267 @@
1
+ #ifndef GGML_METAL_IMPL
2
+ #define GGML_METAL_IMPL
3
+
4
+ // kernel parameters for mat-mat threadgroups
5
+ //
6
+ // TODO: become function constants
7
+
8
+ #define SZ_SIMDGROUP 16
9
+ #define N_MM_NK 2
10
+ #define N_MM_NK_TOTAL (SZ_SIMDGROUP * N_MM_NK)
11
+
12
+ #define N_MM_BLOCK_X 4
13
+ #define N_MM_BLOCK_Y 2
14
+ #define N_MM_SIMD_GROUP_X 2
15
+ #define N_MM_SIMD_GROUP_Y 2
16
+
17
+ // kernel parameters for mat-vec threadgroups
18
+ //
19
+ // N_R0: number of src0 rows to process per simdgroup
20
+ // N_SG: number of simdgroups per threadgroup
21
+ //
22
+ // TODO: for optimal performance, become function of the device and work size
23
+
24
+ #define N_R0_Q1_0 8
25
+ #define N_SG_Q1_0 2
26
+
27
+ #define N_R0_Q4_0 4
28
+ #define N_SG_Q4_0 2
29
+
30
+ #define N_R0_Q4_1 4
31
+ #define N_SG_Q4_1 2
32
+
33
+ #define N_R0_Q5_0 4
34
+ #define N_SG_Q5_0 2
35
+
36
+ #define N_R0_Q5_1 4
37
+ #define N_SG_Q5_1 2
38
+
39
+ #define N_R0_Q8_0 2
40
+ #define N_SG_Q8_0 4
41
+
42
+ #define N_R0_MXFP4 2
43
+ #define N_SG_MXFP4 2
44
+
45
+ #define N_R0_Q2_K 4
46
+ #define N_SG_Q2_K 2
47
+
48
+ #define N_R0_Q3_K 2
49
+ #define N_SG_Q3_K 2
50
+
51
+ #define N_R0_Q4_K 2
52
+ #define N_SG_Q4_K 2
53
+
54
+ #define N_R0_Q5_K 1
55
+ #define N_SG_Q5_K 2
56
+
57
+ #define N_R0_Q6_K 2
58
+ #define N_SG_Q6_K 2
59
+
60
+ #define N_R0_IQ1_S 4
61
+ #define N_SG_IQ1_S 2
62
+
63
+ #define N_R0_IQ1_M 4
64
+ #define N_SG_IQ1_M 2
65
+
66
+ #define N_R0_IQ2_XXS 4
67
+ #define N_SG_IQ2_XXS 2
68
+
69
+ #define N_R0_IQ2_XS 4
70
+ #define N_SG_IQ2_XS 2
71
+
72
+ #define N_R0_IQ2_S 4
73
+ #define N_SG_IQ2_S 2
74
+
75
+ #define N_R0_IQ3_XXS 4
76
+ #define N_SG_IQ3_XXS 2
77
+
78
+ #define N_R0_IQ3_S 4
79
+ #define N_SG_IQ3_S 2
80
+
81
+ #define N_R0_IQ4_NL 2
82
+ #define N_SG_IQ4_NL 2
83
+
84
+ #define N_R0_IQ4_XS 2
85
+ #define N_SG_IQ4_XS 2
86
+
87
+ // function constants offsets
88
+ #define FC_FLASH_ATTN_EXT_PAD 100
89
+ #define FC_FLASH_ATTN_EXT_BLK 200
90
+ #define FC_FLASH_ATTN_EXT 300
91
+ #define FC_FLASH_ATTN_EXT_VEC 400
92
+ #define FC_FLASH_ATTN_EXT_VEC_REDUCE 500
93
+ #define FC_MUL_MV 600
94
+ #define FC_MUL_MM 700
95
+ #define FC_ROPE 800
96
+ #define FC_SSM_CONV 900
97
+ #define FC_SOLVE_TRI 1000
98
+ #define FC_COUNT_EQUAL 1100
99
+ #define FC_UNARY 1200
100
+ #define FC_BIN 1300
101
+ #define FC_SUM_ROWS 1400
102
+ #define FC_UPSCALE 1500
103
+ #define FC_GATED_DELTA_NET 1600
104
+
105
+ // op-specific constants
106
+ #define OP_FLASH_ATTN_EXT_NQPSG 8
107
+ #define OP_FLASH_ATTN_EXT_NCPSG 64
108
+
109
+ #define OP_FLASH_ATTN_EXT_VEC_NQPSG 1
110
+ #define OP_FLASH_ATTN_EXT_VEC_NCPSG 32
111
+
112
+ #define OP_UNARY_NUM_SCALE 10
113
+ #define OP_UNARY_NUM_FILL 11
114
+ #define OP_UNARY_NUM_CLAMP 12
115
+ #define OP_UNARY_NUM_SQR 13
116
+ #define OP_UNARY_NUM_SQRT 14
117
+ #define OP_UNARY_NUM_SIN 15
118
+ #define OP_UNARY_NUM_COS 16
119
+ #define OP_UNARY_NUM_LOG 17
120
+ #define OP_UNARY_NUM_LEAKY_RELU 18
121
+
122
+ #define OP_UNARY_NUM_TANH 100
123
+ #define OP_UNARY_NUM_RELU 101
124
+ #define OP_UNARY_NUM_SIGMOID 102
125
+ #define OP_UNARY_NUM_GELU 103
126
+ #define OP_UNARY_NUM_GELU_ERF 104
127
+ #define OP_UNARY_NUM_GELU_QUICK 105
128
+ #define OP_UNARY_NUM_SILU 106
129
+ #define OP_UNARY_NUM_ELU 107
130
+ #define OP_UNARY_NUM_NEG 108
131
+ #define OP_UNARY_NUM_ABS 109
132
+ #define OP_UNARY_NUM_SGN 110
133
+ #define OP_UNARY_NUM_STEP 111
134
+ #define OP_UNARY_NUM_HARDSWISH 112
135
+ #define OP_UNARY_NUM_HARDSIGMOID 113
136
+ #define OP_UNARY_NUM_EXP 114
137
+ #define OP_UNARY_NUM_SOFTPLUS 115
138
+ #define OP_UNARY_NUM_EXPM1 116
139
+ #define OP_UNARY_NUM_FLOOR 117
140
+ #define OP_UNARY_NUM_CEIL 118
141
+ #define OP_UNARY_NUM_ROUND 119
142
+ #define OP_UNARY_NUM_TRUNC 120
143
+ #define OP_UNARY_NUM_XIELU 121
144
+
145
+ #define OP_SUM_ROWS_NUM_SUM_ROWS 10
146
+ #define OP_SUM_ROWS_NUM_MEAN 11
147
+
148
+ // kernel argument structs
149
+ //
150
+ // - element counters (e.g. ne00) typically use int32_t to reduce register usage
151
+ // however, be careful from int overflows when using those in the kernel implementation
152
+ //
153
+ // - strides (e.g. nb00) use uint64_t
154
+
155
+ typedef struct {
156
+ int32_t ne00;
157
+ int32_t ne01;
158
+ int32_t ne02;
159
+ int32_t ne03;
160
+ uint64_t nb00;
161
+ uint64_t nb01;
162
+ uint64_t nb02;
163
+ uint64_t nb03;
164
+ int32_t ne10;
165
+ int32_t ne11;
166
+ int32_t ne12;
167
+ int32_t ne13;
168
+ uint64_t nb10;
169
+ uint64_t nb11;
170
+ uint64_t nb12;
171
+ uint64_t nb13;
172
+ int32_t ne0;
173
+ int32_t ne1;
174
+ int32_t ne2;
175
+ int32_t ne3;
176
+ uint64_t nb0;
177
+ uint64_t nb1;
178
+ uint64_t nb2;
179
+ uint64_t nb3;
180
+ int32_t dim;
181
+ } ggml_metal_kargs_concat;
182
+
183
+ typedef struct {
184
+ int32_t ne00;
185
+ int32_t ne01;
186
+ int32_t ne02;
187
+ int32_t ne03;
188
+ uint64_t nb00;
189
+ uint64_t nb01;
190
+ uint64_t nb02;
191
+ uint64_t nb03;
192
+ int32_t ne0;
193
+ int32_t ne1;
194
+ int32_t ne2;
195
+ int32_t ne3;
196
+ uint64_t nb0;
197
+ uint64_t nb1;
198
+ uint64_t nb2;
199
+ uint64_t nb3;
200
+ float slope;
201
+ float scale;
202
+ float bias;
203
+ float val;
204
+ float min;
205
+ float max;
206
+ } ggml_metal_kargs_unary;
207
+
208
+ typedef struct {
209
+ int32_t ne00;
210
+ int32_t ne01;
211
+ int32_t ne02;
212
+ int32_t ne03;
213
+ uint64_t nb00;
214
+ uint64_t nb01;
215
+ uint64_t nb02;
216
+ uint64_t nb03;
217
+ int32_t ne10;
218
+ int32_t ne11;
219
+ int32_t ne12;
220
+ int32_t ne13;
221
+ uint64_t nb10;
222
+ uint64_t nb11;
223
+ uint64_t nb12;
224
+ uint64_t nb13;
225
+ int32_t ne0;
226
+ int32_t ne1;
227
+ int32_t ne2;
228
+ int32_t ne3;
229
+ uint64_t nb0;
230
+ uint64_t nb1;
231
+ uint64_t nb2;
232
+ uint64_t nb3;
233
+ uint64_t offs;
234
+ uint64_t o1[8];
235
+ } ggml_metal_kargs_bin;
236
+
237
+ typedef struct {
238
+ int64_t ne0;
239
+ int64_t ne1;
240
+ size_t nb01;
241
+ size_t nb02;
242
+ size_t nb11;
243
+ size_t nb21;
244
+ } ggml_metal_kargs_add_id;
245
+
246
+ typedef struct {
247
+ int32_t ne00;
248
+ int32_t ne01;
249
+ int32_t ne02;
250
+ int32_t ne03;
251
+ uint64_t nb00;
252
+ uint64_t nb01;
253
+ uint64_t nb02;
254
+ uint64_t nb03;
255
+ int32_t ne0;
256
+ int32_t ne1;
257
+ int32_t ne2;
258
+ int32_t ne3;
259
+ uint64_t nb0;
260
+ uint64_t nb1;
261
+ uint64_t nb2;
262
+ uint64_t nb3;
263
+ } ggml_metal_kargs_repeat;
264
+
265
+ typedef struct {
266
+ int64_t nk0;
267
+ int64_t ne00;
268
+ int64_t ne01;
269
+ int64_t ne02;
270
+ int64_t ne03;
271
+ uint64_t nb00;
272
+ uint64_t nb01;
273
+ uint64_t nb02;
274
+ uint64_t nb03;
275
+ int64_t ne0;
276
+ int64_t ne1;
277
+ int64_t ne2;
278
+ int64_t ne3;
279
+ uint64_t nb0;
280
+ uint64_t nb1;
281
+ uint64_t nb2;
282
+ uint64_t nb3;
283
+ } ggml_metal_kargs_cpy;
284
+
285
+ typedef struct {
286
+ int64_t ne10;
287
+ int64_t ne11;
288
+ int64_t ne12;
289
+ uint64_t nb10;
290
+ uint64_t nb11;
291
+ uint64_t nb12;
292
+ uint64_t nb13;
293
+ uint64_t nb1;
294
+ uint64_t nb2;
295
+ uint64_t nb3;
296
+ uint64_t offs;
297
+ bool inplace;
298
+ } ggml_metal_kargs_set;
299
+
300
+ typedef struct {
301
+ int32_t ne00;
302
+ int32_t ne01;
303
+ int32_t ne02;
304
+ int32_t ne03;
305
+ uint64_t nb00;
306
+ uint64_t nb01;
307
+ uint64_t nb02;
308
+ uint64_t nb03;
309
+ int32_t ne0;
310
+ int32_t ne1;
311
+ int32_t ne2;
312
+ int32_t ne3;
313
+ uint64_t nb0;
314
+ uint64_t nb1;
315
+ uint64_t nb2;
316
+ uint64_t nb3;
317
+ int32_t n_past;
318
+ int32_t n_dims;
319
+ int32_t n_ctx_orig;
320
+ float freq_base;
321
+ float freq_scale;
322
+ float ext_factor;
323
+ float attn_factor;
324
+ float beta_fast;
325
+ float beta_slow;
326
+ int32_t sect_0;
327
+ int32_t sect_1;
328
+ int32_t sect_2;
329
+ int32_t sect_3;
330
+ bool src2;
331
+ } ggml_metal_kargs_rope;
332
+
333
+ typedef struct {
334
+ int32_t ne11;
335
+ int32_t ne_12_2; // assume K and V are same shape
336
+ int32_t ne_12_3;
337
+ uint64_t nb11;
338
+ uint64_t nb12;
339
+ uint64_t nb13;
340
+ uint64_t nb21;
341
+ uint64_t nb22;
342
+ uint64_t nb23;
343
+ int32_t ne31;
344
+ int32_t ne32;
345
+ int32_t ne33;
346
+ uint64_t nb31;
347
+ uint64_t nb32;
348
+ uint64_t nb33;
349
+ } ggml_metal_kargs_flash_attn_ext_pad;
350
+
351
+ typedef struct {
352
+ int32_t ne01;
353
+ int32_t ne30;
354
+ int32_t ne31;
355
+ int32_t ne32;
356
+ int32_t ne33;
357
+ uint64_t nb31;
358
+ uint64_t nb32;
359
+ uint64_t nb33;
360
+ } ggml_metal_kargs_flash_attn_ext_blk;
361
+
362
+ typedef struct {
363
+ int32_t ne01;
364
+ int32_t ne02;
365
+ int32_t ne03;
366
+ uint64_t nb01;
367
+ uint64_t nb02;
368
+ uint64_t nb03;
369
+ int32_t ne11;
370
+ int32_t ne_12_2; // assume K and V are same shape
371
+ int32_t ne_12_3;
372
+ int32_t ns10;
373
+ uint64_t nb11;
374
+ uint64_t nb12;
375
+ uint64_t nb13;
376
+ int32_t ns20;
377
+ uint64_t nb21;
378
+ uint64_t nb22;
379
+ uint64_t nb23;
380
+ int32_t ne31;
381
+ int32_t ne32;
382
+ int32_t ne33;
383
+ uint64_t nb31;
384
+ uint64_t nb32;
385
+ uint64_t nb33;
386
+ int32_t ne1;
387
+ int32_t ne2;
388
+ int32_t ne3;
389
+ float scale;
390
+ float max_bias;
391
+ float m0;
392
+ float m1;
393
+ int32_t n_head_log2;
394
+ float logit_softcap;
395
+ } ggml_metal_kargs_flash_attn_ext;
396
+
397
+ typedef struct {
398
+ int32_t ne01;
399
+ int32_t ne02;
400
+ int32_t ne03;
401
+ uint64_t nb01;
402
+ uint64_t nb02;
403
+ uint64_t nb03;
404
+ int32_t ne11;
405
+ int32_t ne_12_2; // assume K and V are same shape
406
+ int32_t ne_12_3;
407
+ int32_t ns10;
408
+ uint64_t nb11;
409
+ uint64_t nb12;
410
+ uint64_t nb13;
411
+ int32_t ns20;
412
+ uint64_t nb21;
413
+ uint64_t nb22;
414
+ uint64_t nb23;
415
+ int32_t ne31;
416
+ int32_t ne32;
417
+ int32_t ne33;
418
+ uint64_t nb31;
419
+ uint64_t nb32;
420
+ uint64_t nb33;
421
+ int32_t ne1;
422
+ int32_t ne2;
423
+ int32_t ne3;
424
+ float scale;
425
+ float max_bias;
426
+ float m0;
427
+ float m1;
428
+ int32_t n_head_log2;
429
+ float logit_softcap;
430
+ } ggml_metal_kargs_flash_attn_ext_vec;
431
+
432
+ typedef struct {
433
+ int32_t nrows;
434
+ } ggml_metal_kargs_flash_attn_ext_vec_reduce;
435
+
436
+ typedef struct {
437
+ int32_t ne00;
438
+ int32_t ne02;
439
+ uint64_t nb01;
440
+ uint64_t nb02;
441
+ uint64_t nb03;
442
+ int32_t ne12;
443
+ uint64_t nb10;
444
+ uint64_t nb11;
445
+ uint64_t nb12;
446
+ uint64_t nb13;
447
+ int32_t ne0;
448
+ int32_t ne1;
449
+ int16_t r2;
450
+ int16_t r3;
451
+ } ggml_metal_kargs_mul_mm;
452
+
453
+ typedef struct {
454
+ int32_t ne00;
455
+ int32_t ne01;
456
+ int32_t ne02;
457
+ uint64_t nb00;
458
+ uint64_t nb01;
459
+ uint64_t nb02;
460
+ uint64_t nb03;
461
+ int32_t ne10;
462
+ int32_t ne11;
463
+ int32_t ne12;
464
+ uint64_t nb10;
465
+ uint64_t nb11;
466
+ uint64_t nb12;
467
+ uint64_t nb13;
468
+ int32_t ne0;
469
+ int32_t ne1;
470
+ int32_t nr0;
471
+ int16_t r2;
472
+ int16_t r3;
473
+ } ggml_metal_kargs_mul_mv;
474
+
475
+ typedef struct {
476
+ int32_t ne00;
477
+ int32_t ne01;
478
+ int32_t ne02;
479
+ uint64_t nb00;
480
+ uint64_t nb01;
481
+ uint64_t nb02;
482
+ uint64_t nb03;
483
+ int32_t ne10;
484
+ int32_t ne11;
485
+ int32_t ne12;
486
+ uint64_t nb10;
487
+ uint64_t nb11;
488
+ uint64_t nb12;
489
+ uint64_t nb13;
490
+ int32_t ne0;
491
+ int32_t ne1;
492
+ int16_t r2;
493
+ int16_t r3;
494
+ } ggml_metal_kargs_mul_mv_ext;
495
+
496
+ // CrispASR patch (#83): kargs for Q8_K input quantize + Q4_K×Q8_K matmul.
497
+ // Pre-step kernel_quantize_q8_K_f32 packs F32 input into block_q8_K format
498
+ // matching CPU's quantize_row_q8_K_ref output. Main kernel
499
+ // kernel_mul_mv_q4_K_q8_K then mirrors ggml_vec_dot_q4_K_q8_K_generic
500
+ // bit-for-bit (CPU's Q4_K × Q8_K-quantised input → F32). Used when an op
501
+ // carries GGML_PREC_F32 — see LEARNINGS §"Methodical bisect, round 2".
502
+ typedef struct {
503
+ int32_t ne00; // hidden dim (must be % 256 == 0)
504
+ int32_t ne01; // num input rows = ne11 of the parent matmul
505
+ int32_t ne02;
506
+ uint64_t nb01; // input row stride (bytes), src
507
+ uint64_t nb02;
508
+ uint64_t nb03;
509
+ int32_t num_blocks_per_row; // ne00 / 256
510
+ } ggml_metal_kargs_quantize_q8_K;
511
+
512
+ typedef struct {
513
+ int32_t ne00; // K dim (hidden)
514
+ int32_t ne01; // M dim (output rows)
515
+ int32_t ne02;
516
+ uint64_t nb01; // weight row stride (bytes), src0
517
+ uint64_t nb02;
518
+ uint64_t nb03;
519
+ int32_t ne11; // N dim (input cols / output cols)
520
+ int32_t ne12;
521
+ int32_t ne0; // dst stride along M
522
+ int32_t ne1; // dst stride along N (== ne11)
523
+ int16_t r2;
524
+ int16_t r3;
525
+ } ggml_metal_kargs_mul_mv_q4_K_q8_K;
526
+
527
+ // CrispASR patch (#83 r9): kargs for Q8_0 input quantize + Q8_0×Q8_0 matmul.
528
+ // Pre-step kernel_quantize_q8_0_f32 packs F32 input into block_q8_0 format
529
+ // matching CPU's quantize_row_q8_0_ref output (32-elem blocks, F16 scale).
530
+ // Main kernel kernel_mul_mv_q8_0_q8_0 mirrors ggml_vec_dot_q8_0_q8_0_generic
531
+ // bit-for-bit. Used when an op carries GGML_PREC_F32 — chatterbox S3Gen UNet
532
+ // uses Q8_0 weights × F32 input, the GPU mul_mv_ext path drifts ~1e-3 vs
533
+ // CPU (compound F32 accumulator/round-down loss across 396 mul_mats x 10
534
+ // CFM steps) so we mirror the CPU integer-dot path exactly.
535
+ typedef struct {
536
+ int32_t ne00; // hidden dim (must be % 32 == 0)
537
+ int32_t ne01; // num input rows = ne11 of the parent matmul
538
+ int32_t ne02;
539
+ uint64_t nb01; // input row stride (bytes), src
540
+ uint64_t nb02;
541
+ uint64_t nb03;
542
+ int32_t num_blocks_per_row; // ne00 / 32
543
+ } ggml_metal_kargs_quantize_q8_0;
544
+
545
+ typedef struct {
546
+ int32_t ne00; // K dim (hidden)
547
+ int32_t ne01; // M dim (output rows)
548
+ int32_t ne02;
549
+ uint64_t nb01; // weight row stride (bytes), src0
550
+ uint64_t nb02;
551
+ uint64_t nb03;
552
+ int32_t ne11; // N dim (input cols / output cols)
553
+ int32_t ne12;
554
+ int32_t ne0; // dst stride along M
555
+ int32_t ne1; // dst stride along N (== ne11)
556
+ int16_t r2;
557
+ int16_t r3;
558
+ } ggml_metal_kargs_mul_mv_q8_0_q8_0;
559
+
560
+ typedef struct {
561
+ int32_t ne02;
562
+ int32_t ne10;
563
+ int32_t ne11; // n_expert_used (bcast)
564
+ uint64_t nb11;
565
+ uint64_t nb12;
566
+ int32_t ne21; // n_tokens
567
+ int32_t ne20; // n_expert_used
568
+ uint64_t nb21;
569
+ } ggml_metal_kargs_mul_mm_id_map0;
570
+
571
+ typedef struct {
572
+ int32_t ne00;
573
+ int32_t ne02;
574
+ uint64_t nb01;
575
+ uint64_t nb02;
576
+ uint64_t nb03;
577
+ int32_t ne11;
578
+ uint64_t nb10;
579
+ uint64_t nb11;
580
+ uint64_t nb12;
581
+ uint64_t nb13;
582
+ int32_t ne20;
583
+ int32_t ne21;
584
+ int32_t ne0;
585
+ int32_t ne1;
586
+ int16_t r2;
587
+ int16_t r3;
588
+ } ggml_metal_kargs_mul_mm_id;
589
+
590
+ typedef struct {
591
+ int32_t nei0;
592
+ int32_t nei1;
593
+ uint64_t nbi1;
594
+ int32_t ne00;
595
+ int32_t ne01;
596
+ int32_t ne02;
597
+ uint64_t nb00;
598
+ uint64_t nb01;
599
+ uint64_t nb02;
600
+ int32_t ne10;
601
+ int32_t ne11;
602
+ int32_t ne12;
603
+ int32_t ne13;
604
+ uint64_t nb10;
605
+ uint64_t nb11;
606
+ uint64_t nb12;
607
+ int32_t ne0;
608
+ int32_t ne1;
609
+ uint64_t nb1;
610
+ int32_t nr0;
611
+ } ggml_metal_kargs_mul_mv_id;
612
+
613
+ // NORM
614
+ // RMS_NORM
615
+ typedef struct {
616
+ int32_t ne00;
617
+ int32_t ne00_t;
618
+ uint64_t nb1;
619
+ uint64_t nb2;
620
+ uint64_t nb3;
621
+ float eps;
622
+ int32_t nef1[3];
623
+ int32_t nef2[3];
624
+ int32_t nef3[3];
625
+ uint64_t nbf1[3];
626
+ uint64_t nbf2[3];
627
+ uint64_t nbf3[3];
628
+ } ggml_metal_kargs_norm;
629
+
630
+ typedef struct {
631
+ int32_t ne00;
632
+ int32_t ne01;
633
+ int32_t ne02;
634
+ int32_t ne03;
635
+ uint64_t nb00;
636
+ uint64_t nb01;
637
+ uint64_t nb02;
638
+ uint64_t nb03;
639
+ int32_t ne0;
640
+ int32_t ne1;
641
+ int32_t ne2;
642
+ int32_t ne3;
643
+ uint64_t nb0;
644
+ uint64_t nb1;
645
+ uint64_t nb2;
646
+ uint64_t nb3;
647
+ float eps;
648
+ } ggml_metal_kargs_l2_norm;
649
+
650
+ typedef struct {
651
+ int64_t ne00;
652
+ int64_t ne01;
653
+ int64_t ne02;
654
+ uint64_t nb00;
655
+ uint64_t nb01;
656
+ uint64_t nb02;
657
+ int32_t ngrp;
658
+ float eps;
659
+ } ggml_metal_kargs_group_norm;
660
+
661
+ typedef struct {
662
+ int32_t IC;
663
+ int32_t IL;
664
+ int32_t K;
665
+ int32_t s0;
666
+ uint64_t nb0;
667
+ uint64_t nb1;
668
+ } ggml_metal_kargs_conv_transpose_1d;
669
+
670
+ // CrispASR patch (PR #160 col2im_1d decomposition): kargs for the
671
+ // col2im_1d gather kernel — scatter-adds GEMM columns to 1D signal.
672
+ // MUST RE-APPLY after every ggml bump.
673
+ typedef struct {
674
+ int32_t T_in;
675
+ int32_t T_out;
676
+ int32_t OC;
677
+ int32_t K;
678
+ int32_t K_OC;
679
+ int32_t s0;
680
+ int32_t p0;
681
+ } ggml_metal_kargs_col2im_1d;
682
+
683
+ // CrispASR patch (PR #07-metal-aa-snake-beta): kargs for the fused
684
+ // BigVGAN v2 anti-aliased SnakeBeta kernel. K is fixed at 12 by the
685
+ // kernel — left in kargs only for sanity-checking on the host side.
686
+ // MUST RE-APPLY after every ggml bump.
687
+ typedef struct {
688
+ int32_t T; // sequence length per channel
689
+ int32_t C; // channels (input == output)
690
+ int32_t K; // filter taps (always 12 in current kernel)
691
+ int32_t up_pad; // 5 — replicate-pad before upsample
692
+ int32_t up_pad_left; // 15 — left crop of upsample output
693
+ int32_t up_pad_right; // 15 — right crop of upsample output
694
+ int32_t ds_pad_left; // 5 — replicate-pad before downsample
695
+ int32_t ds_pad_right; // 6
696
+ } ggml_metal_kargs_aa_snake_beta;
697
+
698
+ typedef struct {
699
+ int32_t IC;
700
+ int32_t IH;
701
+ int32_t IW;
702
+ int32_t KH;
703
+ int32_t KW;
704
+ int32_t OC;
705
+ int32_t s0;
706
+ uint64_t nb0;
707
+ uint64_t nb1;
708
+ uint64_t nb2;
709
+ } ggml_metal_kargs_conv_transpose_2d;
710
+
711
+ typedef struct {
712
+ uint64_t nb00;
713
+ uint64_t nb01;
714
+ uint64_t nb02;
715
+ uint64_t nb03;
716
+ uint64_t nb10;
717
+ uint64_t nb11;
718
+ uint64_t nb12;
719
+ uint64_t nb13;
720
+ uint64_t nb0;
721
+ uint64_t nb1;
722
+ uint64_t nb2;
723
+ uint64_t nb3;
724
+ int32_t IW;
725
+ int32_t IH;
726
+ int32_t KW;
727
+ int32_t KH;
728
+ int32_t IC;
729
+ int32_t OC;
730
+ int32_t OW;
731
+ int32_t OH;
732
+ int32_t N;
733
+ int32_t s0;
734
+ int32_t s1;
735
+ int32_t p0;
736
+ int32_t p1;
737
+ int32_t d0;
738
+ int32_t d1;
739
+ } ggml_metal_kargs_conv_2d;
740
+
741
+ typedef struct {
742
+ uint64_t ofs0;
743
+ uint64_t ofs1;
744
+ int32_t IW;
745
+ int32_t IH;
746
+ int32_t CHW;
747
+ int32_t s0;
748
+ int32_t s1;
749
+ int32_t p0;
750
+ int32_t p1;
751
+ int32_t d0;
752
+ int32_t d1;
753
+ int32_t N;
754
+ int32_t KH;
755
+ int32_t KW;
756
+ int32_t KHW; // KH * KW, pre-computed on CPU to save GPU resources
757
+ } ggml_metal_kargs_im2col;
758
+
759
+ typedef struct {
760
+ int32_t IW;
761
+ int32_t IH;
762
+ int32_t ID;
763
+ int32_t OW;
764
+ int32_t OH;
765
+ int32_t OD;
766
+ int32_t KW;
767
+ int32_t KH;
768
+ int32_t KD;
769
+ int32_t s0;
770
+ int32_t s1;
771
+ int32_t s2;
772
+ int32_t p0;
773
+ int32_t p1;
774
+ int32_t p2;
775
+ int32_t d0;
776
+ int32_t d1;
777
+ int32_t d2;
778
+ int32_t IC;
779
+ int32_t N;
780
+ int32_t OC;
781
+ uint64_t nb00;
782
+ uint64_t nb01;
783
+ uint64_t nb02;
784
+ uint64_t nb03;
785
+ uint64_t nb10;
786
+ uint64_t nb11;
787
+ uint64_t nb12;
788
+ uint64_t nb13;
789
+ uint64_t nb0;
790
+ uint64_t nb1;
791
+ uint64_t nb2;
792
+ uint64_t nb3;
793
+ } ggml_metal_kargs_conv_3d;
794
+
795
+ typedef struct{
796
+ int32_t ne00;
797
+ uint64_t nb01;
798
+ int32_t ne10;
799
+ uint64_t nb11;
800
+ int32_t ne0;
801
+ uint64_t nb1;
802
+ int32_t i00;
803
+ int32_t i10;
804
+ float alpha;
805
+ float limit;
806
+ } ggml_metal_kargs_glu;
807
+
808
+ typedef struct {
809
+ uint64_t np;
810
+ } ggml_metal_kargs_sum;
811
+
812
+ typedef struct {
813
+ int64_t ne00;
814
+ int64_t ne01;
815
+ int64_t ne02;
816
+ int64_t ne03;
817
+ uint64_t nb00;
818
+ uint64_t nb01;
819
+ uint64_t nb02;
820
+ uint64_t nb03;
821
+ int64_t ne0;
822
+ int64_t ne1;
823
+ int64_t ne2;
824
+ int64_t ne3;
825
+ uint64_t nb0;
826
+ uint64_t nb1;
827
+ uint64_t nb2;
828
+ uint64_t nb3;
829
+ } ggml_metal_kargs_sum_rows;
830
+
831
+ typedef struct {
832
+ int64_t ne00;
833
+ int64_t ne01;
834
+ int64_t ne02;
835
+ int64_t ne03;
836
+ uint64_t nb00;
837
+ uint64_t nb01;
838
+ uint64_t nb02;
839
+ uint64_t nb03;
840
+ int64_t net0;
841
+ int64_t net1;
842
+ int64_t net2;
843
+ int64_t net3;
844
+ uint64_t nbt0;
845
+ uint64_t nbt1;
846
+ uint64_t nbt2;
847
+ uint64_t nbt3;
848
+ bool outb;
849
+ } ggml_metal_kargs_cumsum_blk;
850
+
851
+ typedef struct {
852
+ int64_t ne00;
853
+ int64_t ne01;
854
+ int64_t ne02;
855
+ int64_t ne03;
856
+ uint64_t nb00;
857
+ uint64_t nb01;
858
+ uint64_t nb02;
859
+ uint64_t nb03;
860
+ int64_t net0;
861
+ int64_t net1;
862
+ int64_t net2;
863
+ int64_t net3;
864
+ uint64_t nbt0;
865
+ uint64_t nbt1;
866
+ uint64_t nbt2;
867
+ uint64_t nbt3;
868
+ } ggml_metal_kargs_cumsum_add;
869
+
870
+ typedef struct {
871
+ int32_t ne00;
872
+ int32_t ne01;
873
+ int32_t ne02;
874
+ uint64_t nb01;
875
+ uint64_t nb02;
876
+ uint64_t nb03;
877
+ int32_t ne11;
878
+ int32_t ne12;
879
+ int32_t ne13;
880
+ uint64_t nb11;
881
+ uint64_t nb12;
882
+ uint64_t nb13;
883
+ uint64_t nb1;
884
+ uint64_t nb2;
885
+ uint64_t nb3;
886
+ float scale;
887
+ float max_bias;
888
+ float m0;
889
+ float m1;
890
+ int32_t n_head_log2;
891
+ } ggml_metal_kargs_soft_max;
892
+
893
+ typedef struct {
894
+ int64_t ne00;
895
+ int64_t ne01;
896
+ int64_t ne02;
897
+ uint64_t nb00;
898
+ uint64_t nb01;
899
+ uint64_t nb02;
900
+ int64_t ne10;
901
+ int64_t ne11;
902
+ uint64_t nb10;
903
+ uint64_t nb11;
904
+ int64_t ne0;
905
+ int64_t ne1;
906
+ int64_t ne2;
907
+ uint64_t nb0;
908
+ uint64_t nb1;
909
+ uint64_t nb2;
910
+ } ggml_metal_kargs_ssm_conv;
911
+
912
+ typedef struct {
913
+ int64_t d_state;
914
+ int64_t d_inner;
915
+ int64_t n_head;
916
+ int64_t n_group;
917
+ int64_t n_seq_tokens;
918
+ int64_t n_seqs;
919
+ uint64_t s_off;
920
+ uint64_t nb00;
921
+ uint64_t nb01;
922
+ uint64_t nb02;
923
+ uint64_t nb03;
924
+ uint64_t nb10;
925
+ uint64_t nb11;
926
+ uint64_t nb12;
927
+ uint64_t ns12;
928
+ uint64_t nb13;
929
+ uint64_t nb20;
930
+ uint64_t nb21;
931
+ uint64_t ns21;
932
+ uint64_t nb22;
933
+ int64_t ne30;
934
+ uint64_t nb31;
935
+ uint64_t nb41;
936
+ uint64_t nb42;
937
+ uint64_t ns42;
938
+ uint64_t nb43;
939
+ uint64_t nb51;
940
+ uint64_t nb52;
941
+ uint64_t ns52;
942
+ uint64_t nb53;
943
+ uint64_t nb0;
944
+ } ggml_metal_kargs_ssm_scan;
945
+
946
+ typedef struct {
947
+ int32_t ne00;
948
+ int32_t ne01;
949
+ int32_t ne02;
950
+ int32_t ne03;
951
+ uint64_t nb00;
952
+ uint64_t nb01;
953
+ uint64_t nb02;
954
+ uint64_t nb03;
955
+ int32_t ne10;
956
+ int32_t ne11;
957
+ int32_t ne12;
958
+ int32_t ne13;
959
+ uint64_t nb10;
960
+ uint64_t nb11;
961
+ uint64_t nb12;
962
+ uint64_t nb13;
963
+ int32_t ne20;
964
+ int32_t ne21;
965
+ int32_t ne22;
966
+ int32_t ne23;
967
+ uint64_t nb20;
968
+ uint64_t nb21;
969
+ uint64_t nb22;
970
+ uint64_t nb23;
971
+ int32_t ns02;
972
+ int32_t ns12;
973
+ int32_t ns22;
974
+ int32_t ne0;
975
+ int32_t ne1;
976
+ int32_t ne2;
977
+ int32_t ne3;
978
+ uint64_t nb0;
979
+ uint64_t nb1;
980
+ uint64_t nb2;
981
+ uint64_t nb3;
982
+ } ggml_metal_kargs_gated_delta_net;
983
+
984
+ typedef struct {
985
+ int32_t ne00;
986
+ int32_t ne01;
987
+ int32_t ne02;
988
+ int32_t ne03;
989
+ uint64_t nb00;
990
+ uint64_t nb01;
991
+ uint64_t nb02;
992
+ uint64_t nb03;
993
+ int32_t ne10;
994
+ int32_t ne11;
995
+ int32_t ne12;
996
+ int32_t ne13;
997
+ uint64_t nb10;
998
+ uint64_t nb11;
999
+ uint64_t nb12;
1000
+ uint64_t nb13;
1001
+ int32_t ne0;
1002
+ int32_t ne1;
1003
+ int32_t ne2;
1004
+ int32_t ne3;
1005
+ uint64_t nb0;
1006
+ uint64_t nb1;
1007
+ uint64_t nb2;
1008
+ uint64_t nb3;
1009
+ } ggml_metal_kargs_solve_tri;
1010
+
1011
+ typedef struct {
1012
+ int32_t ne00t;
1013
+ int32_t ne00;
1014
+ uint64_t nb01;
1015
+ uint64_t nb02;
1016
+ uint64_t nb03;
1017
+ int32_t ne10;
1018
+ uint64_t nb10;
1019
+ uint64_t nb11;
1020
+ uint64_t nb12;
1021
+ uint64_t nb1;
1022
+ uint64_t nb2;
1023
+ uint64_t nb3;
1024
+ } ggml_metal_kargs_get_rows;
1025
+
1026
+ typedef struct {
1027
+ int32_t nk0;
1028
+ int32_t ne01;
1029
+ uint64_t nb01;
1030
+ uint64_t nb02;
1031
+ uint64_t nb03;
1032
+ int32_t ne11;
1033
+ int32_t ne12;
1034
+ uint64_t nb10;
1035
+ uint64_t nb11;
1036
+ uint64_t nb12;
1037
+ uint64_t nb1;
1038
+ uint64_t nb2;
1039
+ uint64_t nb3;
1040
+ } ggml_metal_kargs_set_rows;
1041
+
1042
+ typedef struct {
1043
+ int32_t ne00;
1044
+ int32_t ne01;
1045
+ int32_t ne02;
1046
+ int32_t ne03;
1047
+ uint64_t nb00;
1048
+ uint64_t nb01;
1049
+ uint64_t nb02;
1050
+ uint64_t nb03;
1051
+ int32_t ne0;
1052
+ int32_t ne1;
1053
+ int32_t ne2;
1054
+ int32_t ne3;
1055
+ uint64_t nb0;
1056
+ uint64_t nb1;
1057
+ uint64_t nb2;
1058
+ uint64_t nb3;
1059
+ } ggml_metal_kargs_diag;
1060
+
1061
+ typedef struct {
1062
+ int64_t ne00;
1063
+ int64_t ne01;
1064
+ int64_t ne02;
1065
+ int64_t ne03;
1066
+ uint64_t nb00;
1067
+ uint64_t nb01;
1068
+ uint64_t nb02;
1069
+ uint64_t nb03;
1070
+ int64_t ne0;
1071
+ int64_t ne1;
1072
+ int64_t ne2;
1073
+ int64_t ne3;
1074
+ uint64_t nb0;
1075
+ uint64_t nb1;
1076
+ uint64_t nb2;
1077
+ uint64_t nb3;
1078
+ float sf0;
1079
+ float sf1;
1080
+ float sf2;
1081
+ float sf3;
1082
+ float poffs;
1083
+ } ggml_metal_kargs_upscale;
1084
+
1085
+ typedef struct {
1086
+ int64_t ne00;
1087
+ int64_t ne01;
1088
+ int64_t ne02;
1089
+ int64_t ne03;
1090
+ uint64_t nb00;
1091
+ uint64_t nb01;
1092
+ uint64_t nb02;
1093
+ uint64_t nb03;
1094
+ int64_t ne0;
1095
+ int64_t ne1;
1096
+ int64_t ne2;
1097
+ int64_t ne3;
1098
+ uint64_t nb0;
1099
+ uint64_t nb1;
1100
+ uint64_t nb2;
1101
+ uint64_t nb3;
1102
+ } ggml_metal_kargs_pad;
1103
+
1104
+ typedef struct {
1105
+ int64_t ne00;
1106
+ int64_t ne01;
1107
+ int64_t ne02;
1108
+ int64_t ne03;
1109
+ uint64_t nb00;
1110
+ uint64_t nb01;
1111
+ uint64_t nb02;
1112
+ uint64_t nb03;
1113
+ int64_t ne0;
1114
+ int64_t ne1;
1115
+ int64_t ne2;
1116
+ int64_t ne3;
1117
+ uint64_t nb0;
1118
+ uint64_t nb1;
1119
+ uint64_t nb2;
1120
+ uint64_t nb3;
1121
+ int32_t p0;
1122
+ int32_t p1;
1123
+ } ggml_metal_kargs_pad_reflect_1d;
1124
+
1125
+ typedef struct {
1126
+ int64_t ne00;
1127
+ int64_t ne01;
1128
+ int64_t ne02;
1129
+ int64_t ne03;
1130
+ uint64_t nb00;
1131
+ uint64_t nb01;
1132
+ uint64_t nb02;
1133
+ uint64_t nb03;
1134
+ int64_t ne0;
1135
+ int64_t ne1;
1136
+ int64_t ne2;
1137
+ int64_t ne3;
1138
+ uint64_t nb0;
1139
+ uint64_t nb1;
1140
+ uint64_t nb2;
1141
+ uint64_t nb3;
1142
+ int32_t s0;
1143
+ int32_t s1;
1144
+ int32_t s2;
1145
+ int32_t s3;
1146
+ } ggml_metal_kargs_roll;
1147
+
1148
+ typedef struct {
1149
+ uint64_t nb1;
1150
+ int dim;
1151
+ int max_period;
1152
+ } ggml_metal_kargs_timestep_embedding;
1153
+
1154
+ typedef struct {
1155
+ int32_t ne00;
1156
+ int32_t ne01;
1157
+ int32_t ne02;
1158
+ int32_t ne03;
1159
+ uint64_t nb00;
1160
+ uint64_t nb01;
1161
+ uint64_t nb02;
1162
+ uint64_t nb03;
1163
+ int32_t ne0;
1164
+ int32_t ne1;
1165
+ int32_t ne2;
1166
+ int32_t ne3;
1167
+ uint64_t nb0;
1168
+ uint64_t nb1;
1169
+ uint64_t nb2;
1170
+ uint64_t nb3;
1171
+ } ggml_metal_kargs_tri;
1172
+
1173
+ typedef struct {
1174
+ int32_t ne00;
1175
+ int32_t ne01;
1176
+ int32_t ne02;
1177
+ int32_t ne03;
1178
+ uint64_t nb00;
1179
+ uint64_t nb01;
1180
+ uint64_t nb02;
1181
+ uint64_t nb03;
1182
+ int32_t ne0;
1183
+ int32_t ne1;
1184
+ int32_t ne2;
1185
+ int32_t ne3;
1186
+ int32_t top_k;
1187
+ } ggml_metal_kargs_argsort;
1188
+
1189
+ typedef struct {
1190
+ int64_t ne00;
1191
+ int64_t ne01;
1192
+ int64_t ne02;
1193
+ int64_t ne03;
1194
+ uint64_t nb00;
1195
+ uint64_t nb01;
1196
+ uint64_t nb02;
1197
+ uint64_t nb03;
1198
+ int32_t ne0;
1199
+ int32_t ne1;
1200
+ int32_t ne2;
1201
+ int32_t ne3;
1202
+ int32_t top_k;
1203
+ int32_t len;
1204
+ } ggml_metal_kargs_argsort_merge;
1205
+
1206
+ typedef struct {
1207
+ int64_t ne0;
1208
+ float start;
1209
+ float step;
1210
+ } ggml_metal_kargs_arange;
1211
+
1212
+ typedef struct {
1213
+ int64_t val;
1214
+ } ggml_metal_kargs_memset;
1215
+
1216
+ typedef struct {
1217
+ int32_t ne00;
1218
+ int32_t ne01;
1219
+ int32_t ne02;
1220
+ int32_t ne03;
1221
+ uint64_t nb00;
1222
+ uint64_t nb01;
1223
+ uint64_t nb02;
1224
+ uint64_t nb03;
1225
+ uint64_t nb10;
1226
+ uint64_t nb11;
1227
+ uint64_t nb12;
1228
+ uint64_t nb13;
1229
+ } ggml_metal_kargs_count_equal;
1230
+
1231
+ typedef struct {
1232
+ int32_t k0;
1233
+ int32_t k1;
1234
+ int32_t s0;
1235
+ int32_t s1;
1236
+ int32_t p0;
1237
+ int32_t p1;
1238
+ int64_t IH;
1239
+ int64_t IW;
1240
+ int64_t OH;
1241
+ int64_t OW;
1242
+ int64_t np;
1243
+ } ggml_metal_kargs_pool_2d;
1244
+
1245
+ typedef struct {
1246
+ int32_t k0;
1247
+ int32_t s0;
1248
+ int32_t p0;
1249
+ int64_t IW;
1250
+ int64_t OW;
1251
+ int64_t np;
1252
+ } ggml_metal_kargs_pool_1d;
1253
+
1254
+ typedef struct {
1255
+ int64_t ne00;
1256
+ uint64_t nb01;
1257
+ } ggml_metal_kargs_argmax;
1258
+
1259
+ typedef struct {
1260
+ int64_t np;
1261
+ } ggml_metal_kargs_opt_step_adamw;
1262
+
1263
+ typedef struct {
1264
+ int64_t np;
1265
+ } ggml_metal_kargs_opt_step_sgd;
1266
+
1267
+ #endif // GGML_METAL_IMPL