1 unstable release

0.0.1 Aug 16, 2025

#23 in #ggml

MIT license

9MB
151K SLoC

C++ 78K SLoC // 0.1% comments C 28K SLoC // 0.0% comments CUDA 13K SLoC // 0.0% comments GLSL 10K SLoC // 0.0% comments OpenCL 6.5K SLoC Metal Shading Language 6K SLoC // 0.0% comments Objective-C 5.5K SLoC // 0.0% comments Python 2.5K SLoC // 0.4% comments Shell 639 SLoC // 0.2% comments Rust 165 SLoC // 0.1% comments

ggml-ffi

Low-level Rust FFI bindings to the GGML C API shipped in this repository under ggml/.

There are no semantic versioning guarantees. Each version of this crate is tied to a specific GGML commit. This crate's version should only be used to pin GGML revisions.

Features

  • metal: Enable GGML_METAL backend and link Metal frameworks on Apple.
  • cuda: Enable GGML_CUDA backend and link CUDA runtime/BLAS libraries.
  • vulkan: Enable GGML_VULKAN backend and link libvulkan.
  • opencl: Enable GGML_OPENCL backend and link OpenCL (framework on Apple).
  • hip: Enable GGML_HIP backend (requires ROCm toolchain).
  • musa: Enable GGML_MUSA backend.
  • sycl: Enable GGML_SYCL backend (requires SYCL toolchain).
  • webgpu: Enable GGML_WEBGPU backend (requires WebGPU support in ggml).

Examples

  • CPU only (default): cargo build
  • Metal on macOS: cargo build --features metal
  • CUDA on Linux: cargo build --features cuda
  • Vulkan: cargo build --features vulkan
  • OpenCL: cargo build --features opencl

Note: Enabling a backend requires the corresponding SDK/toolchain to be installed and discoverable by CMake.

Dependencies