#[repr(i32)]pub enum LlamaLoadMode {
Auto = -1,
None = 0,
Mmap = 1,
Mlock = 2,
MmapMlock = 3,
DirectIo = 4,
}Expand description
Exact model-file loading strategy exposed by llama.cpp.
llama_load_mode is a signed enum on every target because of the negative
LLAMA_LOAD_MODE_AUTO discriminant, so each variant uses as _ to coerce to
the #[repr(i32)] type (matching token_type).
Variants§
Auto = -1
Pick the strategy from the backend devices’ capabilities: memory-map when every device supports it, otherwise fall back to a plain read. This is llama.cpp’s default.
None = 0
No memory mapping, locking, or direct I/O.
Mmap = 1
Memory-map model files when supported.
Mlock = 2
Read model files normally and lock loaded pages in memory.
MmapMlock = 3
Memory-map model files and lock mapped pages in memory.
DirectIo = 4
Use direct I/O when supported.
Implementations§
Source§impl LlamaLoadMode
impl LlamaLoadMode
Sourcepub fn name(self) -> &'static str
pub fn name(self) -> &'static str
llama.cpp’s own name for this mode: "auto", "none", "mmap",
"mlock", "mmap+mlock" or "dio".
Wraps llama_load_mode_name, so the spelling always matches what
upstream’s logs print and what its --load-mode flag accepts.
§Panics
Panics if llama.cpp returns a non-UTF-8 name, which would mean the upstream table was corrupted.
Sourcepub fn from_name(name: &str) -> Option<Self>
pub fn from_name(name: &str) -> Option<Self>
Parse a mode from llama.cpp’s own spelling — the inverse of
Self::name. Returns None if name matches no mode.
assert_eq!(LlamaLoadMode::from_name("mmap+mlock"), Some(LlamaLoadMode::MmapMlock));
assert_eq!(LlamaLoadMode::from_name("nonsense"), None);Trait Implementations§
Source§impl Clone for LlamaLoadMode
impl Clone for LlamaLoadMode
Source§fn clone(&self) -> LlamaLoadMode
fn clone(&self) -> LlamaLoadMode
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more