#mlx #deep-learning #machine-learning

sys mlx-sys

Low-level interface and binding generation for the mlx library

1 unstable release

0.10.0-alpha.0 Apr 15, 2024
0.9.0-alpha.0 Mar 30, 2024
0.8.0-alpha.0 Mar 22, 2024
0.0.8 Jul 13, 2024

#638 in Machine learning

Download history 3/week @ 2024-07-28 18/week @ 2024-09-15 9/week @ 2024-09-22 5/week @ 2024-09-29

838 downloads per month
Used in mlx-rs

MIT/Apache

145KB
3K SLoC

C++ 2.5K SLoC // 0.0% comments Python 421 SLoC // 0.1% comments C 149 SLoC // 0.0% comments Rust 60 SLoC // 0.0% 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

No runtime deps

~0–2.2MB
~44K SLoC