Files
leleka/crates/model-format/Cargo.toml
T
Pavlo RatushnyiandClaude Opus 5.5 e0141e510a model-format: opt-in huge-page placement of the resident expert banks (LELEKA_HUGEPAGES)
LELEKA_HUGEPAGES=on|thp (off by default; LELEKA_BANK_THP=on now selects thp) places each of the 144
resident bank copies in its own 2 MiB-aligned anonymous mapping instead of a heap Vec: MAP_HUGETLB when
HugePages_Free covers the bank (mode on only; nothing reserved), else MADV_HUGEPAGE + MADV_POPULATE_WRITE.
After the bank load and the shard page-cache drop, before cuMemHostRegister, huge_pages::settle() reports
the coverage from /proc/self/smaps and MADV_COLLAPSEs any 2 MiB range that fell back (best effort).
Pure placement: the bytes are the file's (read_tensor_into, same bounds and size fences). No system
setting is read-write.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 00:11:36 +01:00

31 lines
1.1 KiB
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", "fs"] }
# huge_pages.rs: MADV_COLLAPSE, MAP_HUGETLB/MAP_HUGE_2MB, MADV_POPULATE_WRITE (not in rustix's Advice/MapFlags).
libc = "=0.2.190"
# Windows: read-only file views (CreateFileMapping/MapViewOfFile) and the available-memory figure.
[target.'cfg(windows)'.dependencies]
leleka-libc-shim = { path = "../libc-shim" }
# 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. The opt-in huge-page bank buffer (huge_pages.rs `HugeBuffer`) is the second
# such owner. Everything else stays unsafe-free.
[lints.rust]
unsafe_code = "deny"
[lints.clippy]
all = "warn"