Skip to content

Commit 216e7d9

Browse files
committed
fix llama_reset_model_time
1 parent 24bea15 commit 216e7d9

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

examples/llama-bench/llama-bench.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1558,7 +1558,8 @@ int main(int argc, char ** argv) {
15581558
}
15591559
prev_inst = &inst;
15601560
} else {
1561-
llama_model_reset_time(lmodel);
1561+
// ensure load_time dost not accumulate in llama_bench when not loading the same model
1562+
llama_reset_model_time(lmodel);
15621563
}
15631564

15641565
llama_context * ctx = llama_new_context_with_model(lmodel, inst.to_llama_cparams());

include/llama.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ extern "C" {
414414
const char * path_model,
415415
struct llama_model_params params);
416416

417-
LLAMA_API void llama_model_reset_time(struct llama_model * model);
417+
LLAMA_API void llama_reset_model_time(struct llama_model * model);
418418

419419
LLAMA_API void llama_free_model(struct llama_model * model);
420420

src/llama.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8809,11 +8809,6 @@ static bool llm_load_tensors(
88098809
return true;
88108810
}
88118811

8812-
void llama_model_reset_time(llama_model * model) {
8813-
model->t_start_us = ggml_time_us();
8814-
model->t_load_us = ggml_time_us() - model->t_start_us;
8815-
}
8816-
88178812
// Returns 0 on success, -1 on error, and -2 on cancellation via llama_progress_callback
88188813
static int llama_model_load(const std::string & fname, llama_model & model, llama_model_params & params) {
88198814
model.t_start_us = ggml_time_us();
@@ -18695,6 +18690,10 @@ struct llama_model * llama_load_model_from_file(
1869518690
return model;
1869618691
}
1869718692

18693+
void llama_reset_model_time(llama_model * model) {
18694+
model->t_start_us = ggml_time_us() - model->t_load_us;
18695+
}
18696+
1869818697
void llama_free_model(struct llama_model * model) {
1869918698
delete model;
1870018699
}

0 commit comments

Comments
 (0)