Skip to main content

Crate mlx_core

Crate mlx_core 

Source
Expand description

Safe, ergonomic Rust API for MLX tensors and operations.

mlx-core provides the foundational types (Tensor, Device, DType, Shape) and a backend-agnostic interface for lazy tensor computation.

§Architecture

Operations on tensors build a lazy computation graph. Calling eval() (or to_vec_f32()) triggers a topological walk that dispatches each node to the active Backend. A default CPU reference backend is provided out of the box.

§Backends

  • Built-in CPU reference: simple, safe Rust — always available
  • ffi feature: delegates to the MLX C++ runtime via mlx-sys
  • mlx-cpu crate: optimized pure-Rust CPU backend (future)
  • mlx-metal crate: native Apple Silicon acceleration (future)

Re-exports§

pub use graph::NodeId;
pub use tensor::Device;
pub use tensor::Tensor;
pub use types::DType;
pub use types::Shape;

Modules§

backend
Backend trait and Stream — pluggable compute engine for tensor evaluation.
cpu_kernels
Built-in CPU reference backend — correctness oracle.
graph
Lazy computation graph IR.
tensor
Tensor type — a lazy handle to a node in the computation graph.
types
Core type definitions: DType, Shape.

Enums§

MlxError

Type Aliases§

Result