Skip to content

InftyAI/mlx

Repository files navigation

MLX

Rust bindings for Apple's MLX framework.

Platform: Apple Silicon (macOS) only.

Architecture

The bindings are layered, the same way as MLX Swift:

mlxcore      (safe, idiomatic Rust API)   <- crates/mlxcore
mlxcore-sys  (raw unsafe FFI bindings)    <- crates/mlxcore-sys, generated by bindgen
mlx-c     (Apple's C API for MLX)      <- third_party/mlx-c (git submodule)
mlx       (Apple's C++ framework)      <- fetched by mlx-c's CMake build

MLX itself is C++, which Rust cannot bind to directly. We bind against mlx-c, Apple's official C API, whose CMake build pulls in MLX via FetchContent.

Building

git submodule update --init --recursive
make build
make test

Requirements: a recent Rust toolchain, make, cmake, and Xcode command-line tools. The first build compiles MLX from source and takes several minutes.

Examples

Runnable examples live in crates/mlxcore/examples:

cargo run --example hello

Features

  • metal (default) — GPU backend via Metal.
  • accelerate (default) — CPU BLAS via Apple's Accelerate framework.

About

Rust bindings for Apple’s MLX framework.

Topics

Resources

License

Code of conduct

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Generated from InftyAI/template-repo