]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
examples : add --kv-unified to batched example (#18774)
authorDaniel Bevenius <redacted>
Mon, 12 Jan 2026 12:47:58 +0000 (13:47 +0100)
committerGitHub <redacted>
Mon, 12 Jan 2026 12:47:58 +0000 (13:47 +0100)
This commit adds the --kv-unified flag to the batched example. This flag
is currently specified in the README.md as required, but is currently
not available as a command line option for the batched example.

The motivation for this is that specifying this flag as the README
instructs, will lead to an error about the flag not being recognized,
and without this option the example fail with the following error:
```console
split_equal: sequential split is not supported when there are coupled
sequences in the input batch (you may need to use the -kvu flag)
decode: failed to find a memory slot for batch of size 4
main: llama_decode() failed
```

common/arg.cpp
common/common.h
examples/batched/batched.cpp

index ec0a2f015e06f5f109643d57e9ffa5bd10db59b3..f2675f842a0e61f9860f5459c745434468e2ff56 100644 (file)
@@ -1295,7 +1295,7 @@ common_params_context common_params_parser_init(common_params & params, llama_ex
         [](common_params & params) {
             params.kv_unified = true;
         }
-    ).set_env("LLAMA_ARG_KV_UNIFIED").set_examples({LLAMA_EXAMPLE_SERVER, LLAMA_EXAMPLE_PERPLEXITY}));
+    ).set_env("LLAMA_ARG_KV_UNIFIED").set_examples({LLAMA_EXAMPLE_SERVER, LLAMA_EXAMPLE_PERPLEXITY, LLAMA_EXAMPLE_BATCHED}));
     add_opt(common_arg(
         {"--context-shift"},
         {"--no-context-shift"},
index 7794c0268bd4a704ff65f782e53e83e0ccc598e3..b3ac04c4ae7e399b48e36f8f3802c4902979fc94 100644 (file)
@@ -80,6 +80,7 @@ int32_t cpu_get_num_math();
 //
 
 enum llama_example {
+    LLAMA_EXAMPLE_BATCHED,
     LLAMA_EXAMPLE_DEBUG,
     LLAMA_EXAMPLE_COMMON,
     LLAMA_EXAMPLE_SPECULATIVE,
index 6b134b4f6fa811cff36721b1fb804cfdca84f9b0..687503877037b713da80805a8b577ca04127da83 100644 (file)
@@ -21,7 +21,7 @@ int main(int argc, char ** argv) {
     params.prompt = "Hello my name is";
     params.n_predict = 32;
 
-    if (!common_params_parse(argc, argv, params, LLAMA_EXAMPLE_COMMON, print_usage)) {
+    if (!common_params_parse(argc, argv, params, LLAMA_EXAMPLE_BATCHED, print_usage)) {
         return 1;
     }