cli, server: apply --prio process priority setting

The --prio flag was parsed but never applied in llama-cli and
llama-server. Only llama-completion and llama-bench called
set_process_priority(). Add the missing calls after backend
initialization so the flag takes effect in all tools.
This commit is contained in:
許元豪 2026-03-11 09:28:43 +08:00
parent 4d99d45084
commit 2266f48d68
2 changed files with 8 additions and 0 deletions

View File

@ -339,6 +339,10 @@ int main(int argc, char ** argv) {
llama_backend_init();
llama_numa_init(params.numa);
if (!set_process_priority(params.cpuparams.priority)) {
LOG_WRN("%s: failed to set process priority\n", __func__);
}
// TODO: avoid using atexit() here by making `console` a singleton
console::init(params.simple_io, params.use_color);
atexit([]() { console::cleanup(); });

View File

@ -107,6 +107,10 @@ int main(int argc, char ** argv) {
llama_backend_init();
llama_numa_init(params.numa);
if (!set_process_priority(params.cpuparams.priority)) {
LOG_WRN("%s: failed to set process priority\n", __func__);
}
LOG_INF("system info: n_threads = %d, n_threads_batch = %d, total_threads = %d\n", params.cpuparams.n_threads, params.cpuparams_batch.n_threads, std::thread::hardware_concurrency());
LOG_INF("\n");
LOG_INF("%s\n", common_params_get_system_info(params).c_str());