feat(backend): env-configurable llama.cpp log verbosity (LLOYAL_LLAMA_VERBOSITY) - #48
Open
lloyal-research wants to merge 1 commit into
Open
feat(backend): env-configurable llama.cpp log verbosity (LLOYAL_LLAMA_VERBOSITY)#48lloyal-research wants to merge 1 commit into
lloyal-research wants to merge 1 commit into
Conversation
…_VERBOSITY) BackendManager pinned common_log_set_verbosity_thold to LOG_DEFAULT_LLAMA (INFO), which filters llama.cpp's per-context KV / recurrent-state / compute-buffer allocation lines — they're emitted at ggml INFO but map to LOG_LEVEL_TRACE, and the callback prints only verbosity <= thold. Make the threshold env-overridable (LLOYAL_LLAMA_VERBOSITY), defaulting to the shipped level when unset, so those allocation lines can be surfaced on demand for memory profiling: LLOYAL_LLAMA_VERBOSITY=4 (TRACE) shows KV self size / RS buffer size / compute buffer size per context. This is the tool that measured the served-host memory breakdown in lloyal-infra scaling.md §8.
There was a problem hiding this comment.
Pull request overview
Adds an environment override for llama.cpp’s log verbosity threshold so operators can surface otherwise-filtered per-context memory/allocation log lines when needed, while keeping the default behavior unchanged when the env var is unset.
Changes:
- Introduces
LLOYAL_LLAMA_VERBOSITYto override thecommon_log_set_verbosity_thold(...)threshold. - Reads the env var during backend initialization and applies the configured threshold (or the default when unset).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+53
to
+54
| const char* verbEnv = std::getenv("LLOYAL_LLAMA_VERBOSITY"); | ||
| common_log_set_verbosity_thold(verbEnv ? std::atoi(verbEnv) : LOG_DEFAULT_LLAMA); |
Comment on lines
3
to
6
| #include <llama/llama.h> | ||
| #include "log.h" | ||
| #include <cstdlib> | ||
| #include <mutex> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Make llama.cpp's log-verbosity threshold env-overridable via
LLOYAL_LLAMA_VERBOSITY.Why
BackendManagerhardcodedcommon_log_set_verbosity_thold(LOG_DEFAULT_LLAMA)=INFO. llama.cpp's per-context allocation lines (KV self size,RS buffer size,compute buffer size) are emitted at ggml-INFObut map toLOG_LEVEL_TRACE (4), and the callback prints onlyverbosity <= thold— so at the defaultINFO (3)they're filtered, making per-context memory invisible.LLOYAL_LLAMA_VERBOSITY=4lifts the threshold toTRACEand surfaces them. Default behavior is unchanged when the env is unset.Impact
This is the tool that produced the served-host memory breakdown in
lloyal-infra/docs/scaling.md§8 (the GDN recurrent-state-∝-nSeqMaxfinding that fixed the Metal multi-session thrash). 6-line, no behavior change unless the env is set. No dedicated publish needed — rides the next naturallloyal.noderelease.