LLM inference in C/C++
C++ ggml
jinja : skip copying loop scope unless a loop filter needs it (#29776)
a u s t i ndef4d406ae2c
diff --git a/common/jinja/runtime.cpp b/common/jinja/runtime.cppindex a44d63c0cc..b8a69995b0 100644--- a/common/jinja/runtime.cpp+++ b/common/jinja/runtime.cpp@@ -537,8 +537,6 @@ value for_statement::execute_impl(context & ctx) const {std::vector<value> filtered_items;for (size_t i = 0; i < items.size(); ++i) {- context loop_scope(scope);-value current = items[i];std::function<void(context&)> scope_update_fn = [](context &) { /* no-op */};@@ -584,6 +582,7 @@ value for_statement::execute_impl(context & ctx) const {}if (select_expr && test_expr) {+ context loop_scope(scope);scope_update_fn(loop_scope);value test_val = test_expr->execute(loop_scope);if (!test_val->as_bool()) {