rlx 0.2.13

RLX — small ML compiler + runtime for transformer inference and training. JAX-shaped IR, autodiff, vmap, on top of CPU / Apple Silicon (Metal / MLX) / NVIDIA / AMD / TPU / wgpu backends. This is the prelude crate; pulls in rlx-ir / rlx-opt / rlx-runtime and re-exports the common types.
Documentation
[package]
name = "rlx"
version.workspace      = true
edition.workspace       = true
rust-version.workspace = true
description = "RLX — small ML compiler + runtime for transformer inference and training. JAX-shaped IR, autodiff, vmap, on top of CPU / Apple Silicon (Metal / MLX) / NVIDIA / AMD / TPU / wgpu backends. This is the prelude crate; pulls in rlx-ir / rlx-opt / rlx-runtime and re-exports the common types."
authors.workspace       = true
license.workspace       = true
keywords.workspace      = true
categories.workspace    = true
readme                  = "README.md"
repository.workspace    = true
homepage.workspace      = true
documentation.workspace = true

[features]
# Default to CPU only so `cargo add rlx` works on every host without
# extra setup. `tensor` ships the NumPy-style `Tensor` DSL in the prelude
# (a thin rlx-ir graph builder, no backend of its own). Pick GPU /
# accelerator features explicitly.
default = ["cpu", "tensor"]

# ── Backend features (delegated to rlx-runtime) ─────────────────
# Each also turns on `rlx-tensor`'s matching `eval` backend *iff* the
# `tensor` feature is enabled (weak `rlx-tensor?/…` syntax), so
# `rlx::tensor::Tensor::to_vec` / `.on(Device::…)` materialize on every
# backend the umbrella was built with — without forcing `rlx-tensor` in.
cpu             = ["rlx-runtime/cpu",             "rlx-tensor?/eval"]
metal           = ["rlx-runtime/metal",           "rlx-tensor?/eval-metal"]
mlx             = ["rlx-runtime/mlx",             "rlx-tensor?/eval-mlx"]
mlx-cuda        = ["rlx-runtime/mlx-cuda",         "rlx-tensor?/eval"]
# Apple CoreML / Neural Engine backend (`Device::Ane`).
coreml          = ["rlx-runtime/coreml"]
gpu             = ["rlx-runtime/gpu",             "rlx-tensor?/eval-gpu"]
# Native Vulkan compute backend (`Device::Vulkan`) — own `ash` instance +
# embedded SPIR-V kernels, distinct from the wgpu Vulkan adapter (`gpu`).
vulkan          = ["rlx-runtime/vulkan",          "rlx-tensor?/eval-gpu"]
# Intel oneAPI Level Zero backend (`Device::OneApi`) — own `libze_loader`
# context + SPIR-V compute kernels (peak Intel path), distinct from `gpu`/`vulkan`.
oneapi          = ["rlx-runtime/oneapi",           "rlx-tensor?/eval-gpu"]
cuda            = ["rlx-runtime/cuda",             "rlx-tensor?/eval-cuda"]
rocm            = ["rlx-runtime/rocm",             "rlx-tensor?/eval-rocm"]
tpu             = ["rlx-runtime/tpu",             "rlx-tensor?/eval"]
blas-accelerate = ["rlx-runtime/blas-accelerate", "rlx-tensor?/eval-blas"]
blas-mkl        = ["rlx-runtime/blas-mkl",         "rlx-tensor?/eval"]
blas-openblas   = ["rlx-runtime/blas-openblas",    "rlx-tensor?/eval"]

# ── Optional re-exports of companion crates ─────────────────────
# Off by default — `rlx::gguf` / etc. only show up when enabled.
# `tensor` is on by default (see above) but still gateable: build with
# `--no-default-features` to drop the DSL and its rlx-ir-only surface.
tensor  = ["dep:rlx-tensor"]
gguf    = ["dep:rlx-gguf"]
# safetensors / ONNX → GGUF conversion with per-tensor quant. Pulls in
# rlx-gguf transparently (re-exported as `rlx::gguf`).
gguf-convert = ["dep:rlx-gguf-convert", "dep:rlx-gguf"]
bench   = ["dep:rlx-bench"]
sparse  = ["dep:rlx-sparse"]
linalg  = ["dep:rlx-linalg"]
splat   = []   # rlx-splat moved to ../rlx-splat; no-op feature (was ["dep:rlx-splat"]) — keeps cfg gates valid
umap    = ["dep:rlx-umap"]
optim   = ["dep:rlx-optim"]
# In-graph collective ops (`rlx::collectives`) + the unified `rlx::distributed`
# front door. The ship-graph worker/coordinator + heterogeneous-placement API
# (`rlx::runtime::dist` / `rlx::runtime::hetero`) is always present; this feature
# adds the in-graph `collective.*` op builders, the group registry, and the
# device-mesh / placement planner, then re-exports all three layers together.
distributed = ["dep:rlx-collectives"]
# Specialty targets that don't fit the `Backend` trait (no
# `Session::compile` path through the runtime) — exposed as
# `rlx::cortexm::*` and `rlx::fpga::*` for users who want their
# kernels / codegen surface without a separate dep entry.
cortexm = ["dep:rlx-cortexm"]
fpga    = ["dep:rlx-fpga", "rlx-runtime/fpga"]
# ONNX Runtime — run `.onnx` models on RLX Device backends (ORT EPs).
# Enable GPU EPs with e.g. `--features onnx,cuda` or `onnx,metal`.
onnx    = ["dep:rlx-onnx", "rlx-onnx/native", "rlx-onnx/cuda", "rlx-onnx/metal", "rlx-onnx/mlx", "rlx-onnx/gpu", "rlx-onnx/rocm"]

