]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
llama : deprecate `llama_set_warmup` (#24009)
authorGeorgi Gerganov <redacted>
Tue, 2 Jun 2026 07:30:38 +0000 (10:30 +0300)
committerGitHub <redacted>
Tue, 2 Jun 2026 07:30:38 +0000 (10:30 +0300)
* llama : deprecate `llama_set_warmup`

* cont : fix type

Co-authored-by: Daniel Bevenius <redacted>
---------

Co-authored-by: Daniel Bevenius <redacted>
common/common.cpp
include/llama.h
src/llama-cparams.h
tests/test-backend-sampler.cpp

index 81b8b750020344a026b853547f76dce25bfcc26d..0460c6c530f525d2cbba1e3faca0120ecde615c7 100644 (file)
@@ -1389,8 +1389,6 @@ common_init_result_ptr common_init_from_params(common_params & params, bool mode
     if (params.warmup) {
         LOG_INF("%s: warming up the model with an empty run - please wait ... (--no-warmup to disable)\n", __func__);
 
-        llama_set_warmup(lctx, true);
-
         std::vector<llama_token> tmp;
         llama_token bos = llama_vocab_bos(vocab);
         llama_token eos = llama_vocab_eos(vocab);
@@ -1421,7 +1419,6 @@ common_init_result_ptr common_init_from_params(common_params & params, bool mode
         llama_memory_clear(llama_get_memory(lctx), true);
         llama_synchronize(lctx);
         llama_perf_context_reset(lctx);
-        llama_set_warmup(lctx, false);
 
         // reset samplers to reset RNG state after warmup to the seeded state
         res->reset_samplers();
index a79a491c5925cff5df5de7500f34294520c9d6bf..9f78aa9a056d58db4eb83ce4299019877825d849 100644 (file)
@@ -976,7 +976,11 @@ extern "C" {
 
     // Set whether the model is in warmup mode or not
     // If true, all model tensors are activated during llama_decode() to load and cache their weights.
-    LLAMA_API void llama_set_warmup(struct llama_context * ctx, bool warmup);
+    //
+    // note: using this can cause extra graph reallocations because it changes the graph topology with MoE models,
+    //       so it is generally not recommended to use in practice. will be removed in the future
+    DEPRECATED(LLAMA_API void llama_set_warmup(struct llama_context * ctx, bool warmup),
+            "user code should do warmup runs manually [TAG_LLAMA_GRAPH_NO_WARMUP]");
 
     // Set abort callback
     LLAMA_API void llama_set_abort_callback(struct llama_context * ctx, ggml_abort_callback abort_callback, void * abort_callback_data);
index ba4951a09a245881be9acdbc02f5ad0266f586ce..52e1c4f54ab387322aabcf0712c1f3b15c3b3785 100644 (file)
@@ -39,7 +39,7 @@ struct llama_cparams {
     bool fused_gdn_ch;       // use fused gated delta net (chunked)
     bool auto_fgdn;
     bool no_perf;
-    bool warmup;
+    bool warmup;             // TODO: remove [TAG_LLAMA_GRAPH_NO_WARMUP]
     bool op_offload;
     bool kv_unified;
     bool pipeline_parallel;
index 58361ae80aea11118597636eac7275fe943fa507..61ddf91feaa466d21d8273515e8ba4462af4b8ec 100644 (file)
@@ -107,8 +107,6 @@ struct test_context {
             throw std::runtime_error("failed to create context");
         }
 
-        llama_set_warmup(ctx.get(), false);
-
         vocab = llama_model_get_vocab(model);
         n_vocab = llama_vocab_n_tokens(vocab);
     }