Files
calculet-npu-research-archive/history/llama.cpp/llama.cpp-recovered-expired-stashes.patch
T

242 lines
10 KiB
Diff

commit c44438579a1cc573cbdb2519dda46ccd04ddc817
Merge: 207ca38c f06f10a5
Author: Bomeng Wang <wangbomeng@calculet.tech>
AuthorDate: Thu Apr 9 10:37:03 2026 +0800
Commit: Bomeng Wang <wangbomeng@calculet.tech>
CommitDate: Thu Apr 9 10:37:03 2026 +0800
WIP on dev: 207ca38c delet extra printf
tools/server/server.cpp | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
diff --cc tools/server/server.cpp
index 868d17b4,868d17b4..d2a035ba
--- a/tools/server/server.cpp
+++ b/tools/server/server.cpp
@@@ -1875,7 -1875,7 +1875,7 @@@ struct server_slot
GGML_ASSERT(task);
auto previous_msg = chat_msg;
-- SRV_DBG("Parsing chat message: %s\n", generated_text.c_str());
++ //SRV_DBG("Parsing chat message: %s\n", generated_text.c_str());
auto new_msg = common_chat_parse(
generated_text,
/* is_partial= */ stop != STOP_TYPE_EOS,
@@@ -1920,13 -1920,13 +1920,17 @@@
}
void print_timings() const {
-- const double t_prompt = t_prompt_processing / n_prompt_tokens_processed;
-- const double n_prompt_second = 1e3 / t_prompt_processing * n_prompt_tokens_processed;
++ const double t_copyout_total = t_inference_outcopy / 32 * 31;
++ const double t_copyout_decode = (t_inference_outcopy - t_prefill_inference_outcopy) / 32 * 31;
++ const double t_copyout_prefill = t_prefill_inference_outcopy / 32 * 31;
-- const double t_gen = t_token_generation / n_decoded;
-- const double n_gen_second = 1e3 / t_token_generation * n_decoded;
++ const double t_prompt = (t_prompt_processing - t_copyout_prefill) / n_prompt_tokens_processed;
++ const double n_prompt_second = 1e3 / (t_prompt_processing - t_copyout_prefill) * n_prompt_tokens_processed;
-- const double t_total = t_prompt_processing + t_token_generation;
++ const double t_gen = (t_token_generation - t_copyout_decode) / n_decoded;
++ const double n_gen_second = 1e3 / (t_token_generation - t_copyout_decode) * n_decoded;
++
++ const double t_total = t_prompt_processing + t_token_generation -t_copyout_total ;
const double t_framework_other = t_total - t_inference_accumulated - t_inference_incopy - t_inference_outcopy - t_sampling_accumulated - t_unknown;
const double t_prompt_inference = t_prefill_inference_accumulated / n_prompt_tokens_processed;
@@@ -1950,9 -1950,9 +1954,9 @@@
" [Device] Unknown : %10.2f ms \n"
" [CPU] Sampling: %10.2f ms \n"
" [CPU] Fw Ovhd : %10.2f ms (Batch Prep, Logic, etc.)\n",
-- t_prompt_processing, n_prompt_tokens_processed, t_prompt, n_prompt_second,
-- t_token_generation, n_decoded, t_gen, n_gen_second,
-- t_prompt_processing + t_token_generation, n_prompt_tokens_processed + n_decoded,
++ t_prompt_processing - t_copyout_prefill , n_prompt_tokens_processed, t_prompt, n_prompt_second,
++ t_token_generation - t_copyout_decode , n_decoded, t_gen, n_gen_second,
++ t_prompt_processing + t_token_generation - t_copyout_total, n_prompt_tokens_processed + n_decoded,
t_inference_accumulated, t_prefill_inference_accumulated, t_prompt_inference, t_inference_accumulated - t_prefill_inference_accumulated, t_gen_inference,
t_inference_incopy, t_prefill_inference_incopy, t_prompt_incopy, t_inference_incopy - t_prefill_inference_incopy, t_gen_incopy,
t_inference_outcopy, t_prefill_inference_outcopy, t_prompt_outcopy, t_inference_outcopy - t_prefill_inference_outcopy, t_gen_outcopy,
commit 2a67be2e31c4b7b28fa3937893ec9e86bf5d9f4d
Merge: 99dd308a 294f5e41
Author: Bomeng Wang <wangbomeng@calculet.tech>
AuthorDate: Mon Apr 27 11:41:25 2026 +0800
Commit: Bomeng Wang <wangbomeng@calculet.tech>
CommitDate: Mon Apr 27 11:41:25 2026 +0800
WIP on (no branch): 99dd308a server: fix max_seq_len
common/common.cpp | 90 ++++++++++++++++++++++++++---------------------------
src/llama-calrt.cpp | 14 +++++++--
2 files changed, 57 insertions(+), 47 deletions(-)
diff --cc common/common.cpp
index 625b369b,625b369b..898d4452
--- a/common/common.cpp
+++ b/common/common.cpp
@@@ -1058,51 -1058,51 +1058,51 @@@ struct common_init_result common_init_f
params.sampling.dry_penalty_last_n = llama_n_ctx(lctx);
}
-- if (params.warmup) {
-- LOG_WRN("%s: warming up the model with an empty run - please wait ... (--no-warmup to disable)\n", __func__);
--
-- llama_set_warmup(lctx, true);
--
-- std::vector<llama_token> tmp;
-- llama_token bos = llama_vocab_bos(vocab);
-- llama_token eos = llama_vocab_eos(vocab);
--
-- // some models (e.g. T5) don't have a BOS token
-- if (bos != LLAMA_TOKEN_NULL) {
-- tmp.push_back(bos);
-- }
-- if (eos != LLAMA_TOKEN_NULL) {
-- tmp.push_back(eos);
-- }
-- if (tmp.empty()) {
-- tmp.push_back(0);
-- }
--
-- if (llama_model_has_encoder(model)) {
-- #ifdef USE_CALRT
-- //calrt_encode(cal_ctx, llama_batch_get_one(tmp.data(), tmp.size()));
-- #else
-- llama_encode(lctx, llama_batch_get_one(tmp.data(), tmp.size()));
-- #endif
-- llama_token decoder_start_token_id = llama_model_decoder_start_token(model);
-- if (decoder_start_token_id == LLAMA_TOKEN_NULL) {
-- decoder_start_token_id = bos;
-- }
-- tmp.clear();
-- tmp.push_back(decoder_start_token_id);
-- }
-- if (llama_model_has_decoder(model)) {
-- #ifdef USE_CALRT
-- calrt_decode(cal_ctx, llama_batch_get_one(tmp.data(), std::min(tmp.size(), (size_t) params.n_batch)));
-- #else
-- llama_decode(lctx, llama_batch_get_one(tmp.data(), std::min(tmp.size(), (size_t) params.n_batch)));
-- #endif
-- }
-- llama_memory_clear(llama_get_memory(lctx), true);
-- llama_synchronize(lctx);
-- llama_perf_context_reset(lctx);
-- llama_set_warmup(lctx, false);
-- }
++ // if (params.warmup) {
++ // LOG_WRN("%s: warming up the model with an empty run - please wait ... (--no-warmup to disable)\n", __func__);
++
++ // llama_set_warmup(lctx, true);
++
++ // std::vector<llama_token> tmp;
++ // llama_token bos = llama_vocab_bos(vocab);
++ // llama_token eos = llama_vocab_eos(vocab);
++
++ // // some models (e.g. T5) don't have a BOS token
++ // if (bos != LLAMA_TOKEN_NULL) {
++ // tmp.push_back(bos);
++ // }
++ // if (eos != LLAMA_TOKEN_NULL) {
++ // tmp.push_back(eos);
++ // }
++ // if (tmp.empty()) {
++ // tmp.push_back(0);
++ // }
++
++ // if (llama_model_has_encoder(model)) {
++ // #ifdef USE_CALRT
++ // //calrt_encode(cal_ctx, llama_batch_get_one(tmp.data(), tmp.size()));
++ // #else
++ // llama_encode(lctx, llama_batch_get_one(tmp.data(), tmp.size()));
++ // #endif
++ // llama_token decoder_start_token_id = llama_model_decoder_start_token(model);
++ // if (decoder_start_token_id == LLAMA_TOKEN_NULL) {
++ // decoder_start_token_id = bos;
++ // }
++ // tmp.clear();
++ // tmp.push_back(decoder_start_token_id);
++ // }
++ // if (llama_model_has_decoder(model)) {
++ // #ifdef USE_CALRT
++ // calrt_decode(cal_ctx, llama_batch_get_one(tmp.data(), std::min(tmp.size(), (size_t) params.n_batch)));
++ // #else
++ // llama_decode(lctx, llama_batch_get_one(tmp.data(), std::min(tmp.size(), (size_t) params.n_batch)));
++ // #endif
++ // }
++ // llama_memory_clear(llama_get_memory(lctx), true);
++ // llama_synchronize(lctx);
++ // llama_perf_context_reset(lctx);
++ // llama_set_warmup(lctx, false);
++ // }
iparams.model.reset(model);
iparams.context.reset(lctx);
diff --cc src/llama-calrt.cpp
index 9f41c955,9f41c955..e8dc07c6
--- a/src/llama-calrt.cpp
+++ b/src/llama-calrt.cpp
@@@ -43,6 -43,6 +43,16 @@@ std::unique_ptr<calrt::VirtualDevice> i
throw std::runtime_error("failed to create vdevice");
}
++ uint64_t commitId = 0;
++ uint32_t rdata = 0;
++ vDev->GetDevice()->ReadReg(0x0a238254, rdata);
++ commitId |=(((uint64_t)rdata) << 32);
++ vDev->GetDevice()->ReadReg(0x0a238258, rdata);
++ commitId |=((uint64_t)rdata);
++
++ LLAMA_LOG_INFO("CalcoreRT: =================== CalcoreRT Version: %016llx ====================\n", commitId);
++ LLAMA_LOG_INFO("CalRT: =================== CalRT Version %s ====================\n", calrt::calrt_version());
++
return vDev;
}
@@@ -664,7 -664,7 +674,7 @@@ calrt::CalbinModel * calrt_context::get
}
if (smodelName.empty()) {
-- LLAMA_LOG_ERROR("submodel who's name contains %s not found", name.c_str());
++ //LLAMA_LOG_ERROR("submodel who's name contains %s not found", name.c_str());
return nullptr;
}
@@@ -681,7 -681,7 +691,7 @@@ calrt::CalbinModel * calrt_context::get
}
if (smodelName.empty()) {
-- LLAMA_LOG_ERROR("submodel who's name contains %s not found", name1.c_str(), name2.c_str());
++ //LLAMA_LOG_ERROR("submodel who's name contains %s not found", name1.c_str(), name2.c_str());
return nullptr;
}
commit 81d4fd2c584e6df9199181e44b77fc3d939c0a67
Merge: efa1876b 499f6ff4
Author: Bomeng Wang <wangbomeng@calculet.tech>
AuthorDate: Thu Apr 30 16:18:01 2026 +0800
Commit: Bomeng Wang <wangbomeng@calculet.tech>
CommitDate: Thu Apr 30 16:18:01 2026 +0800
WIP on (no branch): efa1876b update version print
src/llama-calrt.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --cc src/llama-calrt.cpp
index 0dd65366,0dd65366..845d1df3
--- a/src/llama-calrt.cpp
+++ b/src/llama-calrt.cpp
@@@ -133,7 -133,7 +133,7 @@@ int calrt_context::decode(const llama_b
// require that all tokens are output
if (n_outputs_all != n_tokens_all) {
LLAMA_LOG_ERROR(
-- "%s: pooled embedding requires that all tokens are output (n_outputs_all = %d, n_tokens_all = %d)\n",
++ "%s: pooled embedding requires that all tokens are eoutput (n_outputs_all = %d, n_tokens_all = %d)\n",
__func__, n_outputs_all, n_tokens_all);
return -1;
}