# ── Convenience aggregates ──────────────────────────────────────
# Single-flag setups for common platforms. Each composes the
# fragments most users want for that target. Aggregates only
# Aggregates only include features that resolve from crates.io.
# `mlx` needs `rlx-mlx-sys` (vendored MLX submodule) on the index.
apple-silicon = ["cpu", "metal", "blas-accelerate"]
nvidia        = ["cpu", "cuda"]
edge          = ["cpu", "cortexm", "fpga"]
all-cpu       = ["cpu", "gguf", "linalg"]

[dependencies]
rlx-ir      = { path = "../core/rlx-ir",      version = "0.2.13" }
rlx-tensor  = { path = "../core/rlx-tensor", version = "0.2.13", optional = true }
rlx-opt     = { path = "../core/rlx-opt",     version = "0.2.13" }
rlx-driver  = { path = "../core/rlx-driver",  version = "0.2.13" }
rlx-macros  = { path = "../core/rlx-macros",  version = "0.2.13" }
rlx-runtime = { path = "../core/rlx-runtime", version = "0.2.13", default-features = false }
rlx-collectives = { path = "../core/rlx-collectives", version = "0.2.13", optional = true }
rlx-gguf     = { path = "../io/rlx-gguf",    version = "0.2.13", optional = true }
rlx-gguf-convert = { path = "../io/rlx-gguf-convert", version = "0.2.13", optional = true }
rlx-bench   = { path = "../tooling/rlx-bench",   version = "0.2.13", optional = true }
rlx-sparse  = { path = "../numerics/rlx-sparse",  version = "0.2.13", optional = true }
rlx-linalg  = { path = "../numerics/rlx-linalg",  version = "0.2.13", optional = true }
# rlx-splat   = { path = "../rlx-splat",   version = "0.2.13", optional = true, default-features = false, features = ["cpu", "core"] }
rlx-umap    = { path = "../numerics/rlx-umap",    version = "0.2.13", optional = true, default-features = false, features = ["cpu", "graph"] }
rlx-optim   = { path = "../core/rlx-optim",   version = "0.2.13", optional = true }
# rlx-cortexm is `no_std` by default; we want the host-side parity
# kernels (the `std` feature) when re-exported from the prelude.
rlx-cortexm = { path = "../backends/rlx-cortexm", version = "0.2.13", optional = true, default-features = false, features = ["std"] }
rlx-fpga    = { path = "../backends/rlx-fpga",    version = "0.2.13", optional = true }
rlx-onnx    = { path = "../io/rlx-onnx",    version = "0.2.13", optional = true, default-features = true }
# `rlx::Result` / `rlx::Error` type aliases. Every workspace crate
# already pulls anyhow in transitively (rlx-runtime, rlx-gguf), so this
# adds no real bytes — just makes the alias
# expressible without a fragile re-export through one of them.
anyhow = "1"

[lints]
workspace = true

# docs.rs builds in a Linux container without macOS / NVIDIA / AMD /
# TPU toolchains, so we skip the platform-locked backend features and
# enable the cross-platform ones plus all companion modules. Users
# browsing https://docs.rs/rlx see the full IR / opt / runtime API
# along with `rlx::gguf`, `rlx::bench`, `rlx::sparse`, `rlx::linalg`.
[package.metadata.docs.rs]
features      = ["cpu", "tensor", "gpu", "gguf", "bench", "sparse", "linalg", "cortexm", "fpga", "optim", "distributed"]
rustdoc-args  = ["--cfg", "docsrs"]
all-features  = false