llama: add lazy mode auto, fix iGPU regression

This commit is contained in:
Ruben Ortlam
2026-09-03 15:25:24 +02:00
parent de8656bd94
commit 38d20da312
5 changed files with 38 additions and 18 deletions
+8 -6
View File
@@ -2736,13 +2736,15 @@ common_params_context common_params_parser_init(common_params & params, llama_ex
add_opt(common_arg(
{"-lzm", "--lazy-mode"}, "MODE",
"on-demand reading of certain tensors, for example per-layer embeddings (default: auto)\n"
"- on: read the rows of such tensors from disk on demand instead of keeping them resident (requires mmap)\n"
"- auto: on, but only for tensors larger than 4 GiB\n"
"- off: always keep them resident",
"- auto: large where mmap is supported, off otherwise\n"
"- off: always keep them resident\n"
"- large: read only large tensors (>4GiB) from disk on demand (requires mmap)\n"
"- all: read the all such tensors from disk on demand instead of keeping them resident (requires mmap)",
[](common_params & params, const std::string & value) {
/**/ if (value == "on") { params.lazy_mode = LLAMA_LAZY_MODE_ON; }
else if (value == "auto") { params.lazy_mode = LLAMA_LAZY_MODE_AUTO; }
else if (value == "off") { params.lazy_mode = LLAMA_LAZY_MODE_OFF; }
/**/ if (value == "auto") { params.lazy_mode = LLAMA_LAZY_MODE_AUTO; }
else if (value == "off") { params.lazy_mode = LLAMA_LAZY_MODE_OFF; }
else if (value == "large") { params.lazy_mode = LLAMA_LAZY_MODE_LARGE; }
else if (value == "all") { params.lazy_mode = LLAMA_LAZY_MODE_ALL; }
else { throw std::invalid_argument("invalid value"); }
}
).set_env("LLAMA_ARG_LAZY_MODE"));