Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 4 additions & 12 deletions src/llama-graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -956,32 +956,24 @@ void llm_graph_result::set_outputs() {

bool llm_graph_result::can_reuse(const llm_graph_params & params) {
if (!this->params.allow_reuse(params)) {
if (debug > 1) {
LLAMA_LOG_DEBUG("%s: cannot reuse graph due to incompatible graph parameters\n", __func__);
}
LLAMA_LOG_DEBUG_CONDITION(debug > 1, "%s: cannot reuse graph due to incompatible graph parameters\n", __func__);

return false;
}

if (debug > 1) {
LLAMA_LOG_DEBUG("%s: checking compatibility of %d inputs:\n", __func__, (int) inputs.size());
}
LLAMA_LOG_DEBUG_CONDITION(debug > 1, "%s: checking compatibility of %d inputs:\n", __func__, (int) inputs.size());

bool res = true;

for (auto & input : inputs) {
const bool cur = input->can_reuse(params);

if (debug > 1) {
LLAMA_LOG_DEBUG("%s: can_reuse = %d\n", "placeholder", cur);
}
LLAMA_LOG_DEBUG_CONDITION(debug > 1, "%s: can_reuse = %d\n", "placeholder", cur);

res = res && cur;
}

if (debug > 0) {
LLAMA_LOG_DEBUG("%s: can reuse graph = %d\n", __func__, res);
}
LLAMA_LOG_DEBUG_CONDITION(debug > 1, "%s: can reuse graph = %d\n", __func__, res);

return res;
}
Expand Down
7 changes: 7 additions & 0 deletions src/llama-impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ void llama_log_callback_default(ggml_log_level level, const char * text, void *
#define LLAMA_LOG_DEBUG(...) llama_log_internal(GGML_LOG_LEVEL_DEBUG, __VA_ARGS__)
#define LLAMA_LOG_CONT(...) llama_log_internal(GGML_LOG_LEVEL_CONT , __VA_ARGS__)

#define LLAMA_LOG_DEBUG_CONDITION(condition, ...) \
do { \
if (condition) { \
llama_log_internal(GGML_LOG_LEVEL_DEBUG, __VA_ARGS__); \
} \
} while(0)

//
// helpers
//
Expand Down
8 changes: 3 additions & 5 deletions src/llama-model-loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1323,11 +1323,9 @@ void llama_model_loader::done_getting_tensors(bool partial) const {
LLAMA_LOG_INFO("%s: partial load — used %d of %d tensors in the file (rest belong to a sibling model on the same .gguf)\n",
__func__, n_created, n_tensors);
}
if (n_tensors_moved > 0) {
LLAMA_LOG_DEBUG("%s: tensor '%s' (%s) (and %zu others) cannot be used with preferred buffer type %s, using %s instead\n",
__func__, first_tensor_moved_name.c_str(), first_tensor_moved_type_name.c_str(), n_tensors_moved - 1,
ggml_backend_buft_name(first_moved_from_buft), ggml_backend_buft_name(first_moved_to_buft));
}
LLAMA_LOG_DEBUG_CONDITION(n_tensors_moved > 0, "%s: tensor '%s' (%s) (and %zu others) cannot be used with preferred buffer type %s, using %s instead\n",
__func__, first_tensor_moved_name.c_str(), first_tensor_moved_type_name.c_str(), n_tensors_moved - 1,
ggml_backend_buft_name(first_moved_from_buft), ggml_backend_buft_name(first_moved_to_buft));
}

void llama_model_loader::init_mappings(bool prefetch, llama_mlocks * mlock_mmaps) {
Expand Down