spark_model/lora/
mod.rs

1// SPDX-License-Identifier: AGPL-3.0-only
2
3//! Startup-static PEFT LoRA adapter: remap/validate/pack into the
4//! fixed-address rank-padded pool. v0 = one adapter, slot 0, always on.
5//!
6//! NAMING: everything here is `Peft*`/`adapter_*`/`Lora*` (adapter sense) —
7//! `kv_lora_rank`/`q_lora_rank` (atlas-core/src/config.rs:182-207) are MLA
8//! vocabulary, not this.
9//!
10//! NOTE on leaks: the intermediate `WeightStore` device copies of the
11//! unpadded A/B tensors become garbage after pool packing and are never
12//! freed (no dealloc on weight structs anywhere in Atlas). Accepted at
13//! holo adapter scale (~tens of MiB).
14//!
15//! SDD facade: the surface is split by functional seam into `types` (the
16//! module/AB enums + weight/slot structs + `LoraWeights` impl), `slot_math`
17//! (pure slot/offset placement + routing), `key` (classify + adapter identity),
18//! `env` (the `$ATLAS_LORA_*` hatches + `validate_peft_config`), and `loading`
19//! (audit/pack + the load entry points). Every public name re-exports at its
20//! own visibility so `crate::lora::X` / `spark_model::lora::X` paths are stable.
21
22mod audit;
23mod env;
24mod expert_apply;
25mod expert_pack;
26mod key;
27mod loading;
28mod moe_row_adapter;
29mod overlay;
30mod overlay_build;
31mod overlay_tables;
32mod slot_math;
33mod target;
34mod types;
35
36pub(crate) use audit::{AuditedAdapter, audit_adapter};
37pub use env::*;
38pub use expert_apply::*;
39pub use key::*;
40pub use loading::*;
41pub use moe_row_adapter::*;
42pub use overlay::*;
43pub use overlay_build::*;
44pub use overlay_tables::*;
45pub use slot_math::*;
46pub use target::*;
47pub use types::*;
48
49// The RDMA network entry point is CUDA-only, but its landing-plan and pair-
50// rebuild logic is pure host code. Compile that logic in tests as well so its
51// contracts remain testable on non-CUDA hosts.
52#[cfg(any(feature = "cuda", test))]
53// RDMA LoRA staging lands adapter tensors via spark-storage's RDMA weight
54// loader; RDMA needs rdma-core, so this stays unix-only even though the NVMe
55// tier itself is now portable.
56#[cfg(unix)]
57pub mod rdma_stage;
58
59#[cfg(test)]
60#[path = "test_support.rs"]
61mod test_support;