atlas_rdma/lib.rs
1// SPDX-License-Identifier: AGPL-3.0-only
2
3#![deny(warnings)]
4#![deny(clippy::all)]
5
6//! atlas-rdma: the one-sided RDMA verbs primitive shared by every Atlas RDMA
7//! tier (experts / KV overflow / weight staging / LoRA / SSM snapshots).
8//!
9//! The C shim's QP/RTR/RTS attribute constants and the handshake wire codecs
10//! are a frozen external contract: they must stay byte-compatible with already
11//! deployed peers, so the shim is treated as byte-stable.
12//!
13//! CUDA-free by hard constraint (see Cargo.toml): both the non-CUDA peer
14//! daemons and the CUDA client tiers link this.
15//!
16//! `cfg(atlas_rdma_verbs)` is decided by build.rs — ON when `target_os` is not
17//! macOS and `ATLAS_SKIP_BUILD`/`SKIP_ATLAS_BUILD` is unset (there is no
18//! rdma-core probe; if the headers are missing there, `cc` fails the build
19//! loudly) — and published to direct dependents via the `links` metadata
20//! `DEP_ATLAS_RDMA_SHIM_HAS_VERBS`. See build.rs for the full story.
21
22/// Rail-env resolution helpers (`first_set` / `first_nonempty` /
23/// `first_set_u32`) — un-gated, pure `std::env`.
24pub mod env;
25/// Client handshake steps as pure `Read`/`Write` byte functions (identity
26/// tuples, no `Verbs`) — un-gated so the transcript goldens run everywhere.
27pub mod handshake;
28/// The golden handshake wire codecs (both server-param dialects, rails
29/// framing, mode/status bytes) — un-gated, a frozen external wire contract.
30pub mod wire;
31
32// Pure cardinality policy used by the verbs-gated RailSet. Kept un-gated so
33// its no-NIC regression checks execute on every development platform.
34#[cfg(any(atlas_rdma_verbs, test))]
35mod rail_count;
36
37/// Safe-ish wrapper over the C shim: one [`verbs::Verbs`] == one RC QP.
38/// Compiled only where the shim is (`cfg(atlas_rdma_verbs)`).
39#[cfg(atlas_rdma_verbs)]
40pub mod verbs;
41
42/// RailSet — the one client-side rail bring-up. Gated with the shim: it
43/// creates and connects real QPs.
44#[cfg(atlas_rdma_verbs)]
45pub mod railset;
46
47#[cfg(atlas_rdma_verbs)]
48pub use railset::{Rail, RailSet, RailSpec};
49#[cfg(atlas_rdma_verbs)]
50pub use verbs::{Gid, MrKeys, Verbs};
51pub use wire::{
52 CacheServerParams, MODE_TCP, MODE_VERBS, RemoteQp, STATUS_ERR, STATUS_OK, VerbsClientParams,
53 VerbsServerParams,
54};
55
56/// `true` iff this build of atlas-rdma compiled the verbs shim (i.e. the
57/// `atlas_rdma_verbs` cfg was emitted by build.rs). A permanent, always-
58/// compiled witness: tests assert it so a silent cfg evaporation fails
59/// `cargo test` on verbs hosts instead of green-building an empty crate.
60pub const fn verbs_enabled() -> bool {
61 cfg!(atlas_rdma_verbs)
62}