rlx_driver/lib.rs
1// RLX — versatile ML compiler + runtime.
2// Copyright (C) 2026 Eugene Hauptmann, Nataliya Kosmyna.
3//
4// This program is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation, version 3.
7//
8// This program is distributed in the hope that it will be useful,
9// but WITHOUT ANY WARRANTY; without even the implied warranty of
10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11// GNU General Public License for more details.
12//
13// You should have received a copy of the GNU General Public License
14// along with this program. If not, see <https://www.gnu.org/licenses/>.
15
16//! RLX driver layer — devices, arenas, buffers, command streams
17//! (plan #58).
18//!
19//! Borrowed from MAX's three-layer separation: graph (IR) →
20//! engine (compiled artifacts, sessions) → driver (devices,
21//! buffers). The Rust spelling sits one crate below
22//! `rlx-runtime`: this crate owns the *physical* concerns
23//! (which device, which buffer slot, which command stream),
24//! `rlx-runtime` owns the *logical* engine (Session, CompiledGraph,
25//! compile cache).
26//!
27//! Why split? Three reasons.
28//! 1. **Backend symmetry.** rlx-cpu / rlx-metal don't currently
29//! depend on rlx-runtime; before this split they couldn't
30//! reach the `Device` enum without a circular dep. The
31//! `rlx-ir → rlx-driver → backends → rlx-runtime` chain is
32//! strictly one-way.
33//! 2. **Testability.** A `Buffer` parity test doesn't need to
34//! pull in the entire compile + execute pipeline.
35//! 3. **Future swaps.** Replacing the engine layer (e.g. for
36//! AOT compilation) doesn't touch the driver.
37//!
38//! `rlx-runtime` re-exports every type here, so existing callers
39//! keep working without import changes.
40
41pub mod arena;
42pub mod buffer;
43pub mod collective;
44pub mod device;
45pub mod handle;
46pub mod stream;
47pub mod symmetric;
48
49pub use arena::DeviceArena;
50pub use buffer::Buffer;
51pub use collective::{ReduceKind, all_gather, all_reduce, reduce_scatter};
52pub use device::Device;
53pub use handle::BufferHandle;
54pub use stream::{CommandStream, SyncStream};
55pub use symmetric::{
56 CollectiveError, LocalTransport, Rank, SymmetricBuffer, SymmetricHeap, SymmetricTransport,
57};