MCPcopy Create free account
hub / github.com/Tiiny-AI/PowerInfer / synchronize

Method synchronize

smallthinker/src/llama-context.cpp:350–378  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

348}
349
350void llama_context::synchronize() {
351 ggml_backend_sched_synchronize(sched.get());
352
353 // FIXME: if multiple single tokens are evaluated without a synchronization,
354 // the stats will be added to the prompt evaluation stats
355 // this should only happen when using batch size 1 to evaluate a batch
356
357 // add the evaluation to the stats
358 if (n_queued_tokens == 1) {
359 if (!cparams.no_perf) {
360 t_eval_us += ggml_time_us() - t_compute_start_us;
361 }
362 n_eval++;
363 } else if (n_queued_tokens > 1) {
364 if (!cparams.no_perf) {
365 t_p_eval_us += ggml_time_us() - t_compute_start_us;
366 }
367 n_p_eval += n_queued_tokens;
368 }
369
370 // get a more accurate load time, upon first eval
371 if (n_queued_tokens > 0 && !has_evaluated_once) {
372 t_load_us = ggml_time_us() - t_start_us;
373 has_evaluated_once = true;
374 }
375
376 n_queued_tokens = 0;
377 t_compute_start_us = 0;
378}
379
380const llama_model & llama_context::get_model() const {
381 return model;

Callers 15

ggml_backend_tensor_setFunction · 0.80
ggml_backend_tensor_getFunction · 0.80
ggml_backend_synchronizeFunction · 0.80
llama_synchronizeFunction · 0.80
llama_get_logitsFunction · 0.80
llama_get_logits_ithFunction · 0.80
llama_get_embeddingsFunction · 0.80
llama_get_embeddings_ithFunction · 0.80
llama_get_embeddings_seqFunction · 0.80
llama_state_get_dataFunction · 0.80
llama_state_set_dataFunction · 0.80
llama_state_load_fileFunction · 0.80

Calls 3

ggml_time_usFunction · 0.50
getMethod · 0.45

Tested by

no test coverage detected