Files
leleka/crates/context/src/lib.rs
T
Pavlo RatushnyiandClaude Sonnet 5.5 18d712eed5 feat(context): reuse the port-rope leleka-context crate and port setup.py's RAM/VRAM sizing rules
crates/context is taken verbatim from claude/port-rope (rope scaling incl. setup_resolve_rope/derived_factor, memory
plan, context policy). New setup_policy module: ram_ctx, ctx_ram_need, resident_budget_gib, low_ram_*; a golden grid
from 'import setup' (resolve_rope/derived_factor too, which the branch had only transcribed) checked bit for bit.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-14 15:45:55 +02:00

18 lines
874 B
Rust

//! Pure (no I/O, no unsafe, no GPU) serving-context policy shared by the CUDA driver and the runtime.
//!
//! - [`rope_scaling`]: linear/YaRN scaling and the host cos/sin table builder (port of `rope_scaling.hpp`,
//! `rope.cu`).
//! - [`memory_plan`]: port of `plan.hpp` memory admission and the per-format KV byte costs.
//! - [`context_policy`]: effective context/slot/rope configuration from a request, or a refusal.
//! - [`setup_policy`]: `setup.py`'s RAM/VRAM/context sizing rules (`ram_ctx`, `resident_budget_gib`, `low_ram_*`).
//! - [`geometry`]: every byte size of the fixed native QSA stack as a function of the context cell count.
//!
//! The crate builds on every platform so the arithmetic can be tested on a machine without CUDA.
pub mod context_policy;
pub mod geometry;
pub mod memory_plan;
pub mod ptx_abi;
pub mod rope_scaling;
pub mod setup_policy;