From d146a14f77eb456d2082f0620e3b310b7bcee0a8 Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Wed, 12 Feb 2025 12:41:36 +0200 Subject: [PATCH] context : minor naming fix --- src/llama-context.cpp | 2 +- src/llama-context.h | 12 ++++++------ src/llama.cpp | 12 ++++++------ 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/llama-context.cpp b/src/llama-context.cpp index 353fc7fea..f0d8bdaba 100644 --- a/src/llama-context.cpp +++ b/src/llama-context.cpp @@ -189,7 +189,7 @@ bool llama_context::apply_adapter_cvec( return cvec.apply(model, data, len, n_embd, il_start, il_end); } -llama_perf_context_data llama_context::get_perf() const { +llama_perf_context_data llama_context::perf_get_data() const { llama_perf_context_data data = {}; data.t_start_ms = 1e-3 * t_start_us; diff --git a/src/llama-context.h b/src/llama-context.h index 7b7699952..8ec7d3e2b 100644 --- a/src/llama-context.h +++ b/src/llama-context.h @@ -94,7 +94,6 @@ struct llama_context { // virtual int decode(llama_batch & inp_batch) = 0; - // encode a batch of tokens by evaluating the encoder part of the transformer // // - lctx: llama context @@ -296,7 +295,7 @@ struct llama_context { // perf - virtual llama_perf_context_data get_perf() const; + virtual llama_perf_context_data perf_get_data() const; virtual void perf_reset(); // members @@ -326,20 +325,21 @@ protected: bool has_evaluated_once = false; - mutable int64_t t_start_us; - mutable int64_t t_load_us; + mutable int64_t t_start_us = 0; + mutable int64_t t_load_us = 0; mutable int64_t t_p_eval_us = 0; mutable int64_t t_eval_us = 0; mutable int64_t t_compute_start_us = 0; - mutable int64_t n_queued_tokens = 0; + mutable int64_t n_queued_tokens = 0; mutable int32_t n_p_eval = 0; // number of tokens in eval calls for the prompt (with batch size > 1) mutable int32_t n_eval = 0; // number of eval calls }; // TODO: make implementation details private -struct llama_context_unified : public llama_context { +class llama_context_unified : public llama_context { +public: struct batch_manager; // TODO: tmp until llama-model starts implementing the graph build function diff --git a/src/llama.cpp b/src/llama.cpp index ab6b7f5d3..c568f8d15 100644 --- a/src/llama.cpp +++ b/src/llama.cpp @@ -54,11 +54,11 @@ enum llm_norm_type { }; struct llm_build_context { - llama_context & lctx; - const llama_model & model; - const llama_hparams & hparams; - const llama_cparams & cparams; - const llama_ubatch & ubatch; + llama_context & lctx; + const llama_model & model; + const llama_hparams & hparams; + const llama_cparams & cparams; + const llama_ubatch & ubatch; const int64_t n_embd; const int64_t n_layer; @@ -7854,7 +7854,7 @@ struct llama_perf_context_data llama_perf_context(const struct llama_context * c return data; } - data = ctx->get_perf(); + data = ctx->perf_get_data(); return data; }