13 releases (breaking)

new 0.10.0-alpha.0 Apr 15, 2024
0.9.0-alpha.0 Mar 30, 2024
0.8.0-alpha.0 Mar 22, 2024

#270 in Unix APIs

Download history 1/week @ 2024-02-02 149/week @ 2024-02-09 154/week @ 2024-02-16 168/week @ 2024-02-23 137/week @ 2024-03-01 416/week @ 2024-03-08 147/week @ 2024-03-15 140/week @ 2024-03-22 184/week @ 2024-03-29 12/week @ 2024-04-05

558 downloads per month

MIT license

3MB
68K SLoC

C++ 43K SLoC // 0.1% comments Python 15K SLoC // 0.2% comments Metal Shading Language 7.5K SLoC // 0.1% comments Rust 3.5K SLoC // 0.1% comments Shell 32 SLoC // 0.3% comments

mlx-sys

DO NOT USE. This is an experimental crate for testing right now, and it is not intended to be used directly. A separate safe wrapper crate will be created in the future.


Naming

  • Numeric types that are not in the rust standard library will use whatever the MLX library uses, eg. float16_t
  • Trivial C++ types, if not following the rust naming convention, will be renamed to follow the rust naming conventions. This includes enums and structs, eg. DeviceType::Cpu.
  • Opaque C++ types will use whatever the MLX library uses, eg. array.

Exception and Result

The overall strategy for catching exceptions and turning them into Rust errors is

  1. Ignore memory allocation exceptions. This is consistent with the behavior of Vec in rust.
  2. load_library or get_kernel, this would include all ops and usually indicates a problem with the library, so we should probably just let it panic

Dependencies