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.
- checksums.yaml +7 -0
- data/CHANGELOG.md +21 -0
- data/LICENSE.txt +201 -0
- data/NOTICE +5 -0
- data/README.md +265 -0
- data/THIRD_PARTY_NOTICES.md +67 -0
- data/exe/cohere-transcribe +8 -0
- data/exe/cohere-transcribe-doctor +8 -0
- data/ext/cohere_transcribe_native/CMakeLists.txt +262 -0
- data/ext/cohere_transcribe_native/README.md +26 -0
- data/ext/cohere_transcribe_native/audio_abi.cpp +1416 -0
- data/ext/cohere_transcribe_native/audio_exports.macos +5 -0
- data/ext/cohere_transcribe_native/audio_exports.map +10 -0
- data/ext/cohere_transcribe_native/cohere_abi.cpp +1209 -0
- data/ext/cohere_transcribe_native/exports.macos +40 -0
- data/ext/cohere_transcribe_native/exports.map +45 -0
- data/ext/cohere_transcribe_native/extconf.rb +89 -0
- data/ext/cohere_transcribe_native/test/abi_smoke.rb +232 -0
- data/ext/cohere_transcribe_native/test/audio_matrix_smoke.cpp +121 -0
- data/ext/cohere_transcribe_native/test/audio_reliability_smoke.cpp +198 -0
- data/ext/cohere_transcribe_native/test/native_abi_reliability_smoke.cpp +186 -0
- data/ext/cohere_transcribe_native/test/native_batch_projection_probe.rb +81 -0
- data/ext/cohere_transcribe_native/test/native_cancellation_smoke.cpp +194 -0
- data/lib/cohere/transcribe/alignment/ATTRIBUTION.md +23 -0
- data/lib/cohere/transcribe/alignment/LICENSE.ctc-forced-aligner +407 -0
- data/lib/cohere/transcribe/alignment/LICENSE.torchaudio +25 -0
- data/lib/cohere/transcribe/alignment/LICENSE.uroman +26 -0
- data/lib/cohere/transcribe/alignment/aligner.rb +476 -0
- data/lib/cohere/transcribe/alignment/ctc.rb +224 -0
- data/lib/cohere/transcribe/alignment/text.rb +237 -0
- data/lib/cohere/transcribe/alignment/uroman_data.rb +4950 -0
- data/lib/cohere/transcribe/api.rb +173 -0
- data/lib/cohere/transcribe/asr/batching.rb +472 -0
- data/lib/cohere/transcribe/asr/failure_policy.rb +112 -0
- data/lib/cohere/transcribe/asr/native.rb +676 -0
- data/lib/cohere/transcribe/audio/ATTRIBUTION.md +8 -0
- data/lib/cohere/transcribe/audio/LICENSE.auditok +21 -0
- data/lib/cohere/transcribe/audio/decoder.rb +315 -0
- data/lib/cohere/transcribe/audio/ffmpeg_native.rb +248 -0
- data/lib/cohere/transcribe/audio/segmentation.rb +260 -0
- data/lib/cohere/transcribe/cli.rb +727 -0
- data/lib/cohere/transcribe/configuration.rb +282 -0
- data/lib/cohere/transcribe/constants.rb +14 -0
- data/lib/cohere/transcribe/dense_converter.rb +548 -0
- data/lib/cohere/transcribe/doctor.rb +576 -0
- data/lib/cohere/transcribe/errors.rb +57 -0
- data/lib/cohere/transcribe/gguf_writer.rb +268 -0
- data/lib/cohere/transcribe/hub.rb +436 -0
- data/lib/cohere/transcribe/input.rb +110 -0
- data/lib/cohere/transcribe/licenses/crispasr.txt +21 -0
- data/lib/cohere/transcribe/loader.rb +128 -0
- data/lib/cohere/transcribe/model_identity.rb +440 -0
- data/lib/cohere/transcribe/output/publication.rb +1118 -0
- data/lib/cohere/transcribe/output/rendering.rb +105 -0
- data/lib/cohere/transcribe/output/timing.rb +86 -0
- data/lib/cohere/transcribe/python_text.rb +70 -0
- data/lib/cohere/transcribe/pytorch_checkpoint.rb +1180 -0
- data/lib/cohere/transcribe/runtime/engine.rb +1676 -0
- data/lib/cohere/transcribe/runtime/model_provider.rb +390 -0
- data/lib/cohere/transcribe/runtime/precision.rb +57 -0
- data/lib/cohere/transcribe/runtime/preparation.rb +215 -0
- data/lib/cohere/transcribe/runtime/resources.rb +165 -0
- data/lib/cohere/transcribe/runtime/word_pipeline.rb +364 -0
- data/lib/cohere/transcribe/safetensors.rb +579 -0
- data/lib/cohere/transcribe/state/checkpoint.rb +224 -0
- data/lib/cohere/transcribe/state/contracts.rb +141 -0
- data/lib/cohere/transcribe/state/io.rb +727 -0
- data/lib/cohere/transcribe/state/locking.rb +211 -0
- data/lib/cohere/transcribe/state/manifest.rb +155 -0
- data/lib/cohere/transcribe/state.rb +7 -0
- data/lib/cohere/transcribe/types.rb +535 -0
- data/lib/cohere/transcribe/vad/ATTRIBUTION.md +14 -0
- data/lib/cohere/transcribe/vad/LICENSE.faster-whisper +21 -0
- data/lib/cohere/transcribe/vad/LICENSE.silero-vad +21 -0
- data/lib/cohere/transcribe/vad/silero.rb +344 -0
- data/lib/cohere/transcribe/vad/silero_vad_v6.onnx +0 -0
- data/lib/cohere/transcribe/vad/timestamps.rb +219 -0
- data/lib/cohere/transcribe/version.rb +7 -0
- data/lib/cohere/transcribe.rb +26 -0
- data/sig/cohere/transcribe.rbs +250 -0
- data/vendor/crispasr/AUTHORS +510 -0
- data/vendor/crispasr/LICENSE +21 -0
- data/vendor/crispasr/UPSTREAM.md +9 -0
- data/vendor/crispasr/VERSION +1 -0
- data/vendor/crispasr/ggml/AUTHORS +335 -0
- data/vendor/crispasr/ggml/CMakeLists.txt +512 -0
- data/vendor/crispasr/ggml/LICENSE +21 -0
- data/vendor/crispasr/ggml/README.md +49 -0
- data/vendor/crispasr/ggml/cmake/FindNCCL.cmake +36 -0
- data/vendor/crispasr/ggml/cmake/GitVars.cmake +22 -0
- data/vendor/crispasr/ggml/cmake/common.cmake +50 -0
- data/vendor/crispasr/ggml/cmake/ggml-config.cmake.in +191 -0
- data/vendor/crispasr/ggml/ggml.pc.in +10 -0
- data/vendor/crispasr/ggml/include/ggml-alloc.h +85 -0
- data/vendor/crispasr/ggml/include/ggml-backend.h +431 -0
- data/vendor/crispasr/ggml/include/ggml-blas.h +25 -0
- data/vendor/crispasr/ggml/include/ggml-cann.h +123 -0
- data/vendor/crispasr/ggml/include/ggml-cpp.h +39 -0
- data/vendor/crispasr/ggml/include/ggml-cpu.h +151 -0
- data/vendor/crispasr/ggml/include/ggml-cuda.h +50 -0
- data/vendor/crispasr/ggml/include/ggml-hexagon.h +19 -0
- data/vendor/crispasr/ggml/include/ggml-metal.h +61 -0
- data/vendor/crispasr/ggml/include/ggml-opencl.h +26 -0
- data/vendor/crispasr/ggml/include/ggml-openvino.h +37 -0
- data/vendor/crispasr/ggml/include/ggml-opt.h +256 -0
- data/vendor/crispasr/ggml/include/ggml-rpc.h +35 -0
- data/vendor/crispasr/ggml/include/ggml-sycl.h +49 -0
- data/vendor/crispasr/ggml/include/ggml-virtgpu.h +14 -0
- data/vendor/crispasr/ggml/include/ggml-vulkan.h +29 -0
- data/vendor/crispasr/ggml/include/ggml-webgpu.h +19 -0
- data/vendor/crispasr/ggml/include/ggml-zdnn.h +17 -0
- data/vendor/crispasr/ggml/include/ggml-zendnn.h +22 -0
- data/vendor/crispasr/ggml/include/ggml.h +2887 -0
- data/vendor/crispasr/ggml/include/gguf.h +204 -0
- data/vendor/crispasr/ggml/src/CMakeLists.txt +493 -0
- data/vendor/crispasr/ggml/src/ggml-alloc.c +1323 -0
- data/vendor/crispasr/ggml/src/ggml-backend-dl.cpp +48 -0
- data/vendor/crispasr/ggml/src/ggml-backend-dl.h +44 -0
- data/vendor/crispasr/ggml/src/ggml-backend-impl.h +275 -0
- data/vendor/crispasr/ggml/src/ggml-backend-meta.cpp +2145 -0
- data/vendor/crispasr/ggml/src/ggml-backend-reg.cpp +586 -0
- data/vendor/crispasr/ggml/src/ggml-backend.cpp +2437 -0
- data/vendor/crispasr/ggml/src/ggml-common.h +1900 -0
- data/vendor/crispasr/ggml/src/ggml-cpu/CMakeLists.txt +718 -0
- data/vendor/crispasr/ggml/src/ggml-cpu/amx/amx.cpp +249 -0
- data/vendor/crispasr/ggml/src/ggml-cpu/amx/amx.h +8 -0
- data/vendor/crispasr/ggml/src/ggml-cpu/amx/common.h +115 -0
- data/vendor/crispasr/ggml/src/ggml-cpu/amx/mmq.cpp +2512 -0
- data/vendor/crispasr/ggml/src/ggml-cpu/amx/mmq.h +10 -0
- data/vendor/crispasr/ggml/src/ggml-cpu/arch/arm/cpu-feats.cpp +98 -0
- data/vendor/crispasr/ggml/src/ggml-cpu/arch/arm/quants.c +4244 -0
- data/vendor/crispasr/ggml/src/ggml-cpu/arch/arm/repack.cpp +5156 -0
- data/vendor/crispasr/ggml/src/ggml-cpu/arch/loongarch/quants.c +2158 -0
- data/vendor/crispasr/ggml/src/ggml-cpu/arch/powerpc/cpu-feats.cpp +82 -0
- data/vendor/crispasr/ggml/src/ggml-cpu/arch/powerpc/quants.c +2304 -0
- data/vendor/crispasr/ggml/src/ggml-cpu/arch/riscv/cpu-feats.cpp +38 -0
- data/vendor/crispasr/ggml/src/ggml-cpu/arch/riscv/quants.c +4455 -0
- data/vendor/crispasr/ggml/src/ggml-cpu/arch/riscv/repack.cpp +1703 -0
- data/vendor/crispasr/ggml/src/ggml-cpu/arch/s390/cpu-feats.cpp +50 -0
- data/vendor/crispasr/ggml/src/ggml-cpu/arch/s390/quants.c +1465 -0
- data/vendor/crispasr/ggml/src/ggml-cpu/arch/wasm/quants.c +1220 -0
- data/vendor/crispasr/ggml/src/ggml-cpu/arch/x86/cpu-feats.cpp +327 -0
- data/vendor/crispasr/ggml/src/ggml-cpu/arch/x86/quants.c +3970 -0
- data/vendor/crispasr/ggml/src/ggml-cpu/arch/x86/repack.cpp +6407 -0
- data/vendor/crispasr/ggml/src/ggml-cpu/arch-fallback.h +349 -0
- data/vendor/crispasr/ggml/src/ggml-cpu/binary-ops.cpp +154 -0
- data/vendor/crispasr/ggml/src/ggml-cpu/binary-ops.h +16 -0
- data/vendor/crispasr/ggml/src/ggml-cpu/cmake/FindSIMD.cmake +100 -0
- data/vendor/crispasr/ggml/src/ggml-cpu/common.h +95 -0
- data/vendor/crispasr/ggml/src/ggml-cpu/ggml-cpu-impl.h +539 -0
- data/vendor/crispasr/ggml/src/ggml-cpu/ggml-cpu.c +3791 -0
- data/vendor/crispasr/ggml/src/ggml-cpu/ggml-cpu.cpp +703 -0
- data/vendor/crispasr/ggml/src/ggml-cpu/hbm.cpp +55 -0
- data/vendor/crispasr/ggml/src/ggml-cpu/hbm.h +8 -0
- data/vendor/crispasr/ggml/src/ggml-cpu/kleidiai/kernels.cpp +939 -0
- data/vendor/crispasr/ggml/src/ggml-cpu/kleidiai/kernels.h +90 -0
- data/vendor/crispasr/ggml/src/ggml-cpu/kleidiai/kleidiai.cpp +1513 -0
- data/vendor/crispasr/ggml/src/ggml-cpu/kleidiai/kleidiai.h +17 -0
- data/vendor/crispasr/ggml/src/ggml-cpu/llamafile/sgemm.cpp +4051 -0
- data/vendor/crispasr/ggml/src/ggml-cpu/llamafile/sgemm.h +25 -0
- data/vendor/crispasr/ggml/src/ggml-cpu/ops.cpp +11662 -0
- data/vendor/crispasr/ggml/src/ggml-cpu/ops.h +121 -0
- data/vendor/crispasr/ggml/src/ggml-cpu/quants.c +1288 -0
- data/vendor/crispasr/ggml/src/ggml-cpu/quants.h +103 -0
- data/vendor/crispasr/ggml/src/ggml-cpu/repack.cpp +4836 -0
- data/vendor/crispasr/ggml/src/ggml-cpu/repack.h +245 -0
- data/vendor/crispasr/ggml/src/ggml-cpu/simd-gemm.h +226 -0
- data/vendor/crispasr/ggml/src/ggml-cpu/simd-mappings.h +1329 -0
- data/vendor/crispasr/ggml/src/ggml-cpu/spacemit/ime.cpp +1025 -0
- data/vendor/crispasr/ggml/src/ggml-cpu/spacemit/ime.h +13 -0
- data/vendor/crispasr/ggml/src/ggml-cpu/spacemit/ime1_kernels.cpp +3196 -0
- data/vendor/crispasr/ggml/src/ggml-cpu/spacemit/ime_kernels.h +26 -0
- data/vendor/crispasr/ggml/src/ggml-cpu/traits.cpp +36 -0
- data/vendor/crispasr/ggml/src/ggml-cpu/traits.h +38 -0
- data/vendor/crispasr/ggml/src/ggml-cpu/unary-ops.cpp +336 -0
- data/vendor/crispasr/ggml/src/ggml-cpu/unary-ops.h +35 -0
- data/vendor/crispasr/ggml/src/ggml-cpu/vec.cpp +681 -0
- data/vendor/crispasr/ggml/src/ggml-cpu/vec.h +1606 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/CMakeLists.txt +272 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/acc.cu +61 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/acc.cuh +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/add-id.cu +58 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/add-id.cuh +3 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/arange.cu +34 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/arange.cuh +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/argmax.cu +91 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/argmax.cuh +3 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/argsort.cu +265 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/argsort.cuh +19 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/binbcast.cu +534 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/binbcast.cuh +12 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/clamp.cu +45 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/clamp.cuh +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/col2im-1d.cu +81 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/col2im-1d.cuh +3 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/common.cuh +1489 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/concat.cu +204 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/concat.cuh +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/conv-transpose-1d.cu +97 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/conv-transpose-1d.cuh +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/conv2d-dw.cu +161 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/conv2d-dw.cuh +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/conv2d-transpose.cu +115 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/conv2d-transpose.cuh +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/conv2d.cu +166 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/conv2d.cuh +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/convert.cu +892 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/convert.cuh +66 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/count-equal.cu +64 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/count-equal.cuh +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/cp-async.cuh +57 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/cpy-utils.cuh +217 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/cpy.cu +581 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/cpy.cuh +7 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/cross-entropy-loss.cu +177 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/cross-entropy-loss.cuh +7 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/cumsum.cu +307 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/cumsum.cuh +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/dequantize.cuh +99 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/diag.cu +77 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/diag.cuh +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/diagmask.cu +40 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/diagmask.cuh +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/fattn-common.cuh +1212 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/fattn-mma-f16.cuh +1860 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/fattn-tile.cu +57 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/fattn-tile.cuh +1309 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/fattn-vec.cuh +600 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/fattn-wmma-f16.cu +696 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/fattn-wmma-f16.cuh +51 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/fattn.cu +620 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/fattn.cuh +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/fill.cu +37 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/fill.cuh +3 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/gated_delta_net.cu +273 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/gated_delta_net.cuh +4 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/getrows.cu +332 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/getrows.cuh +15 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/ggml-cuda.cu +5580 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/gla.cu +93 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/gla.cuh +3 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/im2col.cu +274 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/im2col.cuh +6 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/mean.cu +75 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/mean.cuh +3 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/mma.cuh +1333 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/mmf.cu +191 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/mmf.cuh +908 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/mmid.cu +164 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/mmid.cuh +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/mmq.cu +372 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/mmq.cuh +4175 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/mmvf.cu +862 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/mmvf.cuh +14 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/mmvq.cu +1161 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/mmvq.cuh +16 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/norm.cu +756 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/norm.cuh +20 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/opt-step-adamw.cu +78 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/opt-step-adamw.cuh +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/opt-step-sgd.cu +49 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/opt-step-sgd.cuh +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/out-prod.cu +68 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/out-prod.cuh +3 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/pad.cu +106 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/pad.cuh +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/pad_reflect_1d.cu +91 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/pad_reflect_1d.cuh +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/pool2d.cu +94 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/pool2d.cuh +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/quantize.cu +443 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/quantize.cuh +41 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/reduce_rows.cuh +39 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/roll.cu +67 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/roll.cuh +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/rope.cu +665 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/rope.cuh +9 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/scale.cu +34 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/scale.cuh +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/set-rows.cu +330 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/set-rows.cuh +7 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/set.cu +39 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/set.cuh +7 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/softcap.cu +34 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/softcap.cuh +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/softmax.cu +472 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/softmax.cuh +7 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/solve_tri.cu +275 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/solve_tri.cuh +3 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/ssm-conv.cu +197 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/ssm-conv.cuh +3 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/ssm-scan.cu +342 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/ssm-scan.cuh +3 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/sum.cu +41 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/sum.cuh +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/sumrows.cu +43 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/sumrows.cuh +4 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_1-ncols2_16.cu +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_1-ncols2_32.cu +6 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_1-ncols2_8.cu +11 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_16-ncols2_1.cu +10 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_16-ncols2_2.cu +10 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_16-ncols2_4.cu +12 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_2-ncols2_16.cu +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_2-ncols2_32.cu +6 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_2-ncols2_4.cu +12 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_2-ncols2_8.cu +11 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_32-ncols2_1.cu +10 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_32-ncols2_2.cu +10 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_4-ncols2_16.cu +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_4-ncols2_2.cu +10 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_4-ncols2_4.cu +12 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_4-ncols2_8.cu +11 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_64-ncols2_1.cu +10 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_8-ncols2_1.cu +10 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_8-ncols2_2.cu +10 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_8-ncols2_4.cu +12 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_8-ncols2_8.cu +11 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-tile-instance-dkq112-dv112.cu +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-tile-instance-dkq128-dv128.cu +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-tile-instance-dkq256-dv256.cu +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-tile-instance-dkq320-dv256.cu +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-tile-instance-dkq40-dv40.cu +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-tile-instance-dkq512-dv512.cu +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-tile-instance-dkq576-dv512.cu +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-tile-instance-dkq64-dv64.cu +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-tile-instance-dkq72-dv72.cu +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-tile-instance-dkq80-dv80.cu +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-tile-instance-dkq96-dv96.cu +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-bf16-bf16.cu +7 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-bf16-f16.cu +7 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-bf16-q4_0.cu +7 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-bf16-q4_1.cu +7 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-bf16-q5_0.cu +7 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-bf16-q5_1.cu +7 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-bf16-q8_0.cu +7 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-f16-bf16.cu +7 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-f16-f16.cu +7 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-f16-q4_0.cu +7 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-f16-q4_1.cu +7 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-f16-q5_0.cu +7 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-f16-q5_1.cu +7 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-f16-q8_0.cu +7 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_0-bf16.cu +7 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_0-f16.cu +7 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_0-q4_0.cu +7 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_0-q4_1.cu +7 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_0-q5_0.cu +7 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_0-q5_1.cu +7 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_0-q8_0.cu +7 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_1-bf16.cu +7 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_1-f16.cu +7 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_1-q4_0.cu +7 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_1-q4_1.cu +7 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_1-q5_0.cu +7 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_1-q5_1.cu +7 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_1-q8_0.cu +7 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_0-bf16.cu +7 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_0-f16.cu +7 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_0-q4_0.cu +7 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_0-q4_1.cu +7 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_0-q5_0.cu +7 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_0-q5_1.cu +7 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_0-q8_0.cu +7 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_1-bf16.cu +7 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_1-f16.cu +7 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_1-q4_0.cu +7 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_1-q4_1.cu +7 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_1-q5_0.cu +7 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_1-q5_1.cu +7 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_1-q8_0.cu +7 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q8_0-bf16.cu +7 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q8_0-f16.cu +7 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q8_0-q4_0.cu +7 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q8_0-q4_1.cu +7 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q8_0-q5_0.cu +7 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q8_0-q5_1.cu +7 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q8_0-q8_0.cu +7 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_1.cu +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_10.cu +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_11.cu +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_12.cu +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_13.cu +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_14.cu +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_15.cu +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_16.cu +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_2.cu +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_3.cu +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_4.cu +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_5.cu +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_6.cu +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_7.cu +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_8.cu +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_9.cu +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmq-instance-iq1_s.cu +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmq-instance-iq2_s.cu +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmq-instance-iq2_xs.cu +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmq-instance-iq2_xxs.cu +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmq-instance-iq3_s.cu +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmq-instance-iq3_xxs.cu +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmq-instance-iq4_nl.cu +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmq-instance-iq4_xs.cu +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmq-instance-mxfp4.cu +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmq-instance-nvfp4.cu +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmq-instance-q1_0.cu +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmq-instance-q2_k.cu +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmq-instance-q3_k.cu +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmq-instance-q4_0.cu +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmq-instance-q4_1.cu +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmq-instance-q4_k.cu +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmq-instance-q5_0.cu +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmq-instance-q5_1.cu +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmq-instance-q5_k.cu +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmq-instance-q6_k.cu +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/template-instances/mmq-instance-q8_0.cu +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/top-k.cu +95 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/top-k.cuh +3 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/topk-moe.cu +415 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/topk-moe.cuh +27 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/tri.cu +136 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/tri.cuh +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/tsembd.cu +47 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/tsembd.cuh +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/unary.cu +644 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/unary.cuh +116 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/upscale.cu +293 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/upscale.cuh +5 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/vecdotq.cuh +1317 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/vendors/cuda.h +28 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/vendors/hip.h +306 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/vendors/musa.h +148 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/wkv.cu +199 -0
- data/vendor/crispasr/ggml/src/ggml-cuda/wkv.cuh +7 -0
- data/vendor/crispasr/ggml/src/ggml-impl.h +783 -0
- data/vendor/crispasr/ggml/src/ggml-metal/CMakeLists.txt +124 -0
- data/vendor/crispasr/ggml/src/ggml-metal/ggml-metal-common.cpp +457 -0
- data/vendor/crispasr/ggml/src/ggml-metal/ggml-metal-common.h +52 -0
- data/vendor/crispasr/ggml/src/ggml-metal/ggml-metal-context.h +41 -0
- data/vendor/crispasr/ggml/src/ggml-metal/ggml-metal-context.m +778 -0
- data/vendor/crispasr/ggml/src/ggml-metal/ggml-metal-device.cpp +2117 -0
- data/vendor/crispasr/ggml/src/ggml-metal/ggml-metal-device.h +299 -0
- data/vendor/crispasr/ggml/src/ggml-metal/ggml-metal-device.m +2093 -0
- data/vendor/crispasr/ggml/src/ggml-metal/ggml-metal-impl.h +1267 -0
- data/vendor/crispasr/ggml/src/ggml-metal/ggml-metal-ops.cpp +5023 -0
- data/vendor/crispasr/ggml/src/ggml-metal/ggml-metal-ops.h +111 -0
- data/vendor/crispasr/ggml/src/ggml-metal/ggml-metal.cpp +954 -0
- data/vendor/crispasr/ggml/src/ggml-metal/ggml-metal.metal +11756 -0
- data/vendor/crispasr/ggml/src/ggml-opt.cpp +1094 -0
- data/vendor/crispasr/ggml/src/ggml-quants.c +5491 -0
- data/vendor/crispasr/ggml/src/ggml-quants.h +112 -0
- data/vendor/crispasr/ggml/src/ggml-threading.cpp +12 -0
- data/vendor/crispasr/ggml/src/ggml-threading.h +14 -0
- data/vendor/crispasr/ggml/src/ggml.c +7925 -0
- data/vendor/crispasr/ggml/src/ggml.cpp +26 -0
- data/vendor/crispasr/ggml/src/gguf.cpp +1556 -0
- data/vendor/crispasr/src/cohere-arch.h +137 -0
- data/vendor/crispasr/src/cohere.cpp +5642 -0
- data/vendor/crispasr/src/cohere.h +327 -0
- data/vendor/crispasr/src/cohere_batch_planner.h +82 -0
- data/vendor/crispasr/src/cohere_chunking.h +64 -0
- data/vendor/crispasr/src/cohere_decoder_batch_layout.h +60 -0
- data/vendor/crispasr/src/cohere_encoder_padded_layout.h +27 -0
- data/vendor/crispasr/src/cohere_frontend.cpp +189 -0
- data/vendor/crispasr/src/cohere_frontend.h +31 -0
- data/vendor/crispasr/src/cohere_ragged_controller.h +149 -0
- data/vendor/crispasr/src/cohere_token_renderer.h +181 -0
- data/vendor/crispasr/src/core/attention.h +924 -0
- data/vendor/crispasr/src/core/audio_chunking.h +97 -0
- data/vendor/crispasr/src/core/beam_decode.h +486 -0
- data/vendor/crispasr/src/core/cpu_ops.h +135 -0
- data/vendor/crispasr/src/core/gguf_loader.cpp +1021 -0
- data/vendor/crispasr/src/core/gguf_loader.h +216 -0
- data/vendor/crispasr/src/core/gpu_backend_pref.h +119 -0
- data/vendor/crispasr/src/core/mel.cpp +519 -0
- data/vendor/crispasr/src/core/mel.h +265 -0
- data/vendor/crispasr/src/core/ngram_loop_fix.h +173 -0
- data/vendor/crispasr/src/core/repetition_loop_guard.h +54 -0
- data/vendor/crispasr/src/crispasr_imatrix.cpp +255 -0
- data/vendor/crispasr/src/crispasr_imatrix.h +38 -0
- metadata +596 -0
|
@@ -0,0 +1,512 @@
|
|
|
1
|
+
cmake_minimum_required(VERSION 3.14...3.28) # for add_link_options and implicit target directories.
|
|
2
|
+
|
|
3
|
+
project("ggml" C CXX ASM)
|
|
4
|
+
|
|
5
|
+
### GGML Version
|
|
6
|
+
set(GGML_VERSION_MAJOR 0)
|
|
7
|
+
set(GGML_VERSION_MINOR 10)
|
|
8
|
+
set(GGML_VERSION_PATCH 2)
|
|
9
|
+
set(GGML_VERSION_BASE "${GGML_VERSION_MAJOR}.${GGML_VERSION_MINOR}.${GGML_VERSION_PATCH}")
|
|
10
|
+
|
|
11
|
+
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
|
|
12
|
+
|
|
13
|
+
find_program(GIT_EXE NAMES git git.exe NO_CMAKE_FIND_ROOT_PATH)
|
|
14
|
+
if(GIT_EXE)
|
|
15
|
+
# Get current git commit hash
|
|
16
|
+
execute_process(COMMAND ${GIT_EXE} rev-parse --short HEAD
|
|
17
|
+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
18
|
+
OUTPUT_VARIABLE GGML_BUILD_COMMIT
|
|
19
|
+
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
20
|
+
ERROR_QUIET
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
# Check if the working directory is dirty (i.e., has uncommitted changes)
|
|
24
|
+
execute_process(COMMAND ${GIT_EXE} diff-index --quiet HEAD -- .
|
|
25
|
+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
26
|
+
RESULT_VARIABLE GGML_GIT_DIRTY
|
|
27
|
+
ERROR_QUIET
|
|
28
|
+
)
|
|
29
|
+
endif()
|
|
30
|
+
|
|
31
|
+
set(GGML_VERSION "${GGML_VERSION_BASE}")
|
|
32
|
+
|
|
33
|
+
if(NOT GGML_BUILD_COMMIT)
|
|
34
|
+
set(GGML_BUILD_COMMIT "unknown")
|
|
35
|
+
endif()
|
|
36
|
+
|
|
37
|
+
# Build the commit string with optional dirty flag
|
|
38
|
+
if(DEFINED GGML_GIT_DIRTY AND GGML_GIT_DIRTY EQUAL 1)
|
|
39
|
+
set(GGML_BUILD_COMMIT "${GGML_BUILD_COMMIT}-dirty")
|
|
40
|
+
endif()
|
|
41
|
+
|
|
42
|
+
include(CheckIncludeFileCXX)
|
|
43
|
+
|
|
44
|
+
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
45
|
+
|
|
46
|
+
if (NOT XCODE AND NOT MSVC AND NOT CMAKE_BUILD_TYPE)
|
|
47
|
+
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE)
|
|
48
|
+
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
|
|
49
|
+
endif()
|
|
50
|
+
|
|
51
|
+
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
|
52
|
+
set(GGML_STANDALONE ON)
|
|
53
|
+
|
|
54
|
+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
|
55
|
+
|
|
56
|
+
# configure project version
|
|
57
|
+
# TODO
|
|
58
|
+
else()
|
|
59
|
+
set(GGML_STANDALONE OFF)
|
|
60
|
+
|
|
61
|
+
if (NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
|
|
62
|
+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
|
63
|
+
endif()
|
|
64
|
+
endif()
|
|
65
|
+
|
|
66
|
+
if (EMSCRIPTEN)
|
|
67
|
+
set(BUILD_SHARED_LIBS_DEFAULT OFF)
|
|
68
|
+
|
|
69
|
+
option(GGML_WASM_SINGLE_FILE "ggml: embed WASM inside the generated ggml.js" ON)
|
|
70
|
+
else()
|
|
71
|
+
if (MINGW)
|
|
72
|
+
set(BUILD_SHARED_LIBS_DEFAULT OFF)
|
|
73
|
+
else()
|
|
74
|
+
set(BUILD_SHARED_LIBS_DEFAULT ON)
|
|
75
|
+
endif()
|
|
76
|
+
endif()
|
|
77
|
+
|
|
78
|
+
# remove the lib prefix on win32 mingw
|
|
79
|
+
if (WIN32)
|
|
80
|
+
set(CMAKE_STATIC_LIBRARY_PREFIX "")
|
|
81
|
+
set(CMAKE_SHARED_LIBRARY_PREFIX "")
|
|
82
|
+
set(CMAKE_SHARED_MODULE_PREFIX "")
|
|
83
|
+
endif()
|
|
84
|
+
|
|
85
|
+
option(BUILD_SHARED_LIBS "ggml: build shared libraries" ${BUILD_SHARED_LIBS_DEFAULT})
|
|
86
|
+
option(GGML_BACKEND_DL "ggml: build backends as dynamic libraries (requires BUILD_SHARED_LIBS)" OFF)
|
|
87
|
+
set(GGML_BACKEND_DIR "" CACHE PATH "ggml: directory to load dynamic backends from (requires GGML_BACKEND_DL")
|
|
88
|
+
|
|
89
|
+
#
|
|
90
|
+
# option list
|
|
91
|
+
#
|
|
92
|
+
|
|
93
|
+
# TODO: mark all options as advanced when not GGML_STANDALONE
|
|
94
|
+
|
|
95
|
+
if (APPLE)
|
|
96
|
+
set(GGML_METAL_DEFAULT ON)
|
|
97
|
+
set(GGML_BLAS_DEFAULT ON)
|
|
98
|
+
set(GGML_BLAS_VENDOR_DEFAULT "Apple")
|
|
99
|
+
else()
|
|
100
|
+
set(GGML_METAL_DEFAULT OFF)
|
|
101
|
+
set(GGML_BLAS_DEFAULT OFF)
|
|
102
|
+
set(GGML_BLAS_VENDOR_DEFAULT "Generic")
|
|
103
|
+
endif()
|
|
104
|
+
|
|
105
|
+
if (CMAKE_CROSSCOMPILING OR DEFINED ENV{SOURCE_DATE_EPOCH})
|
|
106
|
+
message(STATUS "Setting GGML_NATIVE_DEFAULT to OFF")
|
|
107
|
+
set(GGML_NATIVE_DEFAULT OFF)
|
|
108
|
+
else()
|
|
109
|
+
set(GGML_NATIVE_DEFAULT ON)
|
|
110
|
+
endif()
|
|
111
|
+
|
|
112
|
+
# defaults
|
|
113
|
+
if (NOT GGML_LLAMAFILE_DEFAULT)
|
|
114
|
+
set(GGML_LLAMAFILE_DEFAULT OFF)
|
|
115
|
+
endif()
|
|
116
|
+
|
|
117
|
+
if (NOT GGML_CUDA_GRAPHS_DEFAULT)
|
|
118
|
+
# CrispASR: enable CUDA graphs by default. Capture is arch-gated to
|
|
119
|
+
# sm_80+ inside ggml-cuda (graph_check_compute_cap), so older GPUs are
|
|
120
|
+
# unaffected. Eliminates per-launch dispatch overhead for launch-bound
|
|
121
|
+
# decode loops (e.g. granite-speech LLM decode, see PERFORMANCE.md).
|
|
122
|
+
# Runtime escape hatch: GGML_CUDA_DISABLE_GRAPHS=1.
|
|
123
|
+
set(GGML_CUDA_GRAPHS_DEFAULT ON)
|
|
124
|
+
endif()
|
|
125
|
+
|
|
126
|
+
# general
|
|
127
|
+
option(GGML_STATIC "ggml: static link libraries" OFF)
|
|
128
|
+
option(GGML_NATIVE "ggml: optimize the build for the current system" ${GGML_NATIVE_DEFAULT})
|
|
129
|
+
option(GGML_LTO "ggml: enable link time optimization" OFF)
|
|
130
|
+
option(GGML_CCACHE "ggml: use ccache if available" ON)
|
|
131
|
+
|
|
132
|
+
# debug
|
|
133
|
+
option(GGML_ALL_WARNINGS "ggml: enable all compiler warnings" ON)
|
|
134
|
+
option(GGML_ALL_WARNINGS_3RD_PARTY "ggml: enable all compiler warnings in 3rd party libs" OFF)
|
|
135
|
+
option(GGML_GPROF "ggml: enable gprof" OFF)
|
|
136
|
+
|
|
137
|
+
# build
|
|
138
|
+
option(GGML_FATAL_WARNINGS "ggml: enable -Werror flag" OFF)
|
|
139
|
+
|
|
140
|
+
# sanitizers
|
|
141
|
+
option(GGML_SANITIZE_THREAD "ggml: enable thread sanitizer" OFF)
|
|
142
|
+
option(GGML_SANITIZE_ADDRESS "ggml: enable address sanitizer" OFF)
|
|
143
|
+
option(GGML_SANITIZE_UNDEFINED "ggml: enable undefined sanitizer" OFF)
|
|
144
|
+
|
|
145
|
+
# instruction set specific
|
|
146
|
+
if (GGML_NATIVE OR NOT GGML_NATIVE_DEFAULT)
|
|
147
|
+
set(INS_ENB OFF)
|
|
148
|
+
else()
|
|
149
|
+
set(INS_ENB ON)
|
|
150
|
+
endif()
|
|
151
|
+
|
|
152
|
+
message(DEBUG "GGML_NATIVE : ${GGML_NATIVE}")
|
|
153
|
+
message(DEBUG "GGML_NATIVE_DEFAULT : ${GGML_NATIVE_DEFAULT}")
|
|
154
|
+
message(DEBUG "INS_ENB : ${INS_ENB}")
|
|
155
|
+
|
|
156
|
+
option(GGML_CPU_HBM "ggml: use memkind for CPU HBM" OFF)
|
|
157
|
+
option(GGML_CPU_REPACK "ggml: use runtime weight conversion of Q4_0 to Q4_X_X" ON)
|
|
158
|
+
option(GGML_CPU_KLEIDIAI "ggml: use KleidiAI optimized kernels if applicable" OFF)
|
|
159
|
+
option(GGML_SSE42 "ggml: enable SSE 4.2" ${INS_ENB})
|
|
160
|
+
option(GGML_AVX "ggml: enable AVX" ${INS_ENB})
|
|
161
|
+
option(GGML_AVX_VNNI "ggml: enable AVX-VNNI" OFF)
|
|
162
|
+
option(GGML_AVX2 "ggml: enable AVX2" ${INS_ENB})
|
|
163
|
+
option(GGML_BMI2 "ggml: enable BMI2" ${INS_ENB})
|
|
164
|
+
option(GGML_AVX512 "ggml: enable AVX512F" OFF)
|
|
165
|
+
option(GGML_AVX512_VBMI "ggml: enable AVX512-VBMI" OFF)
|
|
166
|
+
option(GGML_AVX512_VNNI "ggml: enable AVX512-VNNI" OFF)
|
|
167
|
+
option(GGML_AVX512_BF16 "ggml: enable AVX512-BF16" OFF)
|
|
168
|
+
if (NOT MSVC)
|
|
169
|
+
# in MSVC F16C and FMA is implied with AVX2/AVX512
|
|
170
|
+
option(GGML_FMA "ggml: enable FMA" ${INS_ENB})
|
|
171
|
+
option(GGML_F16C "ggml: enable F16C" ${INS_ENB})
|
|
172
|
+
# MSVC does not seem to support AMX
|
|
173
|
+
option(GGML_AMX_TILE "ggml: enable AMX-TILE" OFF)
|
|
174
|
+
option(GGML_AMX_INT8 "ggml: enable AMX-INT8" OFF)
|
|
175
|
+
option(GGML_AMX_BF16 "ggml: enable AMX-BF16" OFF)
|
|
176
|
+
endif()
|
|
177
|
+
option(GGML_LASX "ggml: enable lasx" ON)
|
|
178
|
+
option(GGML_LSX "ggml: enable lsx" ON)
|
|
179
|
+
option(GGML_RVV "ggml: enable rvv" ON)
|
|
180
|
+
option(GGML_RV_ZFH "ggml: enable riscv zfh" ON)
|
|
181
|
+
option(GGML_RV_ZVFH "ggml: enable riscv zvfh" ON)
|
|
182
|
+
option(GGML_RV_ZICBOP "ggml: enable riscv zicbop" ON)
|
|
183
|
+
option(GGML_RV_ZIHINTPAUSE "ggml: enable riscv zihintpause" ON)
|
|
184
|
+
option(GGML_RV_ZVFBFWMA "ggml: enable riscv zvfbfwma" OFF)
|
|
185
|
+
option(GGML_XTHEADVECTOR "ggml: enable xtheadvector" OFF)
|
|
186
|
+
option(GGML_VXE "ggml: enable vxe" ${GGML_NATIVE})
|
|
187
|
+
|
|
188
|
+
option(GGML_CPU_ALL_VARIANTS "ggml: build all variants of the CPU backend (requires GGML_BACKEND_DL)" OFF)
|
|
189
|
+
set(GGML_CPU_ARM_ARCH "" CACHE STRING "ggml: CPU architecture for ARM")
|
|
190
|
+
set(GGML_CPU_POWERPC_CPUTYPE "" CACHE STRING "ggml: CPU type for PowerPC")
|
|
191
|
+
|
|
192
|
+
# ggml core
|
|
193
|
+
set(GGML_SCHED_MAX_COPIES "4" CACHE STRING "ggml: max input copies for pipeline parallelism")
|
|
194
|
+
option(GGML_CPU "ggml: enable CPU backend" ON)
|
|
195
|
+
option(GGML_SCHED_NO_REALLOC "ggml: disallow reallocations in ggml-alloc (for debugging)" OFF)
|
|
196
|
+
|
|
197
|
+
# 3rd party libs / backends
|
|
198
|
+
option(GGML_ACCELERATE "ggml: enable Accelerate framework" ON)
|
|
199
|
+
option(GGML_BLAS "ggml: use BLAS" ${GGML_BLAS_DEFAULT})
|
|
200
|
+
set(GGML_BLAS_VENDOR ${GGML_BLAS_VENDOR_DEFAULT} CACHE STRING
|
|
201
|
+
"ggml: BLAS library vendor")
|
|
202
|
+
option(GGML_LLAMAFILE "ggml: use LLAMAFILE" ${GGML_LLAMAFILE_DEFAULT})
|
|
203
|
+
|
|
204
|
+
option(GGML_CUDA "ggml: use CUDA" OFF)
|
|
205
|
+
option(GGML_MUSA "ggml: use MUSA" OFF)
|
|
206
|
+
option(GGML_CUDA_FORCE_MMQ "ggml: use mmq kernels instead of cuBLAS" OFF)
|
|
207
|
+
option(GGML_CUDA_FORCE_CUBLAS "ggml: always use cuBLAS instead of mmq kernels" OFF)
|
|
208
|
+
set (GGML_CUDA_PEER_MAX_BATCH_SIZE "128" CACHE STRING
|
|
209
|
+
"ggml: max. batch size for using peer access")
|
|
210
|
+
option(GGML_CUDA_NO_PEER_COPY "ggml: do not use peer to peer copies" OFF)
|
|
211
|
+
option(GGML_CUDA_NO_VMM "ggml: do not try to use CUDA VMM" OFF)
|
|
212
|
+
option(GGML_CUDA_FA "ggml: compile ggml FlashAttention CUDA kernels" ON)
|
|
213
|
+
option(GGML_CUDA_FA_ALL_QUANTS "ggml: compile all quants for FlashAttention" OFF)
|
|
214
|
+
option(GGML_CUDA_GRAPHS "ggml: use CUDA graphs (llama.cpp only)" ${GGML_CUDA_GRAPHS_DEFAULT})
|
|
215
|
+
option(GGML_CUDA_NCCL "ggml: use NVIDIA Collective Comm. Library" ON)
|
|
216
|
+
option(GGML_CUDA_CRISPASR_FA_PERHEAD_MASK
|
|
217
|
+
"CrispASR: allow per-head additive mask in CUDA FlashAttention (MMA-F16 path)"
|
|
218
|
+
OFF)
|
|
219
|
+
set (GGML_CUDA_COMPRESSION_MODE "size" CACHE STRING
|
|
220
|
+
"ggml: cuda link binary compression mode; requires cuda 12.8+")
|
|
221
|
+
set_property(CACHE GGML_CUDA_COMPRESSION_MODE PROPERTY STRINGS "none;speed;balance;size")
|
|
222
|
+
|
|
223
|
+
option(GGML_HIP "ggml: use HIP" OFF)
|
|
224
|
+
option(GGML_HIP_GRAPHS "ggml: use HIP graph" ON)
|
|
225
|
+
option(GGML_HIP_RCCL "ggml: use ROCm Collective Comm. Library" OFF)
|
|
226
|
+
option(GGML_HIP_NO_VMM "ggml: do not try to use HIP VMM" ON)
|
|
227
|
+
option(GGML_HIP_ROCWMMA_FATTN "ggml: enable rocWMMA for FlashAttention" OFF)
|
|
228
|
+
option(GGML_HIP_MMQ_MFMA "ggml: enable MFMA MMA for CDNA in MMQ" ON)
|
|
229
|
+
option(GGML_HIP_EXPORT_METRICS "ggml: enable kernel perf metrics output" OFF)
|
|
230
|
+
option(GGML_MUSA_GRAPHS "ggml: use MUSA graph, experimental, unstable" OFF)
|
|
231
|
+
option(GGML_MUSA_MUDNN_COPY "ggml: enable muDNN for accelerated copy" OFF)
|
|
232
|
+
option(GGML_VULKAN "ggml: use Vulkan" OFF)
|
|
233
|
+
option(GGML_VULKAN_CHECK_RESULTS "ggml: run Vulkan op checks" OFF)
|
|
234
|
+
option(GGML_VULKAN_DEBUG "ggml: enable Vulkan debug output" OFF)
|
|
235
|
+
option(GGML_VULKAN_MEMORY_DEBUG "ggml: enable Vulkan memory debug output" OFF)
|
|
236
|
+
option(GGML_VULKAN_SHADER_DEBUG_INFO "ggml: enable Vulkan shader debug info" OFF)
|
|
237
|
+
option(GGML_VULKAN_VALIDATE "ggml: enable Vulkan validation" OFF)
|
|
238
|
+
option(GGML_VULKAN_RUN_TESTS "ggml: run Vulkan tests" OFF)
|
|
239
|
+
option(GGML_WEBGPU "ggml: use WebGPU" OFF)
|
|
240
|
+
option(GGML_WEBGPU_DEBUG "ggml: enable WebGPU debug output" OFF)
|
|
241
|
+
option(GGML_WEBGPU_CPU_PROFILE "ggml: enable WebGPU profiling (CPU)" OFF)
|
|
242
|
+
option(GGML_WEBGPU_GPU_PROFILE "ggml: enable WebGPU profiling (GPU)" OFF)
|
|
243
|
+
option(GGML_WEBGPU_JSPI "ggml: use JSPI for WebGPU" ON)
|
|
244
|
+
option(GGML_ZDNN "ggml: use zDNN" OFF)
|
|
245
|
+
option(GGML_VIRTGPU "ggml: use the VirtGPU/Virglrenderer API Remoting frontend" OFF)
|
|
246
|
+
option(GGML_VIRTGPU_BACKEND "ggml: build the VirtGPU/Virglrenderer API Remoting backend" OFF)
|
|
247
|
+
option(GGML_METAL "ggml: use Metal" ${GGML_METAL_DEFAULT})
|
|
248
|
+
option(GGML_METAL_NDEBUG "ggml: disable Metal debugging" OFF)
|
|
249
|
+
option(GGML_METAL_SHADER_DEBUG "ggml: compile Metal with -fno-fast-math" OFF)
|
|
250
|
+
option(GGML_METAL_EMBED_LIBRARY "ggml: embed Metal library" ${GGML_METAL})
|
|
251
|
+
set (GGML_METAL_MACOSX_VERSION_MIN "" CACHE STRING
|
|
252
|
+
"ggml: metal minimum macOS version")
|
|
253
|
+
set (GGML_METAL_STD "" CACHE STRING "ggml: metal standard version (-std flag)")
|
|
254
|
+
option(GGML_OPENMP "ggml: use OpenMP" ON)
|
|
255
|
+
option(GGML_RPC "ggml: use RPC" OFF)
|
|
256
|
+
option(GGML_SYCL "ggml: use SYCL" OFF)
|
|
257
|
+
option(GGML_SYCL_F16 "ggml: use 16 bit floats for sycl calculations" OFF)
|
|
258
|
+
option(GGML_SYCL_GRAPH "ggml: enable graphs in the SYCL backend" ON)
|
|
259
|
+
option(GGML_SYCL_HOST_MEM_FALLBACK "ggml: allow host memory fallback in SYCL reorder (requires kernel 6.8+)" ON)
|
|
260
|
+
option(GGML_SYCL_DNN "ggml: enable oneDNN in the SYCL backend" ON)
|
|
261
|
+
set (GGML_SYCL_TARGET "INTEL" CACHE STRING
|
|
262
|
+
"ggml: sycl target device")
|
|
263
|
+
set (GGML_SYCL_DEVICE_ARCH "" CACHE STRING
|
|
264
|
+
"ggml: sycl device architecture")
|
|
265
|
+
|
|
266
|
+
option(GGML_OPENVINO "ggml: use OPENVINO" OFF)
|
|
267
|
+
|
|
268
|
+
option(GGML_OPENCL "ggml: use OpenCL" OFF)
|
|
269
|
+
option(GGML_OPENCL_PROFILING "ggml: use OpenCL profiling (increases overhead)" OFF)
|
|
270
|
+
option(GGML_OPENCL_EMBED_KERNELS "ggml: embed kernels" ON)
|
|
271
|
+
option(GGML_OPENCL_USE_ADRENO_KERNELS "ggml: use optimized kernels for Adreno" ON)
|
|
272
|
+
set (GGML_OPENCL_TARGET_VERSION "300" CACHE STRING
|
|
273
|
+
"ggml: OpenCL API version to target")
|
|
274
|
+
|
|
275
|
+
option(GGML_HEXAGON "ggml: enable Hexagon backend" OFF)
|
|
276
|
+
set(GGML_HEXAGON_FP32_QUANTIZE_GROUP_SIZE 128 CACHE STRING "ggml: quantize group size (32, 64, or 128)")
|
|
277
|
+
|
|
278
|
+
# toolchain for vulkan-shaders-gen
|
|
279
|
+
set (GGML_VULKAN_SHADERS_GEN_TOOLCHAIN "" CACHE FILEPATH "ggml: toolchain file for vulkan-shaders-gen")
|
|
280
|
+
|
|
281
|
+
option(GGML_ZENDNN "ggml: use ZenDNN" OFF)
|
|
282
|
+
option(ZENDNN_ROOT "ggml: path to ZenDNN installation" "")
|
|
283
|
+
|
|
284
|
+
# extra artifacts
|
|
285
|
+
option(GGML_BUILD_TESTS "ggml: build tests" ${GGML_STANDALONE})
|
|
286
|
+
option(GGML_BUILD_EXAMPLES "ggml: build examples" ${GGML_STANDALONE})
|
|
287
|
+
|
|
288
|
+
#
|
|
289
|
+
# dependencies
|
|
290
|
+
#
|
|
291
|
+
|
|
292
|
+
set(CMAKE_C_STANDARD 11)
|
|
293
|
+
set(CMAKE_C_STANDARD_REQUIRED true)
|
|
294
|
+
|
|
295
|
+
set(CMAKE_CXX_STANDARD 17)
|
|
296
|
+
set(CMAKE_CXX_STANDARD_REQUIRED true)
|
|
297
|
+
|
|
298
|
+
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
|
299
|
+
|
|
300
|
+
find_package(Threads REQUIRED)
|
|
301
|
+
|
|
302
|
+
include(GNUInstallDirs)
|
|
303
|
+
|
|
304
|
+
#
|
|
305
|
+
# build the library
|
|
306
|
+
#
|
|
307
|
+
|
|
308
|
+
add_subdirectory(src)
|
|
309
|
+
|
|
310
|
+
#
|
|
311
|
+
# tests and examples
|
|
312
|
+
#
|
|
313
|
+
|
|
314
|
+
if (GGML_BUILD_TESTS)
|
|
315
|
+
enable_testing()
|
|
316
|
+
add_subdirectory(tests)
|
|
317
|
+
endif ()
|
|
318
|
+
|
|
319
|
+
if (GGML_BUILD_EXAMPLES)
|
|
320
|
+
add_subdirectory(examples)
|
|
321
|
+
endif ()
|
|
322
|
+
|
|
323
|
+
#
|
|
324
|
+
# install
|
|
325
|
+
#
|
|
326
|
+
|
|
327
|
+
include(CMakePackageConfigHelpers)
|
|
328
|
+
|
|
329
|
+
# all public headers
|
|
330
|
+
set(GGML_PUBLIC_HEADERS
|
|
331
|
+
include/ggml.h
|
|
332
|
+
include/ggml-cpu.h
|
|
333
|
+
include/ggml-alloc.h
|
|
334
|
+
include/ggml-backend.h
|
|
335
|
+
include/ggml-blas.h
|
|
336
|
+
include/ggml-cann.h
|
|
337
|
+
include/ggml-cpp.h
|
|
338
|
+
include/ggml-cuda.h
|
|
339
|
+
include/ggml-opt.h
|
|
340
|
+
include/ggml-metal.h
|
|
341
|
+
include/ggml-rpc.h
|
|
342
|
+
include/ggml-virtgpu.h
|
|
343
|
+
include/ggml-sycl.h
|
|
344
|
+
include/ggml-vulkan.h
|
|
345
|
+
include/ggml-webgpu.h
|
|
346
|
+
include/ggml-zendnn.h
|
|
347
|
+
include/ggml-openvino.h
|
|
348
|
+
include/gguf.h)
|
|
349
|
+
|
|
350
|
+
set_target_properties(ggml PROPERTIES PUBLIC_HEADER "${GGML_PUBLIC_HEADERS}")
|
|
351
|
+
#if (GGML_METAL)
|
|
352
|
+
# set_target_properties(ggml PROPERTIES RESOURCE "${CMAKE_CURRENT_SOURCE_DIR}/src/ggml-metal.metal")
|
|
353
|
+
#endif()
|
|
354
|
+
install(TARGETS ggml LIBRARY PUBLIC_HEADER)
|
|
355
|
+
install(TARGETS ggml-base LIBRARY)
|
|
356
|
+
|
|
357
|
+
if (GGML_STANDALONE)
|
|
358
|
+
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ggml.pc.in
|
|
359
|
+
${CMAKE_CURRENT_BINARY_DIR}/ggml.pc
|
|
360
|
+
@ONLY)
|
|
361
|
+
|
|
362
|
+
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ggml.pc
|
|
363
|
+
DESTINATION share/pkgconfig)
|
|
364
|
+
endif()
|
|
365
|
+
|
|
366
|
+
#
|
|
367
|
+
# Create CMake package
|
|
368
|
+
#
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
# Capture variables prefixed with GGML_.
|
|
373
|
+
|
|
374
|
+
set(variable_set_statements
|
|
375
|
+
"
|
|
376
|
+
####### Expanded from @GGML_VARIABLES_EXPANED@ by configure_package_config_file() #######
|
|
377
|
+
####### Any changes to this file will be overwritten by the next CMake run #######
|
|
378
|
+
|
|
379
|
+
")
|
|
380
|
+
|
|
381
|
+
set(GGML_SHARED_LIB ${BUILD_SHARED_LIBS})
|
|
382
|
+
|
|
383
|
+
get_cmake_property(all_variables VARIABLES)
|
|
384
|
+
foreach(variable_name IN LISTS all_variables)
|
|
385
|
+
if(variable_name MATCHES "^GGML_")
|
|
386
|
+
string(REPLACE ";" "\\;"
|
|
387
|
+
variable_value "${${variable_name}}")
|
|
388
|
+
|
|
389
|
+
set(variable_set_statements
|
|
390
|
+
"${variable_set_statements}set(${variable_name} \"${variable_value}\")\n")
|
|
391
|
+
endif()
|
|
392
|
+
endforeach()
|
|
393
|
+
|
|
394
|
+
set(GGML_VARIABLES_EXPANDED ${variable_set_statements})
|
|
395
|
+
|
|
396
|
+
# Create the CMake package and set install location.
|
|
397
|
+
|
|
398
|
+
set(GGML_INSTALL_VERSION ${GGML_VERSION})
|
|
399
|
+
set(GGML_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR} CACHE PATH "Location of header files")
|
|
400
|
+
set(GGML_LIB_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR} CACHE PATH "Location of library files")
|
|
401
|
+
set(GGML_BIN_INSTALL_DIR ${CMAKE_INSTALL_BINDIR} CACHE PATH "Location of binary files")
|
|
402
|
+
|
|
403
|
+
configure_package_config_file(
|
|
404
|
+
${CMAKE_CURRENT_SOURCE_DIR}/cmake/ggml-config.cmake.in
|
|
405
|
+
${CMAKE_CURRENT_BINARY_DIR}/ggml-config.cmake
|
|
406
|
+
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ggml
|
|
407
|
+
PATH_VARS GGML_INCLUDE_INSTALL_DIR
|
|
408
|
+
GGML_LIB_INSTALL_DIR
|
|
409
|
+
GGML_BIN_INSTALL_DIR)
|
|
410
|
+
|
|
411
|
+
write_basic_package_version_file(
|
|
412
|
+
${CMAKE_CURRENT_BINARY_DIR}/ggml-version.cmake
|
|
413
|
+
VERSION ${GGML_INSTALL_VERSION}
|
|
414
|
+
COMPATIBILITY SameMajorVersion)
|
|
415
|
+
|
|
416
|
+
target_compile_definitions(ggml-base PRIVATE
|
|
417
|
+
GGML_VERSION="${GGML_INSTALL_VERSION}"
|
|
418
|
+
GGML_COMMIT="${GGML_BUILD_COMMIT}"
|
|
419
|
+
)
|
|
420
|
+
message(STATUS "ggml version: ${GGML_INSTALL_VERSION}")
|
|
421
|
+
message(STATUS "ggml commit: ${GGML_BUILD_COMMIT}")
|
|
422
|
+
|
|
423
|
+
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ggml-config.cmake
|
|
424
|
+
${CMAKE_CURRENT_BINARY_DIR}/ggml-version.cmake
|
|
425
|
+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ggml)
|
|
426
|
+
|
|
427
|
+
if (MSVC)
|
|
428
|
+
set(MSVC_WARNING_FLAGS
|
|
429
|
+
/wd4005 # Macro redefinition
|
|
430
|
+
/wd4244 # Conversion from one type to another type, possible loss of data
|
|
431
|
+
/wd4267 # Conversion from 'size_t' to a smaller type, possible loss of data
|
|
432
|
+
/wd4305 # Conversion from 'type1' to 'type2', possible loss of data
|
|
433
|
+
/wd4566 # Conversion from 'char' to 'wchar_t', possible loss of data
|
|
434
|
+
/wd4996 # Disable POSIX deprecation warnings
|
|
435
|
+
/wd4702 # Unreachable code warnings
|
|
436
|
+
)
|
|
437
|
+
set(MSVC_COMPILE_OPTIONS
|
|
438
|
+
"$<$<COMPILE_LANGUAGE:C>:/utf-8>"
|
|
439
|
+
"$<$<COMPILE_LANGUAGE:CXX>:/utf-8>"
|
|
440
|
+
)
|
|
441
|
+
function(configure_msvc_target target_name)
|
|
442
|
+
if(TARGET ${target_name})
|
|
443
|
+
target_compile_options(${target_name} PRIVATE ${MSVC_WARNING_FLAGS})
|
|
444
|
+
target_compile_options(${target_name} PRIVATE ${MSVC_COMPILE_OPTIONS})
|
|
445
|
+
endif()
|
|
446
|
+
endfunction()
|
|
447
|
+
|
|
448
|
+
configure_msvc_target(ggml-base)
|
|
449
|
+
configure_msvc_target(ggml)
|
|
450
|
+
configure_msvc_target(ggml-cpu)
|
|
451
|
+
configure_msvc_target(ggml-cpu-x64)
|
|
452
|
+
configure_msvc_target(ggml-cpu-sse42)
|
|
453
|
+
configure_msvc_target(ggml-cpu-sandybridge)
|
|
454
|
+
# __FMA__ and __F16C__ are not defined in MSVC, however they are implied with AVX2/AVX512
|
|
455
|
+
# skipping ggml-cpu-ivybridge
|
|
456
|
+
# skipping ggml-cpu-piledriver
|
|
457
|
+
configure_msvc_target(ggml-cpu-haswell)
|
|
458
|
+
configure_msvc_target(ggml-cpu-skylakex)
|
|
459
|
+
configure_msvc_target(ggml-cpu-cannonlake)
|
|
460
|
+
configure_msvc_target(ggml-cpu-cascadelake)
|
|
461
|
+
configure_msvc_target(ggml-cpu-icelake)
|
|
462
|
+
# MSVC 2022 doesn't support BF16 intrinsics without `/arch:AVX10.1` ?!
|
|
463
|
+
# https://learn.microsoft.com/en-us/cpp/intrinsics/x64-amd64-intrinsics-list?view=msvc-170
|
|
464
|
+
# https://learn.microsoft.com/en-us/cpp/build/reference/arch-x64?view=msvc-170
|
|
465
|
+
# skipping ggml-cpu-cooperlake
|
|
466
|
+
# skipping ggml-cpu-zen4
|
|
467
|
+
configure_msvc_target(ggml-cpu-alderlake)
|
|
468
|
+
# MSVC doesn't support AMX
|
|
469
|
+
# skipping ggml-cpu-sapphirerapids
|
|
470
|
+
|
|
471
|
+
if (GGML_BUILD_EXAMPLES)
|
|
472
|
+
configure_msvc_target(common-ggml)
|
|
473
|
+
configure_msvc_target(common)
|
|
474
|
+
|
|
475
|
+
configure_msvc_target(mnist-common)
|
|
476
|
+
configure_msvc_target(mnist-eval)
|
|
477
|
+
configure_msvc_target(mnist-train)
|
|
478
|
+
|
|
479
|
+
configure_msvc_target(gpt-2-ctx)
|
|
480
|
+
configure_msvc_target(gpt-2-alloc)
|
|
481
|
+
configure_msvc_target(gpt-2-backend)
|
|
482
|
+
configure_msvc_target(gpt-2-sched)
|
|
483
|
+
configure_msvc_target(gpt-2-quantize)
|
|
484
|
+
configure_msvc_target(gpt-2-batched)
|
|
485
|
+
|
|
486
|
+
configure_msvc_target(gpt-j)
|
|
487
|
+
configure_msvc_target(gpt-j-quantize)
|
|
488
|
+
|
|
489
|
+
configure_msvc_target(magika)
|
|
490
|
+
configure_msvc_target(yolov3-tiny)
|
|
491
|
+
configure_msvc_target(sam)
|
|
492
|
+
|
|
493
|
+
configure_msvc_target(simple-ctx)
|
|
494
|
+
configure_msvc_target(simple-backend)
|
|
495
|
+
endif()
|
|
496
|
+
|
|
497
|
+
if (GGML_BUILD_TESTS)
|
|
498
|
+
configure_msvc_target(test-mul-mat)
|
|
499
|
+
configure_msvc_target(test-arange)
|
|
500
|
+
configure_msvc_target(test-backend-ops)
|
|
501
|
+
configure_msvc_target(test-cont)
|
|
502
|
+
configure_msvc_target(test-conv-transpose)
|
|
503
|
+
configure_msvc_target(test-conv-transpose-1d)
|
|
504
|
+
configure_msvc_target(test-conv1d)
|
|
505
|
+
configure_msvc_target(test-conv2d)
|
|
506
|
+
configure_msvc_target(test-conv2d-dw)
|
|
507
|
+
configure_msvc_target(test-customop)
|
|
508
|
+
configure_msvc_target(test-dup)
|
|
509
|
+
configure_msvc_target(test-opt)
|
|
510
|
+
configure_msvc_target(test-pool)
|
|
511
|
+
endif ()
|
|
512
|
+
endif()
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023-2026 The ggml authors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# ggml
|
|
2
|
+
|
|
3
|
+
[Manifesto](https://github.com/ggerganov/llama.cpp/discussions/205)
|
|
4
|
+
|
|
5
|
+
Tensor library for machine learning
|
|
6
|
+
|
|
7
|
+
***Note that this project is under active development. Some of the development is currently happening in the [llama.cpp](https://github.com/ggerganov/llama.cpp) and [whisper.cpp](https://github.com/ggerganov/whisper.cpp) repos***
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- Low-level cross-platform implementation
|
|
12
|
+
- Integer quantization support
|
|
13
|
+
- Broad hardware support
|
|
14
|
+
- Automatic differentiation
|
|
15
|
+
- ADAM and L-BFGS optimizers
|
|
16
|
+
- No third-party dependencies
|
|
17
|
+
- Zero memory allocations during runtime
|
|
18
|
+
|
|
19
|
+
## Build
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
git clone https://github.com/ggml-org/ggml
|
|
23
|
+
cd ggml
|
|
24
|
+
|
|
25
|
+
# install python dependencies in a virtual environment
|
|
26
|
+
python3.10 -m venv .venv
|
|
27
|
+
source .venv/bin/activate
|
|
28
|
+
pip install -r requirements.txt
|
|
29
|
+
|
|
30
|
+
# build the examples
|
|
31
|
+
mkdir build && cd build
|
|
32
|
+
cmake ..
|
|
33
|
+
cmake --build . --config Release -j 8
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## GPT inference (example)
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
# run the GPT-2 small 117M model
|
|
40
|
+
../examples/gpt-2/download-ggml-model.sh 117M
|
|
41
|
+
./bin/gpt-2-backend -m models/gpt-2-117M/ggml-model.bin -p "This is an example"
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
For more information, checkout the corresponding programs in the [examples](examples) folder.
|
|
45
|
+
|
|
46
|
+
## Resources
|
|
47
|
+
|
|
48
|
+
- [Introduction to ggml](https://huggingface.co/blog/introduction-to-ggml)
|
|
49
|
+
- [The GGUF file format](https://github.com/ggerganov/ggml/blob/master/docs/gguf.md)
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# cmake/FindNCCL.cmake
|
|
2
|
+
|
|
3
|
+
# NVIDIA does not distribute CMake files with NCCl, therefore use this file to find it instead.
|
|
4
|
+
|
|
5
|
+
find_path(NCCL_INCLUDE_DIR
|
|
6
|
+
NAMES nccl.h
|
|
7
|
+
HINTS ${NCCL_ROOT} $ENV{NCCL_ROOT} $ENV{CUDA_HOME} /usr/local/cuda
|
|
8
|
+
PATH_SUFFIXES include
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
find_library(NCCL_LIBRARY
|
|
12
|
+
NAMES nccl
|
|
13
|
+
HINTS ${NCCL_ROOT} $ENV{NCCL_ROOT} $ENV{CUDA_HOME} /usr/local/cuda
|
|
14
|
+
PATH_SUFFIXES lib lib64
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
include(FindPackageHandleStandardArgs)
|
|
18
|
+
find_package_handle_standard_args(NCCL
|
|
19
|
+
DEFAULT_MSG
|
|
20
|
+
NCCL_LIBRARY NCCL_INCLUDE_DIR
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
if(NCCL_FOUND)
|
|
24
|
+
set(NCCL_LIBRARIES ${NCCL_LIBRARY})
|
|
25
|
+
set(NCCL_INCLUDE_DIRS ${NCCL_INCLUDE_DIR})
|
|
26
|
+
|
|
27
|
+
if(NOT TARGET NCCL::NCCL)
|
|
28
|
+
add_library(NCCL::NCCL UNKNOWN IMPORTED)
|
|
29
|
+
set_target_properties(NCCL::NCCL PROPERTIES
|
|
30
|
+
IMPORTED_LOCATION "${NCCL_LIBRARY}"
|
|
31
|
+
INTERFACE_INCLUDE_DIRECTORIES "${NCCL_INCLUDE_DIR}"
|
|
32
|
+
)
|
|
33
|
+
endif()
|
|
34
|
+
endif()
|
|
35
|
+
|
|
36
|
+
mark_as_advanced(NCCL_INCLUDE_DIR NCCL_LIBRARY)
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
find_package(Git)
|
|
2
|
+
|
|
3
|
+
# the commit's SHA1
|
|
4
|
+
execute_process(COMMAND
|
|
5
|
+
"${GIT_EXECUTABLE}" describe --match=NeVeRmAtCh --always --abbrev=8
|
|
6
|
+
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
|
7
|
+
OUTPUT_VARIABLE GIT_SHA1
|
|
8
|
+
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
9
|
+
|
|
10
|
+
# the date of the commit
|
|
11
|
+
execute_process(COMMAND
|
|
12
|
+
"${GIT_EXECUTABLE}" log -1 --format=%ad --date=local
|
|
13
|
+
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
|
14
|
+
OUTPUT_VARIABLE GIT_DATE
|
|
15
|
+
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
16
|
+
|
|
17
|
+
# the subject of the commit
|
|
18
|
+
execute_process(COMMAND
|
|
19
|
+
"${GIT_EXECUTABLE}" log -1 --format=%s
|
|
20
|
+
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
|
21
|
+
OUTPUT_VARIABLE GIT_COMMIT_SUBJECT
|
|
22
|
+
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|