Repository navigation
[mirror #259] Show the MoE cache hit rate in perf output and llama-server /metrics - #13
LeoBorcherding wants to merge 3 commits into
Conversation
- add MoE cache hits, misses and uploaded bytes to llama_perf_context_data, reset by llama_perf_context_reset - print the hit rate in llama_perf_context_print and common_perf_print - server: add llamacpp:moe_cache_* counters to /metrics and moe_cache_hits/misses to the request timings - cli: show the hit rate next to the prompt and generation speed
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Something went wrong. Try again later by commenting “@codex review”. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bac1669e8d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| res.n_moe_cache_hits = perf.n_moe_cache_hits - perf_start.n_moe_cache_hits; | ||
| res.n_moe_cache_misses = perf.n_moe_cache_misses - perf_start.n_moe_cache_misses; |
There was a problem hiding this comment.
Keep MoE timing counts request-local
When multiple server slots process requests concurrently, these deltas include cache hits and misses from every slot since this slot started. Each response can therefore report the same shared cache activity as if it belonged to that request, making its timing data and the CLI's displayed hit rate misleading. Keep these counts at the context-wide /metrics level or avoid presenting them as per-request timings.
Useful? React with 👍 / 👎.
…red a decode The cache counters belong to the context, so with concurrent slots each request's delta included the other slots' lookups. /metrics keeps the totals.
|
Pushed @codex review |
|
Codex Review: Something went wrong. Try again later by commenting “@codex review”. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 049eee3134
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| res->n_processing_slots = n_processing_slots; | ||
| res->n_tasks_deferred = queue_tasks.queue_tasks_deferred_size(); | ||
| res->metrics = metrics; | ||
| res->perf = llama_perf_context(ctx_tgt); |
There was a problem hiding this comment.
Avoid reading performance counters during decode
When /metrics is served during a decode, server_queue::yield_to_queue() runs task handling on its worker thread while the caller runs llama_process() on the main thread. This snapshot reaches llama_moe_cache::get_stats() and reads the plain stats_small/stats_large counters while the cache callback updates them, creating a C++ data race that can also return inconsistent totals. Take the snapshot after decode synchronization or protect the counters.
Useful? React with 👍 / 👎.
…each decode /metrics can run on the queue worker during llama_process(), which raced with the cache updating its counters.
|
Pushed @codex review |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Mirror of unslothai#259 at
bac1669e8on its merge base, for Codex review. Do not merge.