MCPcopy Create free account
hub / github.com/appdevforall/CodeOnTheGo / synchronize

Method synchronize

subprojects/llama.cpp/src/llama-context.cpp:541–573  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

539}
540
541void llama_context::synchronize() {
542 if (!sched) {
543 return;
544 }
545
546 ggml_backend_sched_synchronize(sched.get());
547
548 // FIXME: if multiple single tokens are evaluated without a synchronization,
549 // the stats will be added to the prompt evaluation stats
550 // this should only happen when using batch size 1 to evaluate a batch
551
552 // add the evaluation to the stats
553 if (n_queued_tokens == 1) {
554 if (!cparams.no_perf) {
555 t_eval_us += ggml_time_us() - t_compute_start_us;
556 }
557 n_eval++;
558 } else if (n_queued_tokens > 1) {
559 if (!cparams.no_perf) {
560 t_p_eval_us += ggml_time_us() - t_compute_start_us;
561 }
562 n_p_eval += n_queued_tokens;
563 }
564
565 // get a more accurate load time, upon first eval
566 if (n_queued_tokens > 0 && !has_evaluated_once) {
567 t_load_us = ggml_time_us() - t_start_us;
568 has_evaluated_once = true;
569 }
570
571 n_queued_tokens = 0;
572 t_compute_start_us = 0;
573}
574
575const llama_model & llama_context::get_model() const {
576 return model;

Calls 3

ggml_time_usFunction · 0.85
getMethod · 0.65

Tested by

no test coverage detected