The serve stack's routed experts came only from `load_resident_expert_source`, a 50 GB RAM copy of the 144 shard-0 banks that `MappedExpertBank` then page-locks whole: impossible on a 32-48 GB PC. * model-format: `ResidentTensor` storage is an owned copy or a read-only MAP_SHARED mapping of the verified shard (`VerifiedGgufFile::map_resident_tensor`, same descriptor, bounds and size checks); `Qwen4ExpArtifact::load_mapped_expert_source` builds the same bank catalog from mappings, no RAM admission (generate.cpp `src.set_gguf` + `FileExpertSource::open`). The crate's lint is relaxed from forbid to deny so exactly this mapping owner can allow its mmap/munmap/slice. * cuda-driver: a lease of mapped banks makes `MappedExpertBank` pageable: no cuMemHostRegister; every consumer the Original serve stack uses (`cache_source` for the prompt copy ring, VRAM tier fills/swaps, PCIe staging) copies with cuMemcpyHtoDAsync from pageable memory; the zero-copy device aliases (`retained_span_handle`, `copy_triplet`) are refused. * runtime: `ModelBinding::load_mapped_expert_source`. The bytes are the file's, so consumers see what the resident copy holds. Unit test `mapped_tensor_is_the_files_bytes_and_a_retained_owner`; model-format --lib 128 passed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
24 lines
718 B
TOML
24 lines
718 B
TOML
[package]
|
|
name = "leleka-model-format"
|
|
version = "0.1.0"
|
|
description = "Bounded native GGUF metadata and tensor indexing for Leleka"
|
|
edition.workspace = true
|
|
license.workspace = true
|
|
rust-version.workspace = true
|
|
autotests = false
|
|
|
|
[dependencies]
|
|
sha2 = "0.11"
|
|
|
|
[target.'cfg(target_os = "linux")'.dependencies]
|
|
rustix = { version = "=1.1.5", features = ["mm", "param"] }
|
|
|
|
# The workspace forbids unsafe code; this crate denies it instead so that exactly one owner, the read-only
|
|
# shared mapping of a verified GGUF tensor (gguf_resident.rs `FileSpan`, the low-RAM expert source), can
|
|
# `#[allow]` its mmap/munmap/slice. Everything else stays unsafe-free.
|
|
[lints.rust]
|
|
unsafe_code = "deny"
|
|
|
|
[lints.clippy]
|
|
all = "warn"
